natural data structure

This commit is contained in:
Martin Diehl 2021-05-22 17:21:07 +02:00
parent 212c4296cf
commit 6d31f77deb
5 changed files with 63 additions and 31 deletions

View File

@ -15,7 +15,7 @@ module discretization
discretization_Nelems discretization_Nelems
integer, public, protected, dimension(:), allocatable :: & integer, public, protected, dimension(:), allocatable :: &
discretization_materialAt !ToDo: discretization_materialID discretization_materialAt !ToDo: discretization_ID_material
real(pReal), public, protected, dimension(:,:), allocatable :: & real(pReal), public, protected, dimension(:,:), allocatable :: &
discretization_IPcoords0, & discretization_IPcoords0, &

View File

@ -16,6 +16,12 @@ module material
implicit none implicit none
private private
type :: tRotationContainer
type(Rotation), dimension(:), allocatable :: data
end type
type(tRotationContainer), dimension(:), allocatable :: material_orientation0_2
integer, dimension(:), allocatable, public, protected :: & integer, dimension(:), allocatable, public, protected :: &
homogenization_Nconstituents !< number of grains in each homogenization homogenization_Nconstituents !< number of grains in each homogenization
integer, public, protected :: & integer, public, protected :: &
@ -39,6 +45,8 @@ module material
material_phaseMemberAt !< position of the element within its phase instance material_phaseMemberAt !< position of the element within its phase instance
public :: & public :: &
tRotationContainer, &
material_orientation0_2, &
material_init material_init
contains contains
@ -88,7 +96,7 @@ subroutine parse()
real(pReal) :: & real(pReal) :: &
frac frac
integer :: & integer :: &
el, ip, co, & el, ip, co, ma, &
h, ce h, ce
materials => config_material%get('material') materials => config_material%get('material')
@ -153,6 +161,17 @@ subroutine parse()
enddo enddo
allocate(material_orientation0_2(materials%length))
do ma = 1, materials%length
material => materials%get(ma)
constituents => material%get('constituents')
allocate(material_orientation0_2(ma)%data(constituents%length))
do co = 1, constituents%length
call material_orientation0_2(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4))
enddo
enddo
end subroutine parse end subroutine parse

View File

@ -19,8 +19,9 @@ module phase
implicit none implicit none
private private
type(Rotation), dimension(:,:,:), allocatable :: & type(tRotationContainer), dimension(:), allocatable :: &
material_orientation0 !< initial orientation of each grain,IP,element phase_orientation0, &
phase_orientation
type(rotation), dimension(:,:,:), allocatable :: & type(rotation), dimension(:,:,:), allocatable :: &
crystallite_orientation !< current orientation crystallite_orientation !< current orientation
@ -346,7 +347,7 @@ contains
subroutine phase_init subroutine phase_init
integer :: & integer :: &
ph ph, ce, co, ma
class (tNode), pointer :: & class (tNode), pointer :: &
debug_constitutive, & debug_constitutive, &
materials, & materials, &
@ -367,6 +368,25 @@ subroutine phase_init
materials => config_material%get('material') materials => config_material%get('material')
phases => config_material%get('phase') phases => config_material%get('phase')
allocate(phase_orientation0(phases%length))
do ph = 1,phases%length
allocate(phase_orientation0(ph)%data(count(material_phaseID==ph)))
enddo
do ce = 1, size(material_phaseID,2)
ma = discretization_materialAt((ce-1)/discretization_nIPs+1)
do co = 1,homogenization_Nconstituents(material_homogenizationID(ce))
ph = material_phaseID(co,ce)
phase_orientation0(ph)%data(material_phaseEntry(co,ce)) = material_orientation0_2(ma)%data(co)
enddo
enddo
allocate(phase_orientation(phases%length))
do ph = 1,phases%length
phase_orientation(ph)%data = phase_orientation0(ph)%data
enddo
call mechanical_init(materials,phases) call mechanical_init(materials,phases)
call damage_init call damage_init
call thermal_init(phases) call thermal_init(phases)
@ -602,7 +622,7 @@ function crystallite_push33ToRef(co,ce, tensor33)
ph = material_phaseID(co,ce) ph = material_phaseID(co,ce)
en = material_phaseEntry(co,ce) en = material_phaseEntry(co,ce)
T = matmul(material_orientation0(co,ph,en)%asMatrix(),transpose(math_inv33(phase_F(co,ce)))) ! ToDo: initial orientation correct? T = matmul(phase_orientation0(ph)%data(en)%asMatrix(),transpose(math_inv33(phase_F(co,ce)))) ! ToDo: initial orientation correct?
crystallite_push33ToRef = matmul(transpose(T),matmul(tensor33,T)) crystallite_push33ToRef = matmul(transpose(T),matmul(tensor33,T))

