symbolic names

This commit is contained in:
Martin Diehl 2021-07-24 15:03:26 +02:00
parent db07ee2113
commit d87b10bfe7
4 changed files with 25 additions and 23 deletions

View File

@ -8,6 +8,7 @@ module material
use prec
use config
use results
use math
use IO
use rotations
use discretization
@ -19,8 +20,12 @@ module material
type :: tRotationContainer
type(Rotation), dimension(:), allocatable :: data
end type
type :: tTensorContainer
real(pReal), dimension(:,:,:), allocatable :: data
end type
type(tRotationContainer), dimension(:), allocatable :: material_orientation0
type(tRotationContainer), dimension(:), allocatable :: material_O_0
integer, dimension(:), allocatable, public, protected :: &
homogenization_Nconstituents !< number of grains in each homogenization
@ -41,8 +46,9 @@ module material
integer, dimension(:,:,:), allocatable, public, protected :: & ! (constituent,IP,elem)
material_phaseMemberAt !TODO: remove
public :: &
tTensorContainer, &
tRotationContainer, &
material_orientation0, &
material_O_0, &
material_init
contains
@ -152,15 +158,15 @@ subroutine parse()
enddo
allocate(material_orientation0(materials%length))
allocate(material_O_0(materials%length))
do ma = 1, materials%length
material => materials%get(ma)
constituents => material%get('constituents')
allocate(material_orientation0(ma)%data(constituents%length))
allocate(material_O_0(ma)%data(constituents%length))
do co = 1, constituents%length
constituent => constituents%get(co)
call material_orientation0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4))
call material_O_0(ma)%data(co)%fromQuaternion(constituent%get_as1dFloat('O',requiredSize=4))
enddo
enddo

View File

@ -26,12 +26,8 @@ module phase
real(pReal), allocatable, dimension(:) :: phase_rho
type(tRotationContainer), dimension(:), allocatable :: &
phase_orientation0, &
phase_orientation
type :: tTensorContainer
real(pReal), dimension(:,:,:), allocatable :: data
end type
phase_O_0, &
phase_O
type :: tNumerics
integer :: &
@ -364,7 +360,7 @@ subroutine phase_init
allocate(phase_lattice(phases%length))
allocate(phase_cOverA(phases%length),source=-1.0_pReal)
allocate(phase_rho(phases%length))
allocate(phase_orientation0(phases%length))
allocate(phase_O_0(phases%length))
do ph = 1,phases%length
phase => phases%get(ph)
@ -374,20 +370,20 @@ subroutine phase_init
if (any(phase_lattice(ph) == ['hP','tI'])) &
phase_cOverA(ph) = phase%get_asFloat('c/a')
phase_rho(ph) = phase%get_asFloat('rho',defaultVal=0.0_pReal)
allocate(phase_orientation0(ph)%data(count(material_phaseID==ph)))
allocate(phase_O_0(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(ma)%data(co)
phase_O_0(ph)%data(material_phaseEntry(co,ce)) = material_O_0(ma)%data(co)
enddo
enddo
allocate(phase_orientation(phases%length))
allocate(phase_O(phases%length))
do ph = 1,phases%length
phase_orientation(ph)%data = phase_orientation0(ph)%data
phase_O(ph)%data = phase_O_0(ph)%data
enddo
call mechanical_init(materials,phases)
@ -577,10 +573,10 @@ subroutine crystallite_orientations(co,ip,el)
ph = material_phaseID(co,(el-1)*discretization_nIPs + ip)
en = material_phaseEntry(co,(el-1)*discretization_nIPs + ip)
call phase_orientation(ph)%data(en)%fromMatrix(transpose(math_rotationalPart(mechanical_F_e(ph,en))))
call phase_O(ph)%data(en)%fromMatrix(transpose(math_rotationalPart(mechanical_F_e(ph,en))))
if (plasticState(material_phaseAt(1,el))%nonlocal) &
call plastic_nonlocal_updateCompatibility(phase_orientation,material_phaseAt(1,el),ip,el)
call plastic_nonlocal_updateCompatibility(phase_O,material_phaseAt(1,el),ip,el)
end subroutine crystallite_orientations
@ -602,7 +598,7 @@ function crystallite_push33ToRef(co,ce, tensor33)
ph = material_phaseID(co,ce)
en = material_phaseEntry(co,ce)
T = matmul(phase_orientation0(ph)%data(en)%asMatrix(),transpose(math_inv33(phase_F(co,ce)))) ! ToDo: initial orientation correct?
T = matmul(phase_O_0(ph)%data(en)%asMatrix(),transpose(math_inv33(phase_F(co,ce)))) ! ToDo: initial orientation correct?
crystallite_push33ToRef = matmul(transpose(T),matmul(tensor33,T))

View File

@ -265,7 +265,7 @@ module subroutine mechanical_init(materials,phases)
do ph = 1, phases%length
do en = 1, count(material_phaseID == ph)
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) = phase_O_0(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) = 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)
phase_mechanical_Fi0(ph)%data(1:3,1:3,en) = math_I3
@ -935,7 +935,7 @@ subroutine crystallite_results(group,ph)
call results_writeDataset(phase_mechanical_S(ph)%data,group//'/mechanical/','S', &
'second Piola-Kirchhoff stress','Pa')
case('O')
selected_rotations = select_rotations(phase_orientation(ph)%data)
selected_rotations = select_rotations(phase_O(ph)%data)
call results_writeDataset(selected_rotations,group//'/mechanical',output_constituent(ph)%label(ou),&
'crystal orientation as quaternion','q_0 (q_1 q_2 q_3)')
call results_addAttribute('lattice',phase_lattice(ph),group//'/mechanical/'//output_constituent(ph)%label(ou))

View File

@ -1402,8 +1402,8 @@ module subroutine plastic_nonlocal_updateCompatibility(orientation,ph,i,e)
forall(s1 = 1:ns) my_compatibility(:,s1,s1,n) = 0.0_pReal
elseif (prm%chi_GB >= 0.0_pReal) then
!* GRAIN BOUNDARY
if (any(dNeq(phase_orientation0(ph)%data(en)%asQuaternion(), &
phase_orientation0(neighbor_phase)%data(neighbor_me)%asQuaternion())) .and. &
if (any(dNeq(phase_O_0(ph)%data(en)%asQuaternion(), &
phase_O_0(neighbor_phase)%data(neighbor_me)%asQuaternion())) .and. &
plasticState(neighbor_phase)%nonlocal) &
forall(s1 = 1:ns) my_compatibility(:,s1,s1,n) = sqrt(prm%chi_GB)
else