From 801e9f512b3bfa0df5af1aa26a8b96900a3bc746 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 21 May 2021 22:07:55 +0200 Subject: [PATCH] simplified state initialization - not needed for damage (is an intial value problem, will trickle down) - plastic initializes state, copy to state0 (centrally) --- src/phase.f90 | 30 ++++--------------- src/phase_damage.f90 | 6 +++- src/phase_mechanical.f90 | 8 ++++- ...phase_mechanical_plastic_dislotungsten.f90 | 2 -- src/phase_mechanical_plastic_dislotwin.f90 | 2 -- src/phase_mechanical_plastic_isotropic.f90 | 2 -- ...phase_mechanical_plastic_kinehardening.f90 | 2 -- ...phase_mechanical_plastic_phenopowerlaw.f90 | 2 -- 8 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/phase.f90 b/src/phase.f90 index 280c2e365..4c9f170ee 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -67,10 +67,6 @@ module phase damageState - integer, public, protected :: & - phase_plasticity_maxSizeDotState, & - phase_damage_maxSizeDotState - interface ! == cleaned:begin ================================================================================= @@ -242,7 +238,7 @@ module phase end function phase_homogenizedC module function phase_damage_C(C_homogenized,ph,en) result(C) real(pReal), dimension(3,3,3,3), intent(in) :: C_homogenized - integer, intent(in) :: ph,en + integer, intent(in) :: ph,en real(pReal), dimension(3,3,3,3) :: C end function phase_damage_C @@ -377,19 +373,6 @@ subroutine phase_init call damage_init call thermal_init(phases) - - phase_damage_maxSizeDotState = 0 - PhaseLoop2:do ph = 1,phases%length -!-------------------------------------------------------------------------------------------------- -! partition and initialize state - plasticState(ph)%state = plasticState(ph)%state0 - if(damageState(ph)%sizeState > 0) & - damageState(ph)%state = damageState(ph)%state0 - enddo PhaseLoop2 - - phase_damage_maxSizeDotState = maxval(damageState%sizeDotState) - phase_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState) - end subroutine phase_init @@ -545,8 +528,7 @@ subroutine crystallite_init() phases => config_material%get('phase') do ph = 1, phases%length - if (damageState(ph)%sizeState > 0) & - allocate(damageState(ph)%subState0,source=damageState(ph)%state0) ! ToDo: hack + if (damageState(ph)%sizeState > 0) allocate(damageState(ph)%subState0,source=damageState(ph)%state0) ! ToDo: hack enddo print'(a42,1x,i10)', ' # of elements: ', eMax @@ -560,7 +542,7 @@ subroutine crystallite_init() do ip = 1, size(material_phaseMemberAt,2) do co = 1,homogenization_Nconstituents(material_homogenizationAt(el)) call crystallite_orientations(co,ip,el) - call plastic_dependentState(co,ip,el) ! update dependent state variables to be consistent with basic states + call plastic_dependentState(co,ip,el) ! update dependent state variables to be consistent with basic states enddo enddo enddo @@ -576,9 +558,9 @@ end subroutine crystallite_init subroutine crystallite_orientations(co,ip,el) integer, intent(in) :: & - co, & !< counter in integration point component loop - ip, & !< counter in integration point loop - el !< counter in element loop + co, & !< counter in integration point component loop + ip, & !< counter in integration point loop + el !< counter in element loop call crystallite_orientation(co,ip,el)%fromMatrix(transpose(math_rotationalPart(& diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index 519f5e911..45898f54d 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -15,6 +15,8 @@ submodule(phase) damage DAMAGE_ANISOBRITTLE_ID end enum + integer :: phase_damage_maxSizeDotState + type :: tDataContainer real(pReal), dimension(:), allocatable :: phi, d_phi_d_dot_phi @@ -134,6 +136,8 @@ module subroutine damage_init where(anisobrittle_init()) phase_damage = DAMAGE_ANISOBRITTLE_ID endif + phase_damage_maxSizeDotState = maxval(damageState%sizeDotState) + end subroutine damage_init @@ -143,7 +147,7 @@ end subroutine damage_init module function phase_damage_C(C_homogenized,ph,en) result(C) real(pReal), dimension(3,3,3,3), intent(in) :: C_homogenized - integer, intent(in) :: ph,en + integer, intent(in) :: ph,en real(pReal), dimension(3,3,3,3) :: C damageType: select case (phase_damage(ph)) diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 29e9e8ada..be0bca892 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -41,6 +41,7 @@ submodule(phase) mechanical integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable :: & phase_plasticity !< plasticity of each phase + integer :: phase_plasticity_maxSizeDotState interface @@ -68,7 +69,7 @@ submodule(phase) mechanical dS_dFe, & !< derivative of 2nd P-K stress with respect to elastic deformation gradient dS_dFi !< derivative of 2nd P-K stress with respect to intermediate deformation gradient end subroutine phase_hooke_SandItsTangents - + module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,ph,en) real(pReal), dimension(3,3), intent(out) :: & Li !< inleastic velocity gradient @@ -294,6 +295,11 @@ module subroutine mechanical_init(materials,phases) call plastic_init() + do ph = 1,phases%length + plasticState(ph)%state0 = plasticState(ph)%state + enddo + phase_plasticity_maxSizeDotState = maxval(plasticState%sizeDotState) + num_crystallite => config_numerics%get('crystallite',defaultVal=emptyDict) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index bb53684e1..7c74b6edc 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -254,8 +254,6 @@ module function plastic_dislotungsten_init() result(myPlasticity) allocate(dst%Lambda_sl(prm%sum_N_sl,Nmembers), source=0.0_pReal) allocate(dst%threshold_stress(prm%sum_N_sl,Nmembers), source=0.0_pReal) - plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally - end associate !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index 151250f14..fdfd630c6 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -467,8 +467,6 @@ module function plastic_dislotwin_init() result(myPlasticity) allocate(dst%tau_r_tr (prm%sum_N_tr,Nmembers),source=0.0_pReal) allocate(dst%V_tr (prm%sum_N_tr,Nmembers),source=0.0_pReal) - plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally - end associate !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index 5ab73895f..0e7920f1d 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -140,8 +140,6 @@ module function plastic_isotropic_init() result(myPlasticity) ! global alias plasticState(ph)%slipRate => plasticState(ph)%dotState(2:2,:) - plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally - end associate !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 18f467617..2e9d713f2 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -213,8 +213,6 @@ module function plastic_kinehardening_init() result(myPlasticity) stt%gamma0 => plasticState(ph)%state (startIndex :endIndex ,:) dlt%gamma0 => plasticState(ph)%deltaState(startIndex-o:endIndex-o,:) - plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally - end associate !-------------------------------------------------------------------------------------------------- diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index b2db9e346..13335df4c 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -265,8 +265,6 @@ module function plastic_phenopowerlaw_init() result(myPlasticity) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_gamma',defaultVal=1.0e-6_pReal) if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_gamma' - plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally - end associate !--------------------------------------------------------------------------------------------------