View File

@ -204,7 +204,6 @@ module subroutine mechanical_init(materials,phases)
num_crystallite, & num_crystallite, &
material, & material, &
constituents, & constituents, &
constituent, &
phase, & phase, &
mech mech
@ -228,8 +227,6 @@ module subroutine mechanical_init(materials,phases)
allocate(phase_mechanical_P(phases%length)) allocate(phase_mechanical_P(phases%length))
allocate(phase_mechanical_S0(phases%length)) allocate(phase_mechanical_S0(phases%length))
allocate(material_orientation0(homogenization_maxNconstituents,phases%length,maxVal(material_phaseEntry)))
do ph = 1, phases%length do ph = 1, phases%length
Nmembers = count(material_phaseID == ph) Nmembers = count(material_phaseID == ph)
@ -260,15 +257,11 @@ module subroutine mechanical_init(materials,phases)
do el = 1, size(material_phaseMemberAt,3); do ip = 1, size(material_phaseMemberAt,2) do el = 1, size(material_phaseMemberAt,3); do ip = 1, size(material_phaseMemberAt,2)
do co = 1, homogenization_Nconstituents(material_homogenizationAt(el)) do co = 1, homogenization_Nconstituents(material_homogenizationAt(el))
material => materials%get(discretization_materialAt(el)) material => materials%get(discretization_materialAt(el))
constituents => material%get('constituents')
constituent => constituents%get(co)
ph = material_phaseID(co,(el-1)*discretization_nIPs + ip) ph = material_phaseID(co,(el-1)*discretization_nIPs + ip)
en = material_phaseEntry(co,(el-1)*discretization_nIPs + ip) en = material_phaseEntry(co,(el-1)*discretization_nIPs + ip)
call material_orientation0(co,ph,en)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4)) phase_mechanical_Fp0(ph)%data(1:3,1:3,en) = phase_orientation0(ph)%data(en)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005)
phase_mechanical_Fp0(ph)%data(1:3,1:3,en) = material_orientation0(co,ph,en)%asMatrix() ! Fp reflects initial orientation (see 10.1016/j.actamat.2006.01.005)
phase_mechanical_Fp0(ph)%data(1:3,1:3,en) = phase_mechanical_Fp0(ph)%data(1:3,1:3,en) & phase_mechanical_Fp0(ph)%data(1:3,1:3,en) = phase_mechanical_Fp0(ph)%data(1:3,1:3,en) &
/ math_det33(phase_mechanical_Fp0(ph)%data(1:3,1:3,en))**(1.0_pReal/3.0_pReal) / math_det33(phase_mechanical_Fp0(ph)%data(1:3,1:3,en))**(1.0_pReal/3.0_pReal)
phase_mechanical_Fi0(ph)%data(1:3,1:3,en) = math_I3 phase_mechanical_Fi0(ph)%data(1:3,1:3,en) = math_I3

View File

@ -1450,8 +1450,8 @@ module subroutine plastic_nonlocal_updateCompatibility(orientation,ph,i,e)
elseif (prm%chi_GB >= 0.0_pReal) then elseif (prm%chi_GB >= 0.0_pReal) then
!* GRAIN BOUNDARY ! !* GRAIN BOUNDARY !
!* fixed transmissivity for adjacent ips with different texture (only if explicitly given in material.config) !* fixed transmissivity for adjacent ips with different texture (only if explicitly given in material.config)
if (any(dNeq(material_orientation0(1,ph,en)%asQuaternion(), & if (any(dNeq(phase_orientation0(ph)%data(en)%asQuaternion(), &
material_orientation0(1,neighbor_phase,neighbor_me)%asQuaternion())) .and. & phase_orientation0(neighbor_phase)%data(neighbor_me)%asQuaternion())) .and. &
(.not. phase_localPlasticity(neighbor_phase))) & (.not. phase_localPlasticity(neighbor_phase))) &
forall(s1 = 1:ns) my_compatibility(:,s1,s1,n) = sqrt(prm%chi_GB) forall(s1 = 1:ns) my_compatibility(:,s1,s1,n) = sqrt(prm%chi_GB)
else else