simplifications

This commit is contained in:
Martin Diehl 2019-01-07 07:07:55 +01:00
parent 15d1789a19
commit aa5d3bf9a3
1 changed files with 43 additions and 60 deletions

View File

@ -178,7 +178,7 @@ subroutine plastic_kinehardening_init
if (phase_plasticity(p) /= PLASTICITY_KINEHARDENING_ID) cycle if (phase_plasticity(p) /= PLASTICITY_KINEHARDENING_ID) cycle
associate(prm => param(phase_plasticityInstance(p)), & associate(prm => param(phase_plasticityInstance(p)), &
dot => dotState(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), &
delta => deltaState(phase_plasticityInstance(p)), & dlt => deltaState(phase_plasticityInstance(p)), &
stt => state(phase_plasticityInstance(p)),& stt => state(phase_plasticityInstance(p)),&
config => config_phase(p)) config => config_phase(p))
@ -227,6 +227,9 @@ subroutine plastic_kinehardening_init
prm%theta0_b = config%getFloats('theta0_b', requiredShape=shape(prm%Nslip)) prm%theta0_b = config%getFloats('theta0_b', requiredShape=shape(prm%Nslip))
prm%theta1_b = config%getFloats('theta1_b', requiredShape=shape(prm%Nslip)) prm%theta1_b = config%getFloats('theta1_b', requiredShape=shape(prm%Nslip))
prm%gdot0 = config%getFloat('gdot0')
prm%n_slip = config%getFloat('n_slip')
! expand: family => system ! expand: family => system
prm%crss0 = math_expand(prm%crss0, prm%Nslip) prm%crss0 = math_expand(prm%crss0, prm%Nslip)
prm%tau1 = math_expand(prm%tau1, prm%Nslip) prm%tau1 = math_expand(prm%tau1, prm%Nslip)
@ -236,8 +239,7 @@ subroutine plastic_kinehardening_init
prm%theta0_b = math_expand(prm%theta0_b,prm%Nslip) prm%theta0_b = math_expand(prm%theta0_b,prm%Nslip)
prm%theta1_b = math_expand(prm%theta1_b,prm%Nslip) prm%theta1_b = math_expand(prm%theta1_b,prm%Nslip)
prm%gdot0 = config%getFloat('gdot0')
prm%n_slip = config%getFloat('n_slip')
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! sanity checks ! sanity checks
@ -260,31 +262,25 @@ subroutine plastic_kinehardening_init
allocate(prm%outputID(0)) allocate(prm%outputID(0))
do i=1_pInt, size(outputs) do i=1_pInt, size(outputs)
outputID = undefined_ID outputID = undefined_ID
outputSize = prm%totalNslip
select case(outputs(i)) select case(outputs(i))
case ('resistance') case ('resistance')
outputID = merge(crss_ID,undefined_ID,prm%totalNslip>0_pInt) outputID = merge(crss_ID,undefined_ID,prm%totalNslip>0_pInt)
outputSize = prm%totalNslip
case ('accumulatedshear') case ('accumulatedshear')
outputID = merge(accshear_ID,undefined_ID,prm%totalNslip>0_pInt) outputID = merge(accshear_ID,undefined_ID,prm%totalNslip>0_pInt)
outputSize = prm%totalNslip
case ('shearrate') case ('shearrate')
outputID = merge(shearrate_ID,undefined_ID,prm%totalNslip>0_pInt) outputID = merge(shearrate_ID,undefined_ID,prm%totalNslip>0_pInt)
outputSize = prm%totalNslip
case ('resolvedstress') case ('resolvedstress')
outputID = merge(resolvedstress_ID,undefined_ID,prm%totalNslip>0_pInt) outputID = merge(resolvedstress_ID,undefined_ID,prm%totalNslip>0_pInt)
outputSize = prm%totalNslip
case ('backstress') case ('backstress')
outputID = merge(crss_back_ID,undefined_ID,prm%totalNslip>0_pInt) outputID = merge(crss_back_ID,undefined_ID,prm%totalNslip>0_pInt)
outputSize = prm%totalNslip
case ('sense') case ('sense')
outputID = merge(sense_ID,undefined_ID,prm%totalNslip>0_pInt) outputID = merge(sense_ID,undefined_ID,prm%totalNslip>0_pInt)
outputSize = prm%totalNslip
case ('chi0') case ('chi0')
outputID = merge(chi0_ID,undefined_ID,prm%totalNslip>0_pInt) outputID = merge(chi0_ID,undefined_ID,prm%totalNslip>0_pInt)
outputSize = prm%totalNslip
case ('gamma0') case ('gamma0')
outputID = merge(gamma0_ID,undefined_ID,prm%totalNslip>0_pInt) outputID = merge(gamma0_ID,undefined_ID,prm%totalNslip>0_pInt)
outputSize = prm%totalNslip
end select end select
@ -336,17 +332,17 @@ subroutine plastic_kinehardening_init
startIndex = endIndex + 1_pInt startIndex = endIndex + 1_pInt
endIndex = endIndex + prm%totalNslip endIndex = endIndex + prm%totalNslip
stt%sense => plasticState(p)%state (startIndex :endIndex ,:) stt%sense => plasticState(p)%state (startIndex :endIndex ,:)
delta%sense => plasticState(p)%deltaState(startIndex-o:endIndex-o,:) dlt%sense => plasticState(p)%deltaState(startIndex-o:endIndex-o,:)
startIndex = endIndex + 1_pInt startIndex = endIndex + 1_pInt
endIndex = endIndex + prm%totalNslip endIndex = endIndex + prm%totalNslip
stt%chi0 => plasticState(p)%state (startIndex :endIndex ,:) stt%chi0 => plasticState(p)%state (startIndex :endIndex ,:)
delta%chi0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,:) dlt%chi0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,:)
startIndex = endIndex + 1_pInt startIndex = endIndex + 1_pInt
endIndex = endIndex + prm%totalNslip endIndex = endIndex + prm%totalNslip
stt%gamma0 => plasticState(p)%state (startIndex :endIndex ,:) stt%gamma0 => plasticState(p)%state (startIndex :endIndex ,:)
delta%gamma0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,:) dlt%gamma0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,:)
plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally plasticState(p)%state0 = plasticState(p)%state ! ToDo: this could be done centrally
@ -425,7 +421,7 @@ subroutine plastic_kinehardening_deltaState(Mp,instance,of)
gdot_pos,gdot_neg, & gdot_pos,gdot_neg, &
sense sense
associate(prm => param(instance), stt => state(instance), del => deltaState(instance)) associate(prm => param(instance), stt => state(instance), dlt => deltaState(instance))
call kinetics(Mp,instance,of,gdot_pos,gdot_neg) call kinetics(Mp,instance,of,gdot_pos,gdot_neg)
sense = merge(state(instance)%sense(:,of), & ! keep existing... sense = merge(state(instance)%sense(:,of), & ! keep existing...
@ -444,13 +440,13 @@ subroutine plastic_kinehardening_deltaState(Mp,instance,of)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! switch in sense of shear? ! switch in sense of shear?
where(dNeq(sense,stt%sense(:,of),0.1_pReal)) where(dNeq(sense,stt%sense(:,of),0.1_pReal))
del%sense (:,of) = sense - stt%sense(:,of) ! switch sense dlt%sense (:,of) = sense - stt%sense(:,of) ! switch sense
del%chi0 (:,of) = abs(stt%crss_back(:,of)) - stt%chi0(:,of) ! remember current backstress magnitude dlt%chi0 (:,of) = abs(stt%crss_back(:,of)) - stt%chi0(:,of) ! remember current backstress magnitude
del%gamma0(:,of) = stt%accshear(:,of) - stt%gamma0(:,of) ! remember current accumulated shear dlt%gamma0(:,of) = stt%accshear(:,of) - stt%gamma0(:,of) ! remember current accumulated shear
else where else where
del%sense (:,of) = 0.0_pReal dlt%sense (:,of) = 0.0_pReal
del%chi0 (:,of) = 0.0_pReal dlt%chi0 (:,of) = 0.0_pReal
del%gamma0(:,of) = 0.0_pReal dlt%gamma0(:,of) = 0.0_pReal
end where end where
end associate end associate
@ -470,7 +466,6 @@ subroutine plastic_kinehardening_dotState(Mp,instance,of)
instance, & instance, &
of of
integer(pInt) :: & integer(pInt) :: &
i i
real(pReal), dimension(param(instance)%totalNslip) :: & real(pReal), dimension(param(instance)%totalNslip) :: &
@ -478,7 +473,6 @@ subroutine plastic_kinehardening_dotState(Mp,instance,of)
real(pReal) :: & real(pReal) :: &
sumGamma sumGamma
associate(prm => param(instance), stt => state(instance), dot => dotState(instance)) associate(prm => param(instance), stt => state(instance), dot => dotState(instance))
call kinetics(Mp,instance,of,gdot_pos,gdot_neg) call kinetics(Mp,instance,of,gdot_pos,gdot_neg)
@ -534,41 +528,30 @@ function plastic_kinehardening_postResults(Mp,instance,of) result(postResults)
outputsLoop: do o = 1_pInt,size(prm%outputID) outputsLoop: do o = 1_pInt,size(prm%outputID)
select case(prm%outputID(o)) select case(prm%outputID(o))
case (crss_ID) case (crss_ID)
postResults(c+1_pInt:c+prm%totalNslip) = stt%crss(:,of) postResults(c+1_pInt:c+prm%totalNslip) = stt%crss(:,of)
c = c + prm%totalNslip
case(crss_back_ID) case(crss_back_ID)
postResults(c+1_pInt:c+prm%totalNslip) = stt%crss_back(:,of) postResults(c+1_pInt:c+prm%totalNslip) = stt%crss_back(:,of)
c = c + prm%totalNslip
case (sense_ID) case (sense_ID)
postResults(c+1_pInt:c+prm%totalNslip) = stt%sense(:,of) postResults(c+1_pInt:c+prm%totalNslip) = stt%sense(:,of)
c = c + prm%totalNslip
case (chi0_ID) case (chi0_ID)
postResults(c+1_pInt:c+prm%totalNslip) = stt%chi0(:,of) postResults(c+1_pInt:c+prm%totalNslip) = stt%chi0(:,of)
c = c + prm%totalNslip
case (gamma0_ID) case (gamma0_ID)
postResults(c+1_pInt:c+prm%totalNslip) = stt%gamma0(:,of) postResults(c+1_pInt:c+prm%totalNslip) = stt%gamma0(:,of)
c = c + prm%totalNslip
case (accshear_ID) case (accshear_ID)
postResults(c+1_pInt:c+prm%totalNslip) = stt%accshear(:,of) postResults(c+1_pInt:c+prm%totalNslip) = stt%accshear(:,of)
c = c + prm%totalNslip
case (shearrate_ID) case (shearrate_ID)
postResults(c+1_pInt:c+prm%totalNslip) = gdot_pos+gdot_neg postResults(c+1_pInt:c+prm%totalNslip) = gdot_pos+gdot_neg
c = c + prm%totalNslip
case (resolvedstress_ID) case (resolvedstress_ID)
do i = 1_pInt, prm%totalNslip do i = 1_pInt, prm%totalNslip
postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_slip(1:3,1:3,i)) postResults(c+i) = math_mul33xx33(Mp,prm%Schmid_slip(1:3,1:3,i))
enddo enddo
c = c + prm%totalNslip
end select end select
c = c + prm%totalNslip
enddo outputsLoop enddo outputsLoop
end associate end associate