avoid conversions

This commit is contained in:
Martin Diehl 2021-11-18 21:59:09 +01:00
parent 038dd1fc40
commit fa8218124a
5 changed files with 19 additions and 15 deletions

View File

@ -643,17 +643,17 @@ module function RGC_updateState(P,F,avgF,dt,dPdF,ce) result(doneAndHappy)
!-------------------------------------------------------------------------------------------------
!> @brief compute the equivalent shear and bulk moduli from the elasticity tensor
!-------------------------------------------------------------------------------------------------
real(pReal) function equivalentMu(grainID,ce)
real(pReal) function equivalentMu(co,ce)
integer, intent(in) :: &
grainID,&
co,&
ce
real(pReal), dimension(6,6) :: C
C = phase_homogenizedC66(material_phaseID(grainID,ce),material_phaseEntry(grainID,ce))
equivalentMu = lattice_equivalent_mu(C,'voigt')
C = phase_homogenizedC66(material_phaseID(co,ce),material_phaseEntry(co,ce))
equivalentMu = lattice_equivalent_mu(math_sym3333to66(math_Voigt66to3333(C)),'voigt') !ToDo: Bug, should be Voigt not sym
end function equivalentMu

View File

@ -234,10 +234,10 @@ module phase
integer, intent(in) :: ph, en
real(pReal), dimension(6,6) :: C
end function phase_homogenizedC66
module function phase_damage_C66(C66,ph,en)
module function phase_damage_C66(C66,ph,en) result(C66_degraded)
real(pReal), dimension(6,6), intent(in) :: C66
integer, intent(in) :: ph,en
real(pReal), dimension(6,6) :: phase_damage_C66
real(pReal), dimension(6,6) :: C66_degraded
end function phase_damage_C66
module function phase_f_phi(phi,co,ce) result(f)

View File

@ -151,18 +151,18 @@ end function phase_damage_constitutive
!--------------------------------------------------------------------------------------------------
!> @brief returns the degraded/modified elasticity matrix
!--------------------------------------------------------------------------------------------------
module function phase_damage_C66(C66,ph,en)
module function phase_damage_C66(C66,ph,en) result(C66_degraded)
real(pReal), dimension(6,6), intent(in) :: C66
integer, intent(in) :: ph,en
real(pReal), dimension(6,6) :: phase_damage_C66
real(pReal), dimension(6,6) :: C66_degraded
damageType: select case (phase_damage(ph))
case (DAMAGE_ISOBRITTLE_ID) damageType
phase_damage_C66 = C66 * damage_phi(ph,en)**2
C66_degraded = C66 * damage_phi(ph,en)**2
case default damageType
phase_damage_C66 = C66
C66_degraded = C66
end select damageType
end function phase_damage_C66

View File

@ -96,6 +96,7 @@ end function isobrittle_init
!--------------------------------------------------------------------------------------------------
!> @brief calculates derived quantities from state
! ToDo: Use Voigt directly
!--------------------------------------------------------------------------------------------------
module subroutine isobrittle_deltaState(C, Fe, ph,en)
@ -109,13 +110,16 @@ module subroutine isobrittle_deltaState(C, Fe, ph,en)
epsilon
real(pReal) :: &
r_W
real(pReal), dimension(6,6) :: &
C_sym
C_sym = math_sym3333to66(math_Voigt66to3333(C))
epsilon = 0.5_pReal*math_sym33to6(matmul(transpose(Fe),Fe)-math_I3)
associate(prm => param(ph), stt => state(ph), dlt => deltaState(ph))
r_W = 2.0_pReal*dot_product(epsilon,matmul(C,epsilon))/prm%W_crit
r_W = 2.0_pReal*dot_product(epsilon,matmul(C_sym,epsilon))/prm%W_crit
dlt%r_W(en) = merge(r_W - stt%r_W(en), 0.0_pReal, r_W > stt%r_W(en))
end associate

View File

@ -152,12 +152,12 @@ module subroutine phase_hooke_SandItsTangents(S, dS_dFe, dS_dFi, &
i, j
C = math_66toSym3333(phase_damage_C66(phase_homogenizedC66(ph,en),ph,en))
C = math_Voigt66to3333(phase_damage_C66(phase_homogenizedC66(ph,en),ph,en))
E = 0.5_pReal*(matmul(transpose(Fe),Fe)-math_I3) !< Green-Lagrange strain in unloaded configuration
S = math_mul3333xx33(C,matmul(matmul(transpose(Fi),E),Fi)) !< 2PK stress in lattice configuration in work conjugate with GL strain pulled back to lattice configuration
do i =1, 3;do j=1,3
do i =1,3; do j=1,3
dS_dFe(i,j,1:3,1:3) = matmul(Fe,matmul(matmul(Fi,C(i,j,1:3,1:3)),transpose(Fi))) !< dS_ij/dFe_kl = C_ijmn * Fi_lm * Fi_on * Fe_ko
dS_dFi(i,j,1:3,1:3) = 2.0_pReal*matmul(matmul(E,Fi),C(i,j,1:3,1:3)) !< dS_ij/dFi_kl = C_ijln * E_km * Fe_mn
end do; end do
@ -176,9 +176,9 @@ module function phase_homogenizedC66(ph,en) result(C)
plasticType: select case (phase_plasticity(ph))
case (PLASTICITY_DISLOTWIN_ID) plasticType
C = plastic_dislotwin_homogenizedC(ph,en)
C = math_3333toVoigt66(math_66toSym3333(plastic_dislotwin_homogenizedC(ph,en)))
case default plasticType
C = math_sym3333to66(math_Voigt66to3333(elastic_C66(ph,en)))
C = elastic_C66(ph,en)
end select plasticType
end function phase_homogenizedC66