From 10d2cfebd3a20ef0e888b3c0a3a50292fc9499e7 Mon Sep 17 00:00:00 2001 From: Pratheek Shanthraj Date: Fri, 8 Aug 2014 14:02:20 +0000 Subject: [PATCH] changed naming scheme for helper functions. damage and thermal dependent stress calculation more modularised --- code/Makefile | 8 +++--- code/constitutive.f90 | 54 +++++++++-------------------------- code/constitutive_damage.f90 | 18 ++++++------ code/constitutive_thermal.f90 | 18 ++++++------ code/damage_gradient.f90 | 14 ++++----- code/damage_local.f90 | 13 ++++----- code/thermal_adiabatic.f90 | 12 ++++---- code/thermal_conduction.f90 | 12 ++++---- 8 files changed, 59 insertions(+), 90 deletions(-) diff --git a/code/Makefile b/code/Makefile index 700fb767a..c69d18ed7 100644 --- a/code/Makefile +++ b/code/Makefile @@ -403,9 +403,7 @@ homogenization_none.o: homogenization_none.f90 \ crystallite.o crystallite.o: crystallite.f90 \ - constitutive.o \ - constitutive_thermal.o \ - constitutive_damage.o + constitutive.o constitutive.o: constitutive.f90 \ constitutive_nonlocal.o \ @@ -414,7 +412,9 @@ constitutive.o: constitutive.f90 \ constitutive_dislokmc.o \ constitutive_phenopowerlaw.o \ constitutive_j2.o \ - constitutive_none.o + constitutive_none.o \ + constitutive_thermal.o \ + constitutive_damage.o constitutive_nonlocal.o: constitutive_nonlocal.f90 \ lattice.o diff --git a/code/constitutive.f90 b/code/constitutive.f90 index 7e08661cb..87220667a 100644 --- a/code/constitutive.f90 +++ b/code/constitutive.f90 @@ -362,6 +362,8 @@ subroutine constitutive_LpAndItsTangent(Lp, dLp_dTstar, Tstar_v, temperature, ip PLASTICITY_DISLOKMC_ID, & PLASTICITY_TITANMOD_ID, & PLASTICITY_NONLOCAL_ID + use constitutive_damage, only: & + constitutive_damageValue use constitutive_j2, only: & constitutive_j2_LpAndItsTangent use constitutive_phenopowerlaw, only: & @@ -455,18 +457,14 @@ subroutine constitutive_hooke_TandItsTangent(T, dT_dFe, Fe, ipc, ip, el) math_transpose33, & MATH_I3 use material, only: & - mappingConstitutive, & - damageState, & - phase_damage, & - DAMAGE_local_ID, & - DAMAGE_gradient_ID, & - thermalState, & - phase_thermal, & - THERMAL_conduction_ID, & - THERMAL_adiabatic_ID + mappingConstitutive use lattice, only: & lattice_referenceTemperature, & lattice_thermalExpansion33 + use constitutive_damage, only: & + constitutive_damageValue + use constitutive_thermal, only: & + constitutive_temperature implicit none integer(pInt), intent(in) :: & @@ -483,45 +481,19 @@ subroutine constitutive_hooke_TandItsTangent(T, dT_dFe, Fe, ipc, ip, el) integer(pInt) :: i, j, k, l real(pReal), dimension(3,3) :: FeT real(pReal), dimension(3,3,3,3) :: C - real(pReal) :: damage - integer(pInt) :: phase, constituent - - C = math_Mandel66to3333(constitutive_homogenizedC(ipc,ip,el)) + C = constitutive_damageValue(ipc,ip,el)*& + math_Mandel66to3333(constitutive_homogenizedC(ipc,ip,el)) FeT = math_transpose33(Fe) - T = 0.5_pReal*math_mul3333xx33(C,math_mul33x33(FeT,Fe)-MATH_I3) + T = math_mul3333xx33(C,0.5_pReal*(math_mul33x33(FeT,Fe)-MATH_I3) - & + lattice_thermalExpansion33(1:3,1:3,mappingConstitutive(2,ipc,ip,el))* & + (constitutive_temperature(ipc,ip,el) - & + lattice_referenceTemperature(mappingConstitutive(2,ipc,ip,el)))) dT_dFe = 0.0_pReal forall (i=1_pInt:3_pInt, j=1_pInt:3_pInt, k=1_pInt:3_pInt, l=1_pInt:3_pInt) & dT_dFe(i,j,k,l) = math_mul3x3(C(i,j,l,1:3),Fe(k,1:3)) ! dT*_ij/dFe_kl - phase = mappingConstitutive(2,ipc,ip,el) - constituent = mappingConstitutive(1,ipc,ip,el) - select case (phase_damage(phase)) - case (DAMAGE_local_ID) - damage = damageState(phase)%state(2,constituent)* & - damageState(phase)%state(2,constituent) - T = damage*T - dT_dFe = damage*dT_dFe - - case (DAMAGE_gradient_ID) - damage = damageState(phase)%state(3,constituent)* & - damageState(phase)%state(3,constituent) - T = damage*T - dT_dFe = damage*dT_dFe - - end select - select case (phase_thermal(phase)) - case (THERMAL_conduction_ID) - T = T - math_mul3333xx33(C, (thermalState(phase)%state(2,constituent) - & - lattice_referenceTemperature(phase)) & - * lattice_thermalExpansion33(1:3,1:3,phase)) - case (THERMAL_adiabatic_ID) - T = T - math_mul3333xx33(C, (thermalState(phase)%state(1,constituent) - & - lattice_referenceTemperature(phase)) & - * lattice_thermalExpansion33(1:3,1:3,phase)) - end select - end subroutine constitutive_hooke_TandItsTangent diff --git a/code/constitutive_damage.f90 b/code/constitutive_damage.f90 index b6bb8a127..46f6d7e5d 100644 --- a/code/constitutive_damage.f90 +++ b/code/constitutive_damage.f90 @@ -20,7 +20,7 @@ module constitutive_damage constitutive_damage_init, & constitutive_damage_microstructure, & constitutive_damage_collectDotState, & - constitutive_damage_getDamage, & + constitutive_damageValue, & constitutive_damage_postResults contains @@ -206,7 +206,7 @@ end subroutine constitutive_damage_collectDotState !-------------------------------------------------------------------------------------------------- !> @brief returns temperature based on each damage model state layout !-------------------------------------------------------------------------------------------------- -function constitutive_damage_getDamage(ipc, ip, el) +function constitutive_damageValue(ipc, ip, el) use material, only: & material_phase, & phase_damage, & @@ -214,30 +214,30 @@ function constitutive_damage_getDamage(ipc, ip, el) DAMAGE_local_ID, & DAMAGE_gradient_ID use damage_local, only: & - damage_local_getDamage + damage_local_damageValue use damage_gradient, only: & - damage_gradient_getDamage + damage_gradient_damageValue implicit none integer(pInt), intent(in) :: & ipc, & !< grain number ip, & !< integration point number el !< element number - real(pReal) :: constitutive_damage_getDamage + real(pReal) :: constitutive_damageValue select case (phase_damage(material_phase(ipc,ip,el))) case (DAMAGE_none_ID) - constitutive_damage_getDamage = 1.0_pReal + constitutive_damageValue = 1.0_pReal case (DAMAGE_local_ID) - constitutive_damage_getDamage = damage_local_getDamage(ipc, ip, el) + constitutive_damageValue = damage_local_damageValue(ipc, ip, el) case (DAMAGE_gradient_ID) - constitutive_damage_getDamage = damage_gradient_getDamage(ipc, ip, el) + constitutive_damageValue = damage_gradient_damageValue(ipc, ip, el) end select -end function constitutive_damage_getDamage +end function constitutive_damageValue !-------------------------------------------------------------------------------------------------- !> @brief returns array of constitutive results diff --git a/code/constitutive_thermal.f90 b/code/constitutive_thermal.f90 index 2c55f0048..912e3316a 100644 --- a/code/constitutive_thermal.f90 +++ b/code/constitutive_thermal.f90 @@ -19,7 +19,7 @@ module constitutive_thermal constitutive_thermal_init, & constitutive_thermal_microstructure, & constitutive_thermal_collectDotState, & - constitutive_thermal_getTemperature, & + constitutive_temperature, & constitutive_thermal_postResults contains @@ -189,7 +189,7 @@ end subroutine constitutive_thermal_collectDotState !-------------------------------------------------------------------------------------------------- !> @brief returns temperature based on each thermal model state layout !-------------------------------------------------------------------------------------------------- -function constitutive_thermal_getTemperature(ipc, ip, el) +function constitutive_temperature(ipc, ip, el) use material, only: & material_phase, & phase_thermal, & @@ -199,30 +199,30 @@ function constitutive_thermal_getTemperature(ipc, ip, el) use lattice, only: & lattice_referenceTemperature use thermal_conduction, only: & - thermal_conduction_getTemperature + thermal_conduction_temperature ! use thermal_adiabatic, only: & -! thermal_adiabatic_getTemperature +! thermal_adiabatic_temperature implicit none integer(pInt), intent(in) :: & ipc, & !< grain number ip, & !< integration point number el !< element number - real(pReal) :: constitutive_thermal_getTemperature + real(pReal) :: constitutive_temperature select case (phase_thermal(material_phase(ipc,ip,el))) case (THERMAL_none_ID) - constitutive_thermal_getTemperature = lattice_referenceTemperature(material_phase(ipc,ip,el)) + constitutive_temperature = lattice_referenceTemperature(material_phase(ipc,ip,el)) case (THERMAL_adiabatic_ID) - !constitutive_thermal_getTemperature = thermal_adiabatic_getTemperature(ipc, ip, el) + !constitutive_temperature = thermal_adiabatic_temperature(ipc, ip, el) case (THERMAL_conduction_ID) - constitutive_thermal_getTemperature = thermal_conduction_getTemperature(ipc, ip, el) + constitutive_temperature = thermal_conduction_temperature(ipc, ip, el) end select -end function constitutive_thermal_getTemperature +end function constitutive_temperature !-------------------------------------------------------------------------------------------------- !> @brief returns array of constitutive results diff --git a/code/damage_gradient.f90 b/code/damage_gradient.f90 index e1d5b02e9..33789591f 100644 --- a/code/damage_gradient.f90 +++ b/code/damage_gradient.f90 @@ -44,7 +44,7 @@ module damage_gradient damage_gradient_aTolState, & damage_gradient_microstructure, & damage_gradient_dotState, & - damage_gradient_getDamage, & + damage_gradient_damageValue, & damage_gradient_postResults contains @@ -287,7 +287,7 @@ subroutine damage_gradient_microstructure(Tstar_v, Fe, ipc, ip, el) integer(pInt) :: & phase, constituent real(pReal) :: & - strainEnergy, strain(3,3), phi + strainEnergy, strain(3,3) phase = mappingConstitutive(2,ipc,ip,el) constituent = mappingConstitutive(1,ipc,ip,el) @@ -308,7 +308,6 @@ end subroutine damage_gradient_microstructure subroutine damage_gradient_dotState(Tstar_v, Lp, ipc, ip, el) use material, only: & mappingConstitutive, & - phase_damageInstance, & damageState use math, only: & math_Mandel6to33, & @@ -330,7 +329,6 @@ subroutine damage_gradient_dotState(Tstar_v, Lp, ipc, ip, el) phase = mappingConstitutive(2,ipc,ip,el) constituent = mappingConstitutive(1,ipc,ip,el) - instance = phase_damageInstance(phase) damageState(phase)%dotState(1,constituent) = & sum(abs(math_Mandel6to33(Tstar_v)*Lp))/ & @@ -341,7 +339,7 @@ end subroutine damage_gradient_dotState !-------------------------------------------------------------------------------------------------- !> @brief returns temperature based on gradient damage model state layout !-------------------------------------------------------------------------------------------------- -function damage_gradient_getDamage(ipc, ip, el) +function damage_gradient_damageValue(ipc, ip, el) use material, only: & mappingConstitutive, & damageState @@ -351,13 +349,13 @@ function damage_gradient_getDamage(ipc, ip, el) ipc, & !< grain number ip, & !< integration point number el !< element number - real(pReal) :: damage_gradient_getDamage + real(pReal) :: damage_gradient_damageValue - damage_gradient_getDamage = & + damage_gradient_damageValue = & damageState(mappingConstitutive(2,ipc,ip,el))%state(3,mappingConstitutive(1,ipc,ip,el))* & damageState(mappingConstitutive(2,ipc,ip,el))%state(3,mappingConstitutive(1,ipc,ip,el)) -end function damage_gradient_getDamage +end function damage_gradient_damageValue !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results diff --git a/code/damage_local.f90 b/code/damage_local.f90 index 357da9876..d0ab00f74 100644 --- a/code/damage_local.f90 +++ b/code/damage_local.f90 @@ -42,7 +42,7 @@ module damage_local damage_local_stateInit, & damage_local_aTolState, & damage_local_dotState, & - damage_local_getDamage, & + damage_local_damageValue, & damage_local_postResults contains @@ -295,8 +295,7 @@ subroutine damage_local_dotState(Tstar_v, Fe, Lp, ipc, ip, el) damageState(phase)%state(1,constituent))) damageState(phase)%dotState(1,constituent) = & - sum(abs(math_Mandel6to33(Tstar_v)*Lp))/ & - (math_trace33(lattice_surfaceEnergy33(1:3,1:3,phase))/3.0_pReal) + sum(abs(math_Mandel6to33(Tstar_v)*Lp)) damageState(phase)%dotState(2,constituent) = & damage_local_crack_mobility(instance)* & (trialDamage - damageState(phase)%state(2,constituent)) @@ -306,7 +305,7 @@ end subroutine damage_local_dotState !-------------------------------------------------------------------------------------------------- !> @brief returns temperature based on local damage model state layout !-------------------------------------------------------------------------------------------------- -function damage_local_getDamage(ipc, ip, el) +function damage_local_damageValue(ipc, ip, el) use material, only: & mappingConstitutive, & damageState @@ -316,13 +315,13 @@ function damage_local_getDamage(ipc, ip, el) ipc, & !< grain number ip, & !< integration point number el !< element number - real(pReal) :: damage_local_getDamage + real(pReal) :: damage_local_damageValue - damage_local_getDamage = & + damage_local_damageValue = & damageState(mappingConstitutive(2,ipc,ip,el))%state(2,mappingConstitutive(1,ipc,ip,el))* & damageState(mappingConstitutive(2,ipc,ip,el))%state(2,mappingConstitutive(1,ipc,ip,el)) -end function damage_local_getDamage +end function damage_local_damageValue !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results diff --git a/code/thermal_adiabatic.f90 b/code/thermal_adiabatic.f90 index 7273f8bd2..99bc28b33 100644 --- a/code/thermal_adiabatic.f90 +++ b/code/thermal_adiabatic.f90 @@ -42,7 +42,7 @@ module thermal_adiabatic thermal_adiabatic_stateInit, & thermal_adiabatic_aTolState, & thermal_adiabatic_dotState, & - thermal_adiabatic_getTemperature, & + thermal_adiabatic_temperature, & thermal_adiabatic_postResults contains @@ -283,7 +283,7 @@ end subroutine thermal_adiabatic_dotState !-------------------------------------------------------------------------------------------------- !> @brief returns temperature based on adiabatic thermal model state layout !-------------------------------------------------------------------------------------------------- -function thermal_adiabatic_getTemperature(ipc, ip, el) +function thermal_adiabatic_temperature(ipc, ip, el) use material, only: & mappingConstitutive, & thermalState @@ -293,12 +293,12 @@ function thermal_adiabatic_getTemperature(ipc, ip, el) ipc, & !< grain number ip, & !< integration point number el !< element number - real(pReal) :: thermal_adiabatic_getTemperature - - thermal_adiabatic_getTemperature = & + real(pReal) :: thermal_adiabatic_temperature + + thermal_adiabatic_temperature = & thermalState(mappingConstitutive(2,ipc,ip,el))%state(1,mappingConstitutive(1,ipc,ip,el)) -end function thermal_adiabatic_getTemperature +end function thermal_adiabatic_temperature !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results diff --git a/code/thermal_conduction.f90 b/code/thermal_conduction.f90 index 08d7508a0..6ba5301a1 100644 --- a/code/thermal_conduction.f90 +++ b/code/thermal_conduction.f90 @@ -42,7 +42,7 @@ module thermal_conduction thermal_conduction_stateInit, & thermal_conduction_aTolState, & thermal_conduction_microstructure, & - thermal_conduction_getTemperature, & + thermal_conduction_temperature, & thermal_conduction_postResults contains @@ -283,7 +283,7 @@ end subroutine thermal_conduction_microstructure !-------------------------------------------------------------------------------------------------- !> @brief returns temperature based on conduction thermal model state layout !-------------------------------------------------------------------------------------------------- -function thermal_conduction_getTemperature(ipc, ip, el) +function thermal_conduction_temperature(ipc, ip, el) use material, only: & mappingConstitutive, & thermalState @@ -293,13 +293,13 @@ function thermal_conduction_getTemperature(ipc, ip, el) ipc, & !< grain number ip, & !< integration point number el !< element number - real(pReal) :: thermal_conduction_getTemperature + real(pReal) :: thermal_conduction_temperature - thermal_conduction_getTemperature = & + thermal_conduction_temperature = & thermalState(mappingConstitutive(2,ipc,ip,el))%state(2,mappingConstitutive(1,ipc,ip,el)) -end function thermal_conduction_getTemperature - +end function thermal_conduction_temperature + !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !--------------------------------------------------------------------------------------------------