This commit is contained in:
Martin Diehl 2018-12-21 23:07:31 +01:00
parent 9094bb9a64
commit b3d14b00b6
1 changed files with 60 additions and 82 deletions

View File

@ -47,8 +47,6 @@ module plastic_kinehardening
n_slip, & !< stress exponent for slip (input parameter) n_slip, & !< stress exponent for slip (input parameter)
aTolResistance, & aTolResistance, &
aTolShear aTolShear
real(pReal), dimension(:), allocatable, private :: & real(pReal), dimension(:), allocatable, private :: &
crss0, & !< initial critical shear stress for slip (input parameter, per family) crss0, & !< initial critical shear stress for slip (input parameter, per family)
theta0, & !< initial hardening rate of forward stress for each slip theta0, & !< initial hardening rate of forward stress for each slip
@ -58,16 +56,13 @@ module plastic_kinehardening
tau1, & tau1, &
tau1_b, & tau1_b, &
nonSchmidCoeff nonSchmidCoeff
real(pReal), dimension(:,:), allocatable, private :: & real(pReal), dimension(:,:), allocatable, private :: &
interaction_slipslip !< latent hardening matrix interaction_slipslip !< latent hardening matrix
real(pReal), allocatable, dimension(:,:,:) :: & real(pReal), allocatable, dimension(:,:,:) :: &
Schmid_slip, & Schmid_slip, &
Schmid_twin, & Schmid_twin, &
nonSchmid_pos, & nonSchmid_pos, &
nonSchmid_neg nonSchmid_neg
real(pReal), dimension(:,:), allocatable, private :: &
hardeningMatrix_SlipSlip
integer(pInt) :: & integer(pInt) :: &
totalNslip !< total number of active slip system totalNslip !< total number of active slip system
integer(pInt), allocatable, dimension(:) :: & integer(pInt), allocatable, dimension(:) :: &
@ -151,7 +146,7 @@ subroutine plastic_kinehardening_init
o, i, p, & o, i, p, &
phase, & phase, &
instance, & instance, &
maxNinstance, & Ninstance, &
NipcMyPhase, & NipcMyPhase, &
outputSize, & outputSize, &
offset_slip, & offset_slip, &
@ -179,25 +174,25 @@ subroutine plastic_kinehardening_init
write(6,'(a15,a)') ' Current time: ',IO_timeStamp() write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
#include "compilation_info.f90" #include "compilation_info.f90"
maxNinstance = int(count(phase_plasticity == PLASTICITY_KINEHARDENING_ID),pInt) Ninstance = int(count(phase_plasticity == PLASTICITY_KINEHARDENING_ID),pInt)
if (maxNinstance == 0_pInt) return if (Ninstance == 0_pInt) return
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) & if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
write(6,'(a,1x,i5,/)') '# instances:',maxNinstance write(6,'(a,1x,i5,/)') '# instances:',Ninstance
allocate(plastic_kinehardening_sizePostResult(maxval(phase_Noutput),maxNinstance), & allocate(plastic_kinehardening_sizePostResult(maxval(phase_Noutput),Ninstance), &
source=0_pInt) source=0_pInt)
allocate(plastic_kinehardening_output(maxval(phase_Noutput),maxNinstance)) allocate(plastic_kinehardening_output(maxval(phase_Noutput),Ninstance))
plastic_kinehardening_output = '' plastic_kinehardening_output = ''
allocate(plastic_kinehardening_Noutput(maxNinstance), source=0_pInt) allocate(plastic_kinehardening_Noutput(Ninstance), source=0_pInt)
allocate(plastic_kinehardening_Nslip(lattice_maxNslipFamily,maxNinstance), source=0_pInt) allocate(plastic_kinehardening_Nslip(lattice_maxNslipFamily,Ninstance), source=0_pInt)
allocate(param(maxNinstance)) ! one container of parameters per instance allocate(param(Ninstance)) ! one container of parameters per instance
allocate(paramNew(maxNinstance)) allocate(paramNew(Ninstance))
allocate(state(maxNinstance)) allocate(state(Ninstance))
allocate(state0(maxNinstance)) allocate(state0(Ninstance))
allocate(dotState(maxNinstance)) allocate(dotState(Ninstance))
allocate(deltaState(maxNinstance)) allocate(deltaState(Ninstance))
do p = 1_pInt, size(phase_plasticityInstance) do p = 1_pInt, size(phase_plasticityInstance)
if (phase_plasticity(p) /= PLASTICITY_KINEHARDENING_ID) cycle if (phase_plasticity(p) /= PLASTICITY_KINEHARDENING_ID) cycle
@ -303,73 +298,59 @@ subroutine plastic_kinehardening_init
endif endif
end do end do
param(instance)%outputID = prm%outputID param(instance)%outputID = prm%outputID
nslip = prm%totalNslip nslip = prm%totalNslip
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
sizeDotState = nSlip & !< crss NipcMyPhase = count(material_phase == p) ! number of constituents with my phase
+ nSlip & !< crss_back sizeDotState = size(['crss ','crss_back', 'accshear ']) * prm%TotalNslip
+ nSlip !< accumulated (absolute) shear sizeDeltaState = size(['sense ', 'chi0 ', 'gamma0']) * prm%TotalNslip
sizeState = sizeDotState + sizeDeltaState
sizeDeltaState = nSlip & !< sense of acting shear stress (-1 or +1)
+ nSlip & !< backstress at last switch of stress sense
+ nSlip !< accumulated shear at last switch of stress sense
sizeState = sizeDotState + sizeDeltaState call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,sizeDeltaState, &
NipcMyPhase = count(material_phase == p) ! number of IPCs containing my phase nSlip,0_pInt,0_pInt)
call material_allocatePlasticState(p,NipcMyPhase,sizeState,sizeDotState,sizeDeltaState, &
nSlip,0_pInt,0_pInt) plasticState(p)%sizePostResults = sum(plastic_kinehardening_sizePostResult(:,phase_plasticityInstance(p)))
plasticState(p)%sizePostResults = sum(plastic_kinehardening_sizePostResult(:,phase_plasticityInstance(p))) plasticState(p)%offsetDeltaState = sizeDotState
plasticState(p)%offsetDeltaState = sizeDotState
endindex = 0_pInt startIndex = 1_pInt
o = endIndex ! offset of dotstate index relative to state index endIndex = nSlip
stt%crss => plasticState(p)%state (startIndex:endIndex,1:NipcMyPhase)
dot%crss => plasticState(p)%dotState (startIndex:endIndex,1:NipcMyPhase)
plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolResistance
startIndex = endIndex + 1_pInt
endIndex = endIndex + nSlip
stt%crss => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase)
dot%crss => plasticState(p)%dotState (startIndex-o:endIndex-o,1:NipcMyPhase)
plasticState(p)%aTolState(startIndex-o:endIndex-o) = prm%aTolResistance
! .............................................
startIndex = endIndex + 1_pInt startIndex = endIndex + 1_pInt
endIndex = endIndex + nSlip endIndex = endIndex + nSlip
stt%crss_back => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase) stt%crss_back => plasticState(p)%state (startIndex:endIndex,1:NipcMyPhase)
dot%crss_back => plasticState(p)%dotState (startIndex-o:endIndex-o,1:NipcMyPhase) dot%crss_back => plasticState(p)%dotState (startIndex:endIndex,1:NipcMyPhase)
plasticState(p)%aTolState(startIndex-o:endIndex-o) = prm%aTolResistance plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolResistance
! .............................................
startIndex = endIndex + 1_pInt startIndex = endIndex + 1_pInt
endIndex = endIndex + nSlip endIndex = endIndex + nSlip
stt%accshear => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase) stt%accshear => plasticState(p)%state (startIndex:endIndex,1:NipcMyPhase)
dot%accshear => plasticState(p)%dotState (startIndex-o:endIndex-o,1:NipcMyPhase) dot%accshear => plasticState(p)%dotState (startIndex:endIndex,1:NipcMyPhase)
plasticState(p)%aTolState(startIndex-o:endIndex-o) = prm%aTolShear plasticState(p)%aTolState(startIndex:endIndex) = prm%aTolShear
!---------------------------------------------------------------------------------------------- !----------------------------------------------------------------------------------------------
!locally define deltaState alias !locally define deltaState alias
o = endIndex o = endIndex
! .............................................
startIndex = endIndex + 1_pInt startIndex = endIndex + 1_pInt
endIndex = endIndex + nSlip endIndex = endIndex + nSlip
stt%sense => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase) stt%sense => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase)
delta%sense => plasticState(p)%deltaState(startIndex-o:endIndex-o,1:NipcMyPhase) delta%sense => plasticState(p)%deltaState(startIndex-o:endIndex-o,1:NipcMyPhase)
! .............................................
startIndex = endIndex + 1_pInt startIndex = endIndex + 1_pInt
endIndex = endIndex + nSlip endIndex = endIndex + nSlip
stt%chi0 => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase) stt%chi0 => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase)
delta%chi0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,1:NipcMyPhase) delta%chi0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,1:NipcMyPhase)
! .............................................
startIndex = endIndex + 1_pInt startIndex = endIndex + 1_pInt
endIndex = endIndex + nSlip endIndex = endIndex + nSlip
stt%gamma0 => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase) stt%gamma0 => plasticState(p)%state (startIndex :endIndex ,1:NipcMyPhase)
delta%gamma0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,1:NipcMyPhase) delta%gamma0 => plasticState(p)%deltaState(startIndex-o:endIndex-o,1:NipcMyPhase)
end associate end associate
end do end do
@ -558,21 +539,17 @@ subroutine plastic_kinehardening_dotState(Mp,instance,of)
sumGamma = sum(stt%accshear(:,of)) sumGamma = sum(stt%accshear(:,of))
do j = 1_pInt, prm%totalNslip do j = 1_pInt, prm%totalNslip
dot%crss(j,of) = & dot%crss(j,of) = dot_product(prm%interaction_SlipSlip(j,:),dot%accshear(:,of)) &
dot_product(prm%interaction_SlipSlip(j,:),dot%accshear(:,of)) * & * ( prm%theta1(j) + prm%theta0(j) - prm%theta1(j) &
( prm%theta1(j) + (prm%theta0(j) - prm%theta1(j) & + prm%theta0(j)*prm%theta1(j)*sumGamma/prm%tau1(j)*exp(-sumGamma*prm%theta0(j)/prm%tau1(j)) &
+ prm%theta0(j)*prm%theta1(j)*sumGamma/prm%tau1(j)) & )
*exp(-sumGamma*prm%theta0(j)/prm%tau1(j)) & ! V term depending on the harding law
)
enddo enddo
dot%crss_back(:,of) = & dot%crss_back(:,of) = stt%sense(:,of)*dot%accshear(:,of) * &
stt%sense(:,of)*dot%accshear(:,of) * &
( prm%theta1_b + & ( prm%theta1_b + &
(prm%theta0_b - prm%theta1_b & (prm%theta0_b - prm%theta1_b &
+ prm%theta0_b*prm%theta1_b/(prm%tau1_b+stt%chi0(:,of))*(stt%accshear(:,of)-stt%gamma0(:,of))& + prm%theta0_b*prm%theta1_b/(prm%tau1_b+stt%chi0(:,of))*(stt%accshear(:,of)-stt%gamma0(:,of))&
) & ) *exp(-(stt%accshear(:,of)-stt%gamma0(:,of)) *prm%theta0_b/(prm%tau1_b+stt%chi0(:,of))) &
*exp(-(stt%accshear(:,of)-stt%gamma0(:,of)) *prm%theta0_b/(prm%tau1_b+stt%chi0(:,of))) & )
) ! V term depending on the harding law for back stress
end associate end associate
@ -656,34 +633,34 @@ end function plastic_kinehardening_postResults
!> @details: Shear rates are calculated only optionally. NOTE: Against the common convention, the !> @details: Shear rates are calculated only optionally. NOTE: Against the common convention, the
!> result (i.e. intent(out)) variables are the last to have the optional arguments at the end !> result (i.e. intent(out)) variables are the last to have the optional arguments at the end
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
pure subroutine kinetics(prm,stt,of,Mp,gdot_pos,gdot_neg,dgdot_dtau_pos,dgdot_dtau_neg) pure subroutine kinetics(Mp,instance,of,gdot_pos,gdot_neg,dgdot_dtau_pos,dgdot_dtau_neg)
use prec, only: & use prec, only: &
dNeq0 dNeq0
use math, only: & use math, only: &
math_mul33xx33 math_mul33xx33
implicit none implicit none
type(tParameters), intent(in) :: &
prm
type(tKinehardeningState), intent(in) :: &
stt
integer(pInt), intent(in) :: &
of
real(pReal), dimension(prm%totalNslip), intent(out) :: &
gdot_pos, &
gdot_neg
real(pReal), dimension(prm%totalNslip), optional, intent(out) :: &
dgdot_dtau_pos, &
dgdot_dtau_neg
real(pReal), dimension(3,3), intent(in) :: & real(pReal), dimension(3,3), intent(in) :: &
Mp Mp
integer(pInt), intent(in) :: &
instance, &
of
real(pReal), dimension(paramNew(instance)%totalNslip), intent(out) :: &
gdot_pos, &
gdot_neg
real(pReal), dimension(paramNew(instance)%totalNslip), optional, intent(out) :: &
dgdot_dtau_pos, &
dgdot_dtau_neg
real(pReal), dimension(prm%totalNslip) :: &
real(pReal), dimension(paramNew(instance)%totalNslip) :: &
tau_pos, & tau_pos, &
tau_neg tau_neg
integer(pInt) :: i integer(pInt) :: i
logical :: nonSchmidActive logical :: nonSchmidActive
associate( prm => paramNew(instance), stt => state(instance))
nonSchmidActive = size(prm%nonSchmidCoeff) > 0_pInt nonSchmidActive = size(prm%nonSchmidCoeff) > 0_pInt
do i = 1_pInt, prm%totalNslip do i = 1_pInt, prm%totalNslip
@ -723,6 +700,7 @@ pure subroutine kinetics(prm,stt,of,Mp,gdot_pos,gdot_neg,dgdot_dtau_pos,dgdot_dt
dgdot_dtau_neg = 0.0_pReal dgdot_dtau_neg = 0.0_pReal
end where end where
endif endif
end associate
end subroutine kinetics end subroutine kinetics