From 89858543faf273d496e1f9e28bbc85ad219c6e3e Mon Sep 17 00:00:00 2001 From: Sharan Roongta Date: Tue, 23 Feb 2021 11:44:39 +0100 Subject: [PATCH] more cleaning; use 'ce', 'ph', 'me' wherever applicable hide ip,el --- src/homogenization.f90 | 8 +++---- src/homogenization_mechanical.f90 | 14 +++++------- src/phase.f90 | 5 ++-- src/phase_mechanical.f90 | 38 ++++++++++++++----------------- 4 files changed, 28 insertions(+), 37 deletions(-) diff --git a/src/homogenization.f90 b/src/homogenization.f90 index 496963ce7..eb008042d 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -126,15 +126,13 @@ module homogenization integer, intent(in) :: h end subroutine mechanical_results - module function mechanical_updateState(subdt,subF,ce,ip,el) result(doneAndHappy) + module function mechanical_updateState(subdt,subF,ce) result(doneAndHappy) real(pReal), intent(in) :: & subdt !< current time step real(pReal), intent(in), dimension(3,3) :: & subF integer, intent(in) :: & - ce, & !< cell - ip, & - el + ce !< cell logical, dimension(2) :: doneAndHappy end function mechanical_updateState @@ -327,7 +325,7 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE if (.not. converged) then doneAndHappy = [.true.,.false.] else - doneAndHappy = mechanical_updateState(dt,homogenization_F(1:3,1:3,ce),ce,ip,el) + doneAndHappy = mechanical_updateState(dt,homogenization_F(1:3,1:3,ce),ce) converged = all(doneAndHappy) endif endif diff --git a/src/homogenization_mechanical.f90 b/src/homogenization_mechanical.f90 index 74f3e475b..fed2f2c65 100644 --- a/src/homogenization_mechanical.f90 +++ b/src/homogenization_mechanical.f90 @@ -154,11 +154,11 @@ module subroutine mechanical_homogenize(dt,ip,el) case (HOMOGENIZATION_NONE_ID) chosenHomogenization homogenization_P(1:3,1:3,ce) = phase_mechanical_getP(1,ce) - homogenization_dPdF(1:3,1:3,1:3,1:3,ce) = phase_mechanical_dPdF(dt,1,ip,el) + homogenization_dPdF(1:3,1:3,1:3,1:3,ce) = phase_mechanical_dPdF(dt,1,ce) case (HOMOGENIZATION_ISOSTRAIN_ID) chosenHomogenization do co = 1, homogenization_Nconstituents(material_homogenizationAt(el)) - dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(dt,co,ip,el) + dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(dt,co,ce) Ps(:,:,co) = phase_mechanical_getP(co,ce) enddo call mechanical_isostrain_averageStressAndItsTangent(& @@ -169,7 +169,7 @@ module subroutine mechanical_homogenize(dt,ip,el) case (HOMOGENIZATION_RGC_ID) chosenHomogenization do co = 1, homogenization_Nconstituents(material_homogenizationAt(el)) - dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(dt,co,ip,el) + dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(dt,co,ce) Ps(:,:,co) = phase_mechanical_getP(co,ce) enddo call mechanical_RGC_averageStressAndItsTangent(& @@ -187,16 +187,14 @@ end subroutine mechanical_homogenize !> @brief update the internal state of the homogenization scheme and tell whether "done" and !> "happy" with result !-------------------------------------------------------------------------------------------------- -module function mechanical_updateState(subdt,subF,ce,ip,el) result(doneAndHappy) +module function mechanical_updateState(subdt,subF,ce) result(doneAndHappy) real(pReal), intent(in) :: & subdt !< current time step real(pReal), intent(in), dimension(3,3) :: & subF integer, intent(in) :: & - ce, & - ip, & - el + ce logical, dimension(2) :: doneAndHappy integer :: co @@ -207,7 +205,7 @@ module function mechanical_updateState(subdt,subF,ce,ip,el) result(doneAndHappy) if (homogenization_type(material_homogenizationAt2(ce)) == HOMOGENIZATION_RGC_ID) then do co = 1, homogenization_Nconstituents(material_homogenizationAt2(ce)) - dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(subdt,co,ip,el) + dPdFs(:,:,:,:,co) = phase_mechanical_dPdF(subdt,co,ce) Fs(:,:,co) = phase_mechanical_getF(co,ce) Ps(:,:,co) = phase_mechanical_getP(co,ce) enddo diff --git a/src/phase.f90 b/src/phase.f90 index 281f47de7..9ab5c386a 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -120,12 +120,11 @@ module phase end subroutine mechanical_restore - module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) + module function phase_mechanical_dPdF(dt,co,ce) result(dPdF) real(pReal), intent(in) :: dt integer, intent(in) :: & co, & !< counter in constituent loop - ip, & !< counter in integration point loop - el !< counter in element loop + ce real(pReal), dimension(3,3,3,3) :: dPdF end function phase_mechanical_dPdF diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 61782bab2..be14c57e6 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -355,12 +355,11 @@ end subroutine mechanical_init !> the elastic and intermediate deformation gradients using Hooke's law !-------------------------------------------------------------------------------------------------- subroutine phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & - Fe, Fi, co, ip, el) + Fe, Fi, ph, me) integer, intent(in) :: & - co, & !< component-ID of integration point - ip, & !< integration point - el !< element + ph, & + me real(pReal), intent(in), dimension(3,3) :: & Fe, & !< elastic deformation gradient Fi !< intermediate deformation gradient @@ -373,17 +372,15 @@ subroutine phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & real(pReal), dimension(3,3) :: E real(pReal), dimension(3,3,3,3) :: C integer :: & - ho, & !< homogenization - d, & !< counter in degradation loop - i, j, ph, me + d, & !< counter in degradation loop + i, j - ho = material_homogenizationAt(el) - C = math_66toSym3333(phase_homogenizedC(material_phaseAt(co,el),material_phaseMemberAt(co,ip,el))) + C = math_66toSym3333(phase_homogenizedC(ph,me)) - DegradationLoop: do d = 1, phase_NstiffnessDegradations(material_phaseAt(co,el)) - degradationType: select case(phase_stiffnessDegradation(d,material_phaseAt(co,el))) + DegradationLoop: do d = 1, phase_NstiffnessDegradations(ph) + degradationType: select case(phase_stiffnessDegradation(d,ph)) case (STIFFNESS_DEGRADATION_damage_ID) degradationType - C = C * phase_damage_get_phi(co,ip,el)**2 + C = C * damage_phi(ph,me)**2 end select degradationType enddo DegradationLoop @@ -541,7 +538,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken) B = math_I3 - Delta_t*Lpguess Fe = matmul(matmul(A,B), invFi_new) call phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, & - Fe, Fi_new, co, ip, el) + Fe, Fi_new, ph, me) call plastic_LpAndItsTangents(Lp_constitutive, dLp_dS, dLp_dFi, & S, Fi_new, ph,me) @@ -1263,13 +1260,12 @@ end subroutine mechanical_restore !-------------------------------------------------------------------------------------------------- !> @brief Calculate tangent (dPdF). !-------------------------------------------------------------------------------------------------- -module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) +module function phase_mechanical_dPdF(dt,co,ce) result(dPdF) real(pReal), intent(in) :: dt integer, intent(in) :: & co, & !< counter in constituent loop - ip, & !< counter in integration point loop - el !< counter in element loop + ce real(pReal), dimension(3,3,3,3) :: dPdF integer :: & @@ -1294,12 +1290,12 @@ module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) logical :: error - ph = material_phaseAt(co,el) - me = material_phaseMemberAt(co,ip,el) + ph = material_phaseAt2(co,ce) + me = material_phaseMemberAt2(co,ce) call phase_hooke_SandItsTangents(devNull,dSdFe,dSdFi, & phase_mechanical_Fe(ph)%data(1:3,1:3,me), & - phase_mechanical_Fi(ph)%data(1:3,1:3,me),co,ip,el) + phase_mechanical_Fi(ph)%data(1:3,1:3,me),ph,me) call phase_LiAndItsTangents(devNull,dLidS,dLidFi, & phase_mechanical_S(ph)%data(1:3,1:3,me), & phase_mechanical_Fi(ph)%data(1:3,1:3,me), & @@ -1324,7 +1320,7 @@ module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) enddo; enddo call math_invert(temp_99,error,math_3333to99(lhs_3333)) if (error) then - call IO_warning(warning_ID=600,el=el,ip=ip,g=co, & + call IO_warning(warning_ID=600, & ext_msg='inversion error in analytic tangent calculation') dFidS = 0.0_pReal else @@ -1354,7 +1350,7 @@ module function phase_mechanical_dPdF(dt,co,ip,el) result(dPdF) call math_invert(temp_99,error,math_eye(9)+math_3333to99(lhs_3333)) if (error) then - call IO_warning(warning_ID=600,el=el,ip=ip,g=co, & + call IO_warning(warning_ID=600, & ext_msg='inversion error in analytic tangent calculation') dSdF = rhs_3333 else