simplified state initialization

- not needed for damage (is an intial value problem, will trickle down)
- plastic initializes state, copy to state0 (centrally)
This commit is contained in:
Martin Diehl 2021-05-21 22:07:55 +02:00
parent 2aa78a710b
commit 801e9f512b
8 changed files with 18 additions and 36 deletions

View File

@ -67,10 +67,6 @@ module phase
damageState damageState
integer, public, protected :: &
phase_plasticity_maxSizeDotState, &
phase_damage_maxSizeDotState
interface interface
! == cleaned:begin ================================================================================= ! == cleaned:begin =================================================================================
@ -242,7 +238,7 @@ module phase
end function phase_homogenizedC end function phase_homogenizedC
module function phase_damage_C(C_homogenized,ph,en) result(C) module function phase_damage_C(C_homogenized,ph,en) result(C)
real(pReal), dimension(3,3,3,3), intent(in) :: C_homogenized 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 real(pReal), dimension(3,3,3,3) :: C
end function phase_damage_C end function phase_damage_C
@ -377,19 +373,6 @@ subroutine phase_init
call damage_init call damage_init
call thermal_init(phases) 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 end subroutine phase_init
@ -545,8 +528,7 @@ subroutine crystallite_init()
phases => config_material%get('phase') phases => config_material%get('phase')
do ph = 1, phases%length do ph = 1, phases%length
if (damageState(ph)%sizeState > 0) & if (damageState(ph)%sizeState > 0) allocate(damageState(ph)%subState0,source=damageState(ph)%state0) ! ToDo: hack
allocate(damageState(ph)%subState0,source=damageState(ph)%state0) ! ToDo: hack
enddo enddo
print'(a42,1x,i10)', ' # of elements: ', eMax print'(a42,1x,i10)', ' # of elements: ', eMax
@ -560,7 +542,7 @@ subroutine crystallite_init()
do ip = 1, size(material_phaseMemberAt,2) do ip = 1, size(material_phaseMemberAt,2)
do co = 1,homogenization_Nconstituents(material_homogenizationAt(el)) do co = 1,homogenization_Nconstituents(material_homogenizationAt(el))
call crystallite_orientations(co,ip,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 enddo
enddo enddo
@ -576,9 +558,9 @@ end subroutine crystallite_init
subroutine crystallite_orientations(co,ip,el) subroutine crystallite_orientations(co,ip,el)
integer, intent(in) :: & integer, intent(in) :: &
co, & !< counter in integration point component loop co, & !< counter in integration point component loop
ip, & !< counter in integration point loop ip, & !< counter in integration point loop
el !< counter in element loop el !< counter in element loop
call crystallite_orientation(co,ip,el)%fromMatrix(transpose(math_rotationalPart(& call crystallite_orientation(co,ip,el)%fromMatrix(transpose(math_rotationalPart(&

View File

@ -15,6 +15,8 @@ submodule(phase) damage
DAMAGE_ANISOBRITTLE_ID DAMAGE_ANISOBRITTLE_ID
end enum end enum
integer :: phase_damage_maxSizeDotState
type :: tDataContainer type :: tDataContainer
real(pReal), dimension(:), allocatable :: phi, d_phi_d_dot_phi 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 where(anisobrittle_init()) phase_damage = DAMAGE_ANISOBRITTLE_ID
endif endif
phase_damage_maxSizeDotState = maxval(damageState%sizeDotState)
end subroutine damage_init end subroutine damage_init
@ -143,7 +147,7 @@ end subroutine damage_init
module function phase_damage_C(C_homogenized,ph,en) result(C) module function phase_damage_C(C_homogenized,ph,en) result(C)
real(pReal), dimension(3,3,3,3), intent(in) :: C_homogenized 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 real(pReal), dimension(3,3,3,3) :: C
damageType: select case (phase_damage(ph)) damageType: select case (phase_damage(ph))

View File

@ -41,6 +41,7 @@ submodule(phase) mechanical
integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable :: & integer(kind(PLASTICITY_undefined_ID)), dimension(:), allocatable :: &
phase_plasticity !< plasticity of each phase phase_plasticity !< plasticity of each phase
integer :: phase_plasticity_maxSizeDotState
interface interface
@ -68,7 +69,7 @@ submodule(phase) mechanical
dS_dFe, & !< derivative of 2nd P-K stress with respect to elastic deformation gradient 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 dS_dFi !< derivative of 2nd P-K stress with respect to intermediate deformation gradient
end subroutine phase_hooke_SandItsTangents end subroutine phase_hooke_SandItsTangents
module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,ph,en) module subroutine plastic_isotropic_LiAndItsTangent(Li,dLi_dMi,Mi,ph,en)
real(pReal), dimension(3,3), intent(out) :: & real(pReal), dimension(3,3), intent(out) :: &
Li !< inleastic velocity gradient Li !< inleastic velocity gradient
@ -294,6 +295,11 @@ module subroutine mechanical_init(materials,phases)
call plastic_init() 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) num_crystallite => config_numerics%get('crystallite',defaultVal=emptyDict)

View File

@ -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%Lambda_sl(prm%sum_N_sl,Nmembers), source=0.0_pReal)
allocate(dst%threshold_stress(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 end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -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%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) 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 end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -140,8 +140,6 @@ module function plastic_isotropic_init() result(myPlasticity)
! global alias ! global alias
plasticState(ph)%slipRate => plasticState(ph)%dotState(2:2,:) plasticState(ph)%slipRate => plasticState(ph)%dotState(2:2,:)
plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally
end associate end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -213,8 +213,6 @@ module function plastic_kinehardening_init() result(myPlasticity)
stt%gamma0 => plasticState(ph)%state (startIndex :endIndex ,:) stt%gamma0 => plasticState(ph)%state (startIndex :endIndex ,:)
dlt%gamma0 => plasticState(ph)%deltaState(startIndex-o:endIndex-o,:) dlt%gamma0 => plasticState(ph)%deltaState(startIndex-o:endIndex-o,:)
plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally
end associate end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -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) 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' 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 end associate
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------