diff --git a/code/constitutive.f90 b/code/constitutive.f90 index baa78d800..8f8d1dc70 100644 --- a/code/constitutive.f90 +++ b/code/constitutive.f90 @@ -53,9 +53,7 @@ module constitutive constitutive_postResults private :: & - constitutive_hooke_TandItsTangent, & - constitutive_getAccumulatedSlip, & - constitutive_getSlipRate + constitutive_hooke_TandItsTangent contains @@ -606,10 +604,6 @@ subroutine constitutive_microstructure(Tstar_v, Fe, Fp, subdt, ipc, ip, el) Fp !< plastic deformation gradient real(pReal), intent(in) :: & subdt !< timestep - real(pReal), dimension(:), allocatable :: & - accumulatedSlip - integer(pInt) :: & - nSlip select case (phase_plasticity(material_phase(ipc,ip,el))) @@ -629,13 +623,11 @@ subroutine constitutive_microstructure(Tstar_v, Fe, Fp, subdt, ipc, ip, el) call damage_isoBrittle_microstructure(constitutive_homogenizedC(ipc,ip,el), Fe, subdt, & ipc, ip, el) case (LOCAL_DAMAGE_isoDuctile_ID) - call constitutive_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - call damage_isoDuctile_microstructure(nSlip, accumulatedSlip, subdt, ipc, ip, el) + call damage_isoDuctile_microstructure(subdt, ipc, ip, el) case (LOCAL_DAMAGE_anisoBrittle_ID) call damage_anisoBrittle_microstructure(Tstar_v, subdt, ipc, ip, el) case (LOCAL_DAMAGE_anisoDuctile_ID) - call constitutive_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - call damage_anisoDuctile_microstructure(nSlip, accumulatedSlip, subdt, ipc, ip, el) + call damage_anisoDuctile_microstructure(subdt, ipc, ip, el) case (LOCAL_DAMAGE_gurson_ID) call damage_gurson_microstructure(ipc, ip, el) case (LOCAL_DAMAGE_phaseField_ID) @@ -647,9 +639,8 @@ subroutine constitutive_microstructure(Tstar_v, Fe, Fp, subdt, ipc, ip, el) select case (phase_vacancy(material_phase(ipc,ip,el))) case (LOCAL_VACANCY_generation_ID) - call constitutive_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) call vacancy_generation_microstructure(constitutive_homogenizedC(ipc,ip,el), Fe, & - nSlip,accumulatedSlip,constitutive_getTemperature(ipc,ip,el), & + constitutive_getTemperature(ipc,ip,el), & subdt,ipc,ip,el) end select @@ -1799,7 +1790,6 @@ function constitutive_getVacancyMobility33(ipc, ip, el) select case(phase_vacancy(material_phase(ipc,ip,el))) case (LOCAL_VACANCY_generation_ID) - call constitutive_getAccumulatedSlip(nSlip,accumulatedSlip,ipc,ip,el) constitutive_getVacancyMobility33 = & vacancy_generation_getVacancyMobility33(nSlip,accumulatedSlip,constitutive_getTemperature(ipc,ip,el), & ipc,ip,el) @@ -1837,137 +1827,6 @@ real(pReal) function constitutive_getVacancyPotentialDrivingForce(ipc, ip, el) end function constitutive_getVacancyPotentialDrivingForce -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip on each system defined -!-------------------------------------------------------------------------------------------------- -subroutine constitutive_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - use prec, only: & - pReal, & - pInt - use math, only: & - math_mul33xx33, & - math_equivStrain33, & - math_I3 - use material, only: & - phase_plasticity, & - material_phase, & - PLASTICITY_none_ID, & - PLASTICITY_j2_ID, & - PLASTICITY_phenopowerlaw_ID, & - PLASTICITY_dislotwin_ID, & - PLASTICITY_dislokmc_ID, & - PLASTICITY_titanmod_ID, & - PLASTICITY_nonlocal_ID - use plastic_j2, only: & - plastic_j2_getAccumulatedSlip - use plastic_phenopowerlaw, only: & - plastic_phenopowerlaw_getAccumulatedSlip - use plastic_dislotwin, only: & - plastic_dislotwin_getAccumulatedSlip - use plastic_dislokmc, only: & - plastic_dislokmc_getAccumulatedSlip - use plastic_titanmod, only: & - plastic_titanmod_getAccumulatedSlip - use plastic_nonlocal, only: & - plastic_nonlocal_getAccumulatedSlip - - implicit none - - real(pReal), dimension(:), intent(out), allocatable :: & - accumulatedSlip - integer(pInt), intent(out) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - - select case (phase_plasticity(material_phase(ipc,ip,el))) - case (PLASTICITY_none_ID) - nSlip = 0_pInt - allocate(accumulatedSlip(nSlip)) - case (PLASTICITY_J2_ID) - call plastic_j2_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - case (PLASTICITY_PHENOPOWERLAW_ID) - call plastic_phenopowerlaw_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - case (PLASTICITY_DISLOTWIN_ID) - call plastic_dislotwin_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - case (PLASTICITY_DISLOKMC_ID) - call plastic_dislokmc_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - case (PLASTICITY_TITANMOD_ID) - call plastic_titanmod_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - case (PLASTICITY_NONLOCAL_ID) - call plastic_nonlocal_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - end select - -end subroutine constitutive_getAccumulatedSlip - -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip rates on each system defined -!-------------------------------------------------------------------------------------------------- -subroutine constitutive_getSlipRate(nSlip,slipRate,Lp,ipc, ip, el) - use prec, only: & - pReal, & - pInt - use math, only: & - math_mul33xx33, & - math_equivStrain33, & - math_I3 - use material, only: & - phase_plasticity, & - material_phase, & - PLASTICITY_none_ID, & - PLASTICITY_j2_ID, & - PLASTICITY_phenopowerlaw_ID, & - PLASTICITY_dislotwin_ID, & - PLASTICITY_dislokmc_ID, & - PLASTICITY_titanmod_ID, & - PLASTICITY_nonlocal_ID - use plastic_phenopowerlaw, only: & - plastic_phenopowerlaw_getSlipRate - use plastic_dislotwin, only: & - plastic_dislotwin_getSlipRate - use plastic_dislokmc, only: & - plastic_dislokmc_getSlipRate - use plastic_titanmod, only: & - plastic_titanmod_getSlipRate - use plastic_nonlocal, only: & - plastic_nonlocal_getSlipRate - - implicit none - - real(pReal), dimension(:), intent(out), allocatable :: & - slipRate - integer(pInt), intent(out) :: & - nSlip - real(pReal), intent(in), dimension(3,3) :: & - Lp !< plastic velocity gradient - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - - select case (phase_plasticity(material_phase(ipc,ip,el))) - case (PLASTICITY_none_ID) - nSlip = 0_pInt - allocate(slipRate(nSlip)) - case (PLASTICITY_J2_ID) - nSlip = 1_pInt - allocate(slipRate(nSlip)) - slipRate(1) = math_equivStrain33(Lp) - case (PLASTICITY_PHENOPOWERLAW_ID) - call plastic_phenopowerlaw_getSlipRate(nSlip,slipRate,ipc, ip, el) - case (PLASTICITY_DISLOTWIN_ID) - call plastic_dislotwin_getSlipRate(nSlip,slipRate,ipc, ip, el) - case (PLASTICITY_DISLOKMC_ID) - call plastic_dislokmc_getSlipRate(nSlip,slipRate,ipc, ip, el) - case (PLASTICITY_TITANMOD_ID) - call plastic_titanmod_getSlipRate(nSlip,slipRate,ipc, ip, el) - case (PLASTICITY_NONLOCAL_ID) - call plastic_nonlocal_getSlipRate(nSlip,slipRate,ipc, ip, el) - end select - -end subroutine constitutive_getSlipRate !-------------------------------------------------------------------------------------------------- !> @brief returns array of constitutive results diff --git a/code/damage_anisoDuctile.f90 b/code/damage_anisoDuctile.f90 index 9af9837c9..b48645450 100644 --- a/code/damage_anisoDuctile.f90 +++ b/code/damage_anisoDuctile.f90 @@ -293,10 +293,11 @@ end subroutine damage_anisoDuctile_aTolState !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -subroutine damage_anisoDuctile_microstructure(nSlip, accumulatedSlip, subdt, ipc, ip, el) +subroutine damage_anisoDuctile_microstructure(subdt, ipc, ip, el) use material, only: & mappingConstitutive, & phase_damageInstance, & + plasticState, & damageState use lattice, only: & lattice_maxNslipFamily @@ -305,12 +306,9 @@ subroutine damage_anisoDuctile_microstructure(nSlip, accumulatedSlip, subdt, ipc implicit none integer(pInt), intent(in) :: & - nSlip, & ipc, & !< component-ID of integration point ip, & !< integration point el !< element - real(pReal), dimension(nSlip), intent(in) :: & - accumulatedSlip real(pReal), intent(in) :: & subdt integer(pInt) :: & @@ -332,13 +330,13 @@ subroutine damage_anisoDuctile_microstructure(nSlip, accumulatedSlip, subdt, ipc do f = 1_pInt,lattice_maxNslipFamily do i = 1_pInt,damage_anisoDuctile_Nslip(f,instance) ! process each (active) slip system in family if (localDamage == damageState(phase)%state(index+1,constituent)) then - drivingForce = accumulatedSlip(index)/damage_anisoDuctile_critPlasticStrain(f,instance) - & + drivingForce = plasticState(phase)%accumulatedSlip(index,constituent)/damage_anisoDuctile_critPlasticStrain(f,instance) - & damage_anisoDuctile_getDamage(ipc, ip, el) damageState(phase)%state(index+1,constituent) = & min(damageState(phase)%state0(index+1,constituent), & (sqrt(drivingForce*drivingForce + 4.0_pReal) - drivingForce)/2.0_pReal) else - drivingForce = accumulatedSlip(index)/damage_anisoDuctile_critPlasticStrain(f,instance) + drivingForce = plasticState(phase)%accumulatedSlip(index,constituent)/damage_anisoDuctile_critPlasticStrain(f,instance) damageState(phase)%state(index+1,constituent) = & min(damageState(phase)%state0(index+1,constituent), & 1.0_pReal/drivingForce) diff --git a/code/damage_isoDuctile.f90 b/code/damage_isoDuctile.f90 index 43b82b780..124a0447c 100644 --- a/code/damage_isoDuctile.f90 +++ b/code/damage_isoDuctile.f90 @@ -264,24 +264,22 @@ end subroutine damage_isoDuctile_aTolState !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -subroutine damage_isoDuctile_microstructure(nSlip,accumulatedSlip,subdt,ipc, ip, el) +subroutine damage_isoDuctile_microstructure(subdt,ipc, ip, el) use numerics, only: & residualStiffness use material, only: & phase_damageInstance, & mappingConstitutive, & + plasticState, & damageState use lattice, only: & lattice_DamageMobility implicit none integer(pInt), intent(in) :: & - nSlip, & ipc, & !< component-ID of integration point ip, & !< integration point el !< element - real(pReal), dimension(nSlip), intent(in) :: & - accumulatedSlip real(pReal), intent(in) :: & subdt integer(pInt) :: & @@ -294,7 +292,8 @@ subroutine damage_isoDuctile_microstructure(nSlip,accumulatedSlip,subdt,ipc, ip, damageState(phase)%state(2,constituent) = & max(residualStiffness, & min(damageState(phase)%state0(2,constituent), & - damage_isoDuctile_critPlasticStrain(instance)/sum(accumulatedSlip))) + damage_isoDuctile_critPlasticStrain(instance)/ & + sum(plasticState(phase)%accumulatedSlip(:,constituent)))) damageState(phase)%state(1,constituent) = & damageState(phase)%state(2,constituent) + & diff --git a/code/plastic_dislokmc.f90 b/code/plastic_dislokmc.f90 index 66b25ad1f..6f8077665 100644 --- a/code/plastic_dislokmc.f90 +++ b/code/plastic_dislokmc.f90 @@ -141,8 +141,6 @@ module plastic_dislokmc plastic_dislokmc_microstructure, & plastic_dislokmc_LpAndItsTangent, & plastic_dislokmc_dotState, & - plastic_dislokmc_getAccumulatedSlip, & - plastic_dislokmc_getSlipRate, & plastic_dislokmc_postResults private :: & plastic_dislokmc_stateInit, & @@ -203,7 +201,7 @@ subroutine plastic_dislokmc_init(fileUnit) f,instance,j,k,l,m,n,o,p,q,r,s,ns,nt, & Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, & Nchunks_SlipFamilies, Nchunks_TwinFamilies, Nchunks_nonSchmid, & - index_myFamily, index_otherFamily + offset_slip, index_myFamily, index_otherFamily integer(pInt) :: sizeState, sizeDotState integer(pInt) :: NofMyPhase character(len=65536) :: & @@ -662,6 +660,9 @@ subroutine plastic_dislokmc_init(fileUnit) plasticState(phase)%sizeState = sizeState plasticState(phase)%sizeDotState = sizeDotState + plasticState(phase)%nSlip = plastic_dislokmc_totalNslip(instance) + plasticState(phase)%nTwin = 0_pInt + plasticState(phase)%nTrans= 0_pInt allocate(plasticState(phase)%aTolState (sizeState), source=0.0_pReal) allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) @@ -680,6 +681,11 @@ subroutine plastic_dislokmc_init(fileUnit) allocate(plasticState(phase)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) if (any(numerics_integrator == 5_pInt)) & allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) + offset_slip = 2_pInt*plasticState(phase)%nSlip + plasticState(phase)%slipRate => & + plasticState(phase)%dotState(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) + plasticState(phase)%accumulatedSlip => & + plasticState(phase)%state (offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) !* Process slip related parameters ------------------------------------------------ mySlipFamilies: do f = 1_pInt,lattice_maxNslipFamily @@ -1583,95 +1589,6 @@ subroutine plastic_dislokmc_dotState(Tstar_v,Temperature,nSlipDamage,slipDamage, end subroutine plastic_dislokmc_dotState -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip -!-------------------------------------------------------------------------------------------------- -subroutine plastic_dislokmc_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - real(pReal), dimension(:), allocatable :: & - accumulatedSlip - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - offset_accshear_slip, & - f, j, i - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = plastic_dislokmc_totalNslip(instance) - allocate(accumulatedSlip(nSlip)) - offset_accshear_slip = 2_pInt*nSlip - - j = 0_pInt - slipFamilies: do f = 1_pInt,lattice_maxNslipFamily - slipSystems: do i = 1_pInt,plastic_dislokmc_Nslip(f,instance) - j = j+1_pInt - accumulatedSlip(j) = plasticState(phase)%state(offset_accshear_slip+j,offset) - enddo slipSystems - enddo slipFamilies - -end subroutine plastic_dislokmc_getAccumulatedSlip - - -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip -!-------------------------------------------------------------------------------------------------- -subroutine plastic_dislokmc_getSlipRate(nSlip,slipRate,ipc, ip, el) - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - real(pReal), dimension(:), allocatable :: & - slipRate - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - offset_accshear_slip, & - f, j, i - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = plastic_dislokmc_totalNslip(instance) - allocate(slipRate(nSlip)) - offset_accshear_slip = 2_pInt*nSlip - - j = 0_pInt - slipFamilies: do f = 1_pInt,lattice_maxNslipFamily - slipSystems: do i = 1_pInt,plastic_dislokmc_Nslip(f,instance) - j = j+1_pInt - slipRate(j) = plasticState(phase)%dotState(offset_accshear_slip+j,offset) - enddo slipSystems - enddo slipFamilies - -end subroutine plastic_dislokmc_getSlipRate - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results diff --git a/code/plastic_dislotwin.f90 b/code/plastic_dislotwin.f90 index fed7fda46..64c55a221 100644 --- a/code/plastic_dislotwin.f90 +++ b/code/plastic_dislotwin.f90 @@ -169,8 +169,6 @@ module plastic_dislotwin plastic_dislotwin_microstructure, & plastic_dislotwin_LpAndItsTangent, & plastic_dislotwin_dotState, & - plastic_dislotwin_getAccumulatedSlip, & - plastic_dislotwin_getSlipRate, & plastic_dislotwin_postResults private :: & plastic_dislotwin_stateInit, & @@ -233,7 +231,7 @@ subroutine plastic_dislotwin_init(fileUnit) f,instance,j,k,l,m,n,o,p,q,r,s,ns,nt,nr, & Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, & Nchunks_SlipFamilies, Nchunks_TwinFamilies, Nchunks_TransFamilies, & - index_myFamily, index_otherFamily + offset_slip, index_myFamily, index_otherFamily integer(pInt) :: sizeState, sizeDotState integer(pInt) :: NofMyPhase character(len=65536) :: & @@ -825,6 +823,9 @@ subroutine plastic_dislotwin_init(fileUnit) plasticState(phase)%sizeState = sizeState plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = plastic_dislotwin_sizePostResults(instance) + plasticState(phase)%nSlip = plastic_dislotwin_totalNslip(instance) + plasticState(phase)%nTwin = plastic_dislotwin_totalNtwin(instance) + plasticState(phase)%nTrans= plastic_dislotwin_totalNtrans(instance) allocate(plasticState(phase)%aTolState (sizeState), source=0.0_pReal) allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) @@ -843,7 +844,11 @@ subroutine plastic_dislotwin_init(fileUnit) allocate(plasticState(phase)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) if (any(numerics_integrator == 5_pInt)) & allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) - + offset_slip = 2_pInt*plasticState(phase)%nslip + plasticState(phase)%slipRate => & + plasticState(phase)%dotState(offset_slip+1:offset_slip+plasticState(phase)%nslip,1:NofMyPhase) + plasticState(phase)%accumulatedSlip => & + plasticState(phase)%state (offset_slip+1:offset_slip+plasticState(phase)%nslip,1:NofMyPhase) !* Process slip related parameters ------------------------------------------------ slipFamiliesLoop: do f = 1_pInt,lattice_maxNslipFamily index_myFamily = sum(plastic_dislotwin_Nslip(1:f-1_pInt,instance)) ! index in truncated slip system list @@ -1927,97 +1932,6 @@ subroutine plastic_dislotwin_dotState(Tstar_v,Temperature,nSlipDamage,slipDamage end subroutine plastic_dislotwin_dotState -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip -!-------------------------------------------------------------------------------------------------- -subroutine plastic_dislotwin_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - - real(pReal), dimension(:), allocatable :: & - accumulatedSlip - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - offset_accshear_slip, & - f, j, i - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = plastic_dislotwin_totalNslip(instance) - allocate(accumulatedSlip(nSlip)) - offset_accshear_slip = 2_pInt*nSlip - - j = 0_pInt - do f = 1_pInt,lattice_maxNslipFamily ! loop over all slip families - do i = 1_pInt,plastic_dislotwin_Nslip(f,instance) ! process each (active) slip system in family - j = j+1_pInt - accumulatedSlip(j) = plasticState(phase)%state(offset_accshear_slip+j,offset) - enddo - enddo - -end subroutine plastic_dislotwin_getAccumulatedSlip - - -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip rate -!-------------------------------------------------------------------------------------------------- -subroutine plastic_dislotwin_getSlipRate(nSlip,slipRate,ipc, ip, el) - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - - real(pReal), dimension(:), allocatable :: & - slipRate - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - offset_accshear_slip, & - f, j, i - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = plastic_dislotwin_totalNslip(instance) - allocate(slipRate(nSlip)) - offset_accshear_slip = 2_pInt*nSlip - - j = 0_pInt - do f = 1_pInt,lattice_maxNslipFamily ! loop over all slip families - do i = 1_pInt,plastic_dislotwin_Nslip(f,instance) ! process each (active) slip system in family - j = j+1_pInt - slipRate(j) = plasticState(phase)%dotState(offset_accshear_slip+j,offset) - enddo - enddo - -end subroutine plastic_dislotwin_getSlipRate - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results diff --git a/code/plastic_j2.f90 b/code/plastic_j2.f90 index 5d9244d71..00feb3072 100644 --- a/code/plastic_j2.f90 +++ b/code/plastic_j2.f90 @@ -76,7 +76,6 @@ integer(HID_T), allocatable, dimension(:) :: outID plastic_j2_init, & plastic_j2_LpAndItsTangent, & plastic_j2_dotState, & - plastic_j2_getAccumulatedSlip, & plastic_j2_postResults contains @@ -329,6 +328,9 @@ subroutine plastic_j2_init(fileUnit) plasticState(phase)%sizeState = sizeState plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = plastic_j2_sizePostResults(instance) + plasticState(phase)%nSlip = 1 + plasticState(phase)%nTwin = 0 + plasticState(phase)%nTrans= 0 allocate(plasticState(phase)%aTolState ( sizeState)) plasticState(phase)%aTolState(1) = plastic_j2_aTolResistance(instance) plasticState(phase)%aTolState(2) = plastic_j2_aTolShear(instance) @@ -349,7 +351,8 @@ subroutine plastic_j2_init(fileUnit) allocate(plasticState(phase)%RK4dotState (sizeDotState,NofMyPhase),source=0.0_pReal) if (any(numerics_integrator == 5_pInt)) & allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) - + plasticState(phase)%slipRate => plasticState(phase)%dotState(2:2,1:NofMyPhase) + plasticState(phase)%accumulatedSlip => plasticState(phase)%state (2:2,1:NofMyPhase) endif myPhase enddo initializeInstances @@ -520,42 +523,6 @@ subroutine plastic_j2_dotState(Tstar_v,nSlipDamage,slipDamage,ipc,ip,el) end subroutine plastic_j2_dotState - -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip -!-------------------------------------------------------------------------------------------------- -subroutine plastic_j2_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - - real(pReal), dimension(:), allocatable :: & - accumulatedSlip - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - constituent, & - phase, & - instance - - constituent = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - - nSlip = 1_pInt - allocate(accumulatedSlip(nSlip)) - accumulatedSlip(1) = plasticState(phase)%state(2,constituent) - -end subroutine plastic_j2_getAccumulatedSlip - - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- diff --git a/code/plastic_none.f90 b/code/plastic_none.f90 index 9795f8a6f..1572a7ad1 100644 --- a/code/plastic_none.f90 +++ b/code/plastic_none.f90 @@ -78,6 +78,9 @@ subroutine plastic_none_init sizeDotState = sizeState plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = 0_pInt + plasticState(phase)%nSlip = 0_pInt + plasticState(phase)%nTwin = 0_pInt + plasticState(phase)%nTrans = 0_pInt allocate(plasticState(phase)%aTolState (sizeState)) allocate(plasticState(phase)%state0 (sizeState,NofMyPhase)) allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase)) diff --git a/code/plastic_nonlocal.f90 b/code/plastic_nonlocal.f90 index 6a360dd00..77d478b44 100644 --- a/code/plastic_nonlocal.f90 +++ b/code/plastic_nonlocal.f90 @@ -249,8 +249,6 @@ module plastic_nonlocal plastic_nonlocal_dotState, & plastic_nonlocal_deltaState, & plastic_nonlocal_updateCompatibility, & - plastic_nonlocal_getAccumulatedSlip, & - plastic_nonlocal_getSlipRate, & plastic_nonlocal_postResults private :: & @@ -1305,6 +1303,9 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = plastic_nonlocal_sizePostResults(instance) plasticState(phase)%nonlocal = .true. + plasticState(phase)%nSlip = totalNslip(instance) + plasticState(phase)%nTwin = 0_pInt + plasticState(phase)%nTrans= 0_pInt allocate(plasticState(phase)%aTolState (sizeState), source=0.0_pReal) allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) @@ -1323,7 +1324,11 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), allocate(plasticState(phase)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) if (any(numerics_integrator == 5_pInt)) & allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) - + plasticState(phase)%slipRate => & + plasticState(phase)%dotState(iGamma(1,instance):iGamma(ns,instance),1:NofMyPhase) + plasticState(phase)%accumulatedSlip => & + plasticState(phase)%state (iGamma(1,instance):iGamma(ns,instance),1:NofMyPhase) + do s1 = 1_pInt,ns f = slipFamily(s1,instance) @@ -3555,81 +3560,6 @@ endif end function plastic_nonlocal_dislocationstress -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip -!-------------------------------------------------------------------------------------------------- -subroutine plastic_nonlocal_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - - real(pReal), dimension(:), allocatable :: & - accumulatedSlip - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - s - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = totalNslip(instance) - allocate(accumulatedSlip(nSlip)) - forall (s = 1:nSlip) & - accumulatedSlip(s) = plasticState(phase)%state(iGamma(s,instance),offset) - -end subroutine plastic_nonlocal_getAccumulatedSlip - - -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip rate -!-------------------------------------------------------------------------------------------------- -subroutine plastic_nonlocal_getSlipRate(nSlip,slipRate,ipc, ip, el) - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - - real(pReal), dimension(:), allocatable :: & - slipRate - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - s - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = totalNslip(instance) - allocate(slipRate(nSlip)) - forall (s = 1:nSlip) & - slipRate(s) = plasticState(phase)%dotState(iGamma(s,instance),offset) - -end subroutine plastic_nonlocal_getSlipRate - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results diff --git a/code/plastic_phenopowerlaw.f90 b/code/plastic_phenopowerlaw.f90 index 06b783141..85cb0ab01 100644 --- a/code/plastic_phenopowerlaw.f90 +++ b/code/plastic_phenopowerlaw.f90 @@ -96,8 +96,6 @@ module plastic_phenopowerlaw plastic_phenopowerlaw_init, & plastic_phenopowerlaw_LpAndItsTangent, & plastic_phenopowerlaw_dotState, & - plastic_phenopowerlaw_getAccumulatedSlip, & - plastic_phenopowerlaw_getSlipRate, & plastic_phenopowerlaw_postResults private :: & plastic_phenopowerlaw_aTolState, & @@ -158,7 +156,7 @@ subroutine plastic_phenopowerlaw_init(fileUnit) Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, & Nchunks_SlipFamilies, Nchunks_TwinFamilies, Nchunks_TransFamilies, Nchunks_nonSchmid, & NipcMyPhase, & - index_myFamily, index_otherFamily, & + offset_slip, index_myFamily, index_otherFamily, & mySize=0_pInt,sizeState,sizeDotState character(len=65536) :: & tag = '', & @@ -560,6 +558,9 @@ subroutine plastic_phenopowerlaw_init(fileUnit) plasticState(phase)%sizeState = sizeState plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = plastic_phenopowerlaw_sizePostResults(instance) + plasticState(phase)%nSlip =plastic_phenopowerlaw_totalNslip(instance) + plasticState(phase)%nTwin =plastic_phenopowerlaw_totalNtwin(instance) + plasticState(phase)%nTrans=plastic_phenopowerlaw_totalNtrans(instance) allocate(plasticState(phase)%aTolState ( sizeState), source=0.0_pReal) allocate(plasticState(phase)%state0 ( sizeState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%partionedState0 ( sizeState,NipcMyPhase), source=0.0_pReal) @@ -576,7 +577,13 @@ subroutine plastic_phenopowerlaw_init(fileUnit) allocate(plasticState(phase)%RK4dotState (sizeDotState,NipcMyPhase), source=0.0_pReal) if (any(numerics_integrator == 5_pInt)) & allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NipcMyPhase), source=0.0_pReal) - + + offset_slip = plasticState(phase)%nSlip+plasticState(phase)%nTwin+2_pInt + plasticState(phase)%slipRate => & + plasticState(phase)%dotState(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NipcMyPhase) + plasticState(phase)%accumulatedSlip => & + plasticState(phase)%state(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NipcMyPhase) + do f = 1_pInt,lattice_maxNslipFamily ! >>> interaction slip -- X index_myFamily = sum(plastic_phenopowerlaw_Nslip(1:f-1_pInt,instance)) do j = 1_pInt,plastic_phenopowerlaw_Nslip(f,instance) ! loop over (active) systems in my family (slip) @@ -1029,101 +1036,6 @@ subroutine plastic_phenopowerlaw_dotState(Tstar_v,nSlipDamage,slipDamage,ipc,ip, end subroutine plastic_phenopowerlaw_dotState - -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip -!-------------------------------------------------------------------------------------------------- -subroutine plastic_phenopowerlaw_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) ! question: make function, shape (i.e. nslip) is automatically returned - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - real(pReal), dimension(:), allocatable :: & - accumulatedSlip - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - offset_accshear_slip, & - nTwin, & - f, j, i - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = plastic_phenopowerlaw_totalNslip(instance) - nTwin = plastic_phenopowerlaw_totalNtwin(instance) - offset_accshear_slip = nSlip + nTwin + 2_pInt - - allocate(accumulatedSlip(nSlip)) - j = 0_pInt - slipFamiliesLoop: do f = 1_pInt,lattice_maxNslipFamily - do i = 1_pInt,plastic_phenopowerlaw_Nslip(f,instance) ! process each (active) slip system in family - j = j+1_pInt - accumulatedSlip(j) = plasticState(phase)%state(offset_accshear_slip+j,offset) - enddo - enddo slipFamiliesLoop - -end subroutine plastic_phenopowerlaw_getAccumulatedSlip - - -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip rate -!-------------------------------------------------------------------------------------------------- -subroutine plastic_phenopowerlaw_getSlipRate(nSlip,slipRate,ipc, ip, el) ! question: make function, shape (i.e. nslip) is automatically returned - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - real(pReal), dimension(:), allocatable :: & - slipRate - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - offset_accshear_slip, & - nTwin, & - f, j, i - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = plastic_phenopowerlaw_totalNslip(instance) - nTwin = plastic_phenopowerlaw_totalNtwin(instance) - offset_accshear_slip = nSlip + nTwin + 2_pInt - - allocate(slipRate(nSlip)) - j = 0_pInt - slipFamiliesLoop: do f = 1_pInt,lattice_maxNslipFamily - do i = 1_pInt,plastic_phenopowerlaw_Nslip(f,instance) ! process each (active) slip system in family - j = j+1_pInt - slipRate(j) = plasticState(phase)%dotState(offset_accshear_slip+j,offset) - enddo - enddo slipFamiliesLoop - -end subroutine plastic_phenopowerlaw_getSlipRate - - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- diff --git a/code/plastic_titanmod.f90 b/code/plastic_titanmod.f90 index 13e685428..698976bb3 100644 --- a/code/plastic_titanmod.f90 +++ b/code/plastic_titanmod.f90 @@ -176,8 +176,6 @@ module plastic_titanmod plastic_titanmod_init, & plastic_titanmod_LpAndItsTangent, & plastic_titanmod_dotState, & - plastic_titanmod_getAccumulatedSlip, & - plastic_titanmod_getSlipRate, & plastic_titanmod_postResults, & plastic_titanmod_homogenizedC @@ -238,7 +236,7 @@ subroutine plastic_titanmod_init(fileUnit) ns, nt, & Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, & Nchunks_SlipFamilies, Nchunks_TwinFamilies, & - mySize, & + offset_slip, mySize, & maxTotalNslip,maxTotalNtwin, maxNinstance integer(pInt) :: sizeState, sizeDotState integer(pInt) :: NofMyPhase @@ -852,6 +850,9 @@ subroutine plastic_titanmod_init(fileUnit) plasticState(phase)%sizeState = sizeState plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = plastic_titanmod_sizePostResults(instance) + plasticState(phase)%nSlip =plastic_titanmod_totalNslip(instance) + plasticState(phase)%nTwin = 0_pInt + plasticState(phase)%nTrans= 0_pInt allocate(plasticState(phase)%aTolState (sizeState), source=plastic_titanmod_aTolRho(instance)) allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) @@ -870,6 +871,11 @@ subroutine plastic_titanmod_init(fileUnit) allocate(plasticState(phase)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) if (any(numerics_integrator == 5_pInt)) & allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) + offset_slip = 2_pInt*plasticState(phase)%nSlip+1 + plasticState(phase)%slipRate => & + plasticState(phase)%dotState(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) + plasticState(phase)%accumulatedSlip => & + plasticState(phase)%state (offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NofMyPhase) !-------------------------------------------------------------------------------------------------- ! construction of the twin elasticity matrices do j=1_pInt,lattice_maxNtwinFamily @@ -1775,97 +1781,6 @@ implicit none enddo twinFamiliesLoop end subroutine plastic_titanmod_dotState -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip -!-------------------------------------------------------------------------------------------------- -subroutine plastic_titanmod_getAccumulatedSlip(nSlip,accumulatedSlip,ipc, ip, el) - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - - real(pReal), dimension(:), allocatable :: & - accumulatedSlip - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - offset_accshear_slip, & - f, j, i - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = plastic_titanmod_totalNslip(instance) - allocate(accumulatedSlip(nSlip)) - offset_accshear_slip = 2_pInt*nSlip - - j = 0_pInt - do f = 1_pInt,lattice_maxNslipFamily ! loop over all slip families - do i = 1_pInt,plastic_titanmod_Nslip(f,instance) ! process each (active) slip system in family - j = j+1_pInt - accumulatedSlip(j) = plasticState(phase)%state(offset_accshear_slip+j,offset) - enddo - enddo - -end subroutine plastic_titanmod_getAccumulatedSlip - - -!-------------------------------------------------------------------------------------------------- -!> @brief returns accumulated slip -!-------------------------------------------------------------------------------------------------- -subroutine plastic_titanmod_getSlipRate(nSlip,slipRate,ipc, ip, el) - use lattice, only: & - lattice_maxNslipFamily - use material, only: & - mappingConstitutive, & - plasticState, & - phase_plasticityInstance - - implicit none - - real(pReal), dimension(:), allocatable :: & - slipRate - integer(pInt) :: & - nSlip - integer(pInt), intent(in) :: & - ipc, & !< grain number - ip, & !< integration point number - el !< element number - integer(pInt) :: & - offset, & - phase, & - instance, & - offset_accshear_slip, & - f, j, i - - offset = mappingConstitutive(1,ipc,ip,el) - phase = mappingConstitutive(2,ipc,ip,el) - instance = phase_plasticityInstance(phase) - nSlip = plastic_titanmod_totalNslip(instance) - allocate(slipRate(nSlip)) - offset_accshear_slip = 2_pInt*nSlip - - j = 0_pInt - do f = 1_pInt,lattice_maxNslipFamily ! loop over all slip families - do i = 1_pInt,plastic_titanmod_Nslip(f,instance) ! process each (active) slip system in family - j = j+1_pInt - slipRate(j) = plasticState(phase)%dotState(offset_accshear_slip+j,offset) - enddo - enddo - -end subroutine plastic_titanmod_getSlipRate - !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results diff --git a/code/vacancy_generation.f90 b/code/vacancy_generation.f90 index 33b224bc0..a612fc127 100644 --- a/code/vacancy_generation.f90 +++ b/code/vacancy_generation.f90 @@ -289,11 +289,12 @@ end subroutine vacancy_generation_aTolState !-------------------------------------------------------------------------------------------------- !> @brief calculates derived quantities from state !-------------------------------------------------------------------------------------------------- -subroutine vacancy_generation_microstructure(C, Fe, nSlip, accumulatedSlip, Temperature, subdt, & +subroutine vacancy_generation_microstructure(C, Fe, Temperature, subdt, & ipc, ip, el) use material, only: & mappingConstitutive, & phase_vacancyInstance, & + plasticState, & vacancyState use math, only : & math_mul33x33, & @@ -306,15 +307,12 @@ subroutine vacancy_generation_microstructure(C, Fe, nSlip, accumulatedSlip, Temp implicit none integer(pInt), intent(in) :: & - nSlip, & ipc, & !< component-ID of integration point ip, & !< integration point el !< element real(pReal), intent(in) :: & Fe(3,3), & C (6,6) - real(pReal), dimension(nSlip), intent(in) :: & - accumulatedSlip real(pReal), intent(in) :: & Temperature !< 2nd Piola Kirchhoff stress tensor (Mandel) real(pReal), intent(in) :: & @@ -336,7 +334,7 @@ subroutine vacancy_generation_microstructure(C, Fe, nSlip, accumulatedSlip, Temp pressure = math_trace33(math_Mandel6to33(stress)) energyBarrier = (vacancy_generation_formationEnergy(instance) - pressure)* & vacancy_generation_atomicVol(instance) - & - sum(accumulatedSlip)*vacancy_generation_plasticityCoeff(instance) + sum(plasticState(phase)%accumulatedSlip(:,constituent))*vacancy_generation_plasticityCoeff(instance) vacancyState(phase)%state(1,constituent) = & vacancyState(phase)%subState0(1,constituent) + &