From 792dda866d33cc2a94532339e57b67d206ec35f6 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 19 Sep 2019 19:42:28 -0700 Subject: [PATCH] rotation class has consistent set of conversions crytallite_oriention0 was essentially a copy of material_EulerAngles --- src/crystallite.f90 | 13 +++++-------- src/material.f90 | 16 ++++++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/crystallite.f90 b/src/crystallite.f90 index 9ef492532..014211a96 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -47,8 +47,7 @@ module crystallite crystallite_subFrac, & !< already calculated fraction of increment crystallite_subStep !< size of next integration step type(rotation), dimension(:,:,:), allocatable :: & - crystallite_orientation, & !< orientation - crystallite_orientation0 !< initial orientation + crystallite_orientation !< current orientation real(pReal), dimension(:,:,:,:,:), allocatable, public, protected :: & crystallite_Fe, & !< current "elastic" def grad (end of converged time step) crystallite_P !< 1st Piola-Kirchhoff stress per grain @@ -211,7 +210,6 @@ subroutine crystallite_init allocate(crystallite_subFrac(cMax,iMax,eMax), source=0.0_pReal) allocate(crystallite_subStep(cMax,iMax,eMax), source=0.0_pReal) allocate(crystallite_orientation(cMax,iMax,eMax)) - allocate(crystallite_orientation0(cMax,iMax,eMax)) allocate(crystallite_localPlasticity(cMax,iMax,eMax), source=.true.) allocate(crystallite_requested(cMax,iMax,eMax), source=.false.) allocate(crystallite_todo(cMax,iMax,eMax), source=.false.) @@ -382,7 +380,7 @@ subroutine crystallite_init do e = FEsolving_execElem(1),FEsolving_execElem(2) myNcomponents = homogenization_Ngrains(material_homogenizationAt(e)) do i = FEsolving_execIP(1,e), FEsolving_execIP(2,e); do c = 1, myNcomponents - crystallite_Fp0(1:3,1:3,c,i,e) = math_EulerToR(material_EulerAngles(1:3,c,i,e)) ! plastic def gradient reflects init orientation + crystallite_Fp0(1:3,1:3,c,i,e) = material_orientation0(c,i,e)%asRotationMatrix() ! plastic def gradient reflects init orientation crystallite_Fi0(1:3,1:3,c,i,e) = constitutive_initialFi(c,i,e) crystallite_F0(1:3,1:3,c,i,e) = math_I3 crystallite_localPlasticity(c,i,e) = phase_localPlasticity(material_phaseAt(c,e)) @@ -403,7 +401,6 @@ subroutine crystallite_init crystallite_partionedF = crystallite_F0 call crystallite_orientations() - crystallite_orientation0 = crystallite_orientation ! store initial orientations for calculation of grain rotations !$OMP PARALLEL DO do e = FEsolving_execElem(1),FEsolving_execElem(2) @@ -860,8 +857,8 @@ function crystallite_push33ToRef(ipc,ip,el, tensor33) ip, & ipc - T = matmul(math_EulerToR(material_EulerAngles(1:3,ipc,ip,el)), & - transpose(math_inv33(crystallite_subF(1:3,1:3,ipc,ip,el)))) + T = matmul(material_orientation0(ipc,ip,el)%asRotationMatrix(), & ! ToDo: initial orientation correct? + transpose(math_inv33(crystallite_subF(1:3,1:3,ipc,ip,el)))) crystallite_push33ToRef = matmul(transpose(T),matmul(tensor33,T)) end function crystallite_push33ToRef @@ -909,7 +906,7 @@ function crystallite_postResults(ipc, ip, el) crystallite_postResults(c+1:c+mySize) = crystallite_orientation(ipc,ip,el)%asQuaternion() case (grainrotation_ID) - rot = crystallite_orientation0(ipc,ip,el)%misorientation(crystallite_orientation(ipc,ip,el)) + rot = material_orientation0(ipc,ip,el)%misorientation(crystallite_orientation(ipc,ip,el)) mySize = 4 crystallite_postResults(c+1:c+mySize) = rot%asAxisAnglePair() crystallite_postResults(c+4) = inDeg * crystallite_postResults(c+4) ! angle in degree diff --git a/src/material.f90 b/src/material.f90 index d902557fc..57b47c67d 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -152,8 +152,8 @@ module material integer, dimension(:,:,:), allocatable, public, protected :: & material_texture !< texture (index) of each grain,IP,element. Only used by plastic_nonlocal - real(pReal), dimension(:,:,:,:), allocatable, public, protected :: & - material_EulerAngles !< initial orientation of each grain,IP,element + type(Rotation), dimension(:,:,:), allocatable, public, protected :: & + material_orientation0 !< initial orientation of each grain,IP,element logical, dimension(:), allocatable, public, protected :: & microstructure_active, & @@ -313,17 +313,17 @@ subroutine material_init !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! new mappings - allocate(material_phaseAt(homogenization_maxNgrains,discretization_nElem), source=0) - allocate(material_texture(homogenization_maxNgrains,discretization_nIP,discretization_nElem), source=0) !this is only needed by plasticity nonlocal - allocate(material_EulerAngles(3,homogenization_maxNgrains,discretization_nIP,discretization_nElem),source=0.0_pReal) + allocate(material_phaseAt(homogenization_maxNgrains,discretization_nElem), source=0) + allocate(material_texture(homogenization_maxNgrains,discretization_nIP,discretization_nElem),source=0) !this is only needed by plasticity nonlocal + allocate(material_orientation0(homogenization_maxNgrains,discretization_nIP,discretization_nElem)) do e = 1, discretization_nElem do i = 1, discretization_nIP myMicro = discretization_microstructureAt(e) do c = 1, homogenization_Ngrains(discretization_homogenizationAt(e)) - material_phaseAt(c,e) = microstructure_phase(c,myMicro) - material_texture(c,i,e) = microstructure_texture(c,myMicro) - material_EulerAngles(1:3,c,i,e) = texture_Eulers(material_texture(c,i,e))%asEulerAngles() ! this is a copy of crystallite_orientation0 + material_phaseAt(c,e) = microstructure_phase(c,myMicro) + material_texture(c,i,e) = microstructure_texture(c,myMicro) + material_orientation0(c,i,e) = texture_Eulers(material_texture(c,i,e)) ! this is a copy of crystallite_orientation0 enddo enddo enddo