From 3f96c12e0618f710f7017d01ebd5d40a09ad3063 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 29 Jan 2020 09:25:39 +0100 Subject: [PATCH] avoid code duplication --- src/crystallite.f90 | 2 +- src/homogenization_mech_RGC.f90 | 4 ++-- src/math.f90 | 34 --------------------------------- src/rotations.f90 | 7 +++---- 4 files changed, 6 insertions(+), 41 deletions(-) diff --git a/src/crystallite.f90 b/src/crystallite.f90 index 00d3f5ba6..2b81c728c 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -239,7 +239,7 @@ subroutine crystallite_init do e = FEsolving_execElem(1),FEsolving_execElem(2) myNcomponents = homogenization_Ngrains(material_homogenizationAt(e)) do i = FEsolving_execIP(1), FEsolving_execIP(2); do c = 1, myNcomponents - crystallite_Fp0(1:3,1:3,c,i,e) = math_EulerToR(material_Eulers(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)%asMatrix() ! 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)) diff --git a/src/homogenization_mech_RGC.f90 b/src/homogenization_mech_RGC.f90 index ec9b94df9..062908c52 100644 --- a/src/homogenization_mech_RGC.f90 +++ b/src/homogenization_mech_RGC.f90 @@ -174,8 +174,8 @@ module subroutine mech_RGC_init !-------------------------------------------------------------------------------------------------- ! assigning cluster orientations - dependentState(homogenization_typeInstance(h))%orientation = spread(math_EulerToR(prm%angles*inRad),3,NofMyHomog) - !dst%orientation = spread(math_EulerToR(prm%angles*inRad),3,NofMyHomog) ifort version 18.0.1 crashes (for whatever reason) + dependentState(homogenization_typeInstance(h))%orientation = spread(eu2om(prm%angles*inRad),3,NofMyHomog) + !dst%orientation = spread(eu2om(prm%angles*inRad),3,NofMyHomog) ifort version 18.0.1 crashes (for whatever reason) end associate diff --git a/src/math.f90 b/src/math.f90 index 292fc2483..4be2d4fc9 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -838,40 +838,6 @@ pure function math_Voigt66to3333(m66) end function math_Voigt66to3333 -!-------------------------------------------------------------------------------------------------- -!> @brief rotation matrix from Bunge-Euler (3-1-3) angles (in radians) -!> @details deprecated -!-------------------------------------------------------------------------------------------------- -pure function math_EulerToR(Euler) - - real(pReal), dimension(3), intent(in) :: Euler - real(pReal), dimension(3,3) :: math_EulerToR - real(pReal) :: c1, C, c2, s1, S, s2 - - c1 = cos(Euler(1)) - C = cos(Euler(2)) - c2 = cos(Euler(3)) - s1 = sin(Euler(1)) - S = sin(Euler(2)) - s2 = sin(Euler(3)) - - math_EulerToR(1,1) = c1*c2 -s1*C*s2 - math_EulerToR(1,2) = -c1*s2 -s1*C*c2 - math_EulerToR(1,3) = s1*S - - math_EulerToR(2,1) = s1*c2 +c1*C*s2 - math_EulerToR(2,2) = -s1*s2 +c1*C*c2 - math_EulerToR(2,3) = -c1*S - - math_EulerToR(3,1) = S*s2 - math_EulerToR(3,2) = S*c2 - math_EulerToR(3,3) = C - - math_EulerToR = transpose(math_EulerToR) ! convert to passive rotation - -end function math_EulerToR - - !-------------------------------------------------------------------------------------------------- !> @brief draw a random sample from Gauss variable !-------------------------------------------------------------------------------------------------- diff --git a/src/rotations.f90 b/src/rotations.f90 index ec4de32d5..16e63c180 100644 --- a/src/rotations.f90 +++ b/src/rotations.f90 @@ -1,6 +1,6 @@ ! ################################################################### ! Copyright (c) 2013-2014, Marc De Graef/Carnegie Mellon University -! Modified 2017-2019, Martin Diehl/Max-Planck-Institut für Eisenforschung GmbH +! Modified 2017-2020, Martin Diehl/Max-Planck-Institut für Eisenforschung GmbH ! All rights reserved. ! ! Redistribution and use in source and binary forms, with or without modification, are @@ -82,12 +82,11 @@ module rotations end type rotation public :: & - rotations_init - + rotations_init, & + eu2om contains - !-------------------------------------------------------------------------------------------------- !> @brief doing self test !--------------------------------------------------------------------------------------------------