From 9d615b3d3b23e4fdca2d795ae0445107964bcc68 Mon Sep 17 00:00:00 2001
From: Pratheek Shanthraj
Date: Fri, 8 Aug 2014 07:39:17 +0000
Subject: [PATCH] added getDamage and getTemperature helper functions
---
code/constitutive_damage.f90 | 37 +++++++++++++++++++++++++++++++++
code/constitutive_thermal.f90 | 39 +++++++++++++++++++++++++++++++++++
code/damage_gradient.f90 | 21 +++++++++++++++++++
code/damage_local.f90 | 28 +++++++++++++++++++++++--
code/thermal_adiabatic.f90 | 20 ++++++++++++++++++
code/thermal_conduction.f90 | 20 ++++++++++++++++++
6 files changed, 163 insertions(+), 2 deletions(-)
diff --git a/code/constitutive_damage.f90 b/code/constitutive_damage.f90
index 689a3efe5..b6bb8a127 100644
--- a/code/constitutive_damage.f90
+++ b/code/constitutive_damage.f90
@@ -15,10 +15,12 @@ module constitutive_damage
integer(pInt), public, protected :: &
constitutive_damage_maxSizePostResults, &
constitutive_damage_maxSizeDotState
+
public :: &
constitutive_damage_init, &
constitutive_damage_microstructure, &
constitutive_damage_collectDotState, &
+ constitutive_damage_getDamage, &
constitutive_damage_postResults
contains
@@ -201,6 +203,41 @@ subroutine constitutive_damage_collectDotState(Tstar_v, Fe, Lp, ipc, ip, el)
end subroutine constitutive_damage_collectDotState
+!--------------------------------------------------------------------------------------------------
+!> @brief returns temperature based on each damage model state layout
+!--------------------------------------------------------------------------------------------------
+function constitutive_damage_getDamage(ipc, ip, el)
+ use material, only: &
+ material_phase, &
+ phase_damage, &
+ DAMAGE_none_ID, &
+ DAMAGE_local_ID, &
+ DAMAGE_gradient_ID
+ use damage_local, only: &
+ damage_local_getDamage
+ use damage_gradient, only: &
+ damage_gradient_getDamage
+
+ implicit none
+ integer(pInt), intent(in) :: &
+ ipc, & !< grain number
+ ip, & !< integration point number
+ el !< element number
+ real(pReal) :: constitutive_damage_getDamage
+
+ select case (phase_damage(material_phase(ipc,ip,el)))
+ case (DAMAGE_none_ID)
+ constitutive_damage_getDamage = 1.0_pReal
+
+ case (DAMAGE_local_ID)
+ constitutive_damage_getDamage = damage_local_getDamage(ipc, ip, el)
+
+ case (DAMAGE_gradient_ID)
+ constitutive_damage_getDamage = damage_gradient_getDamage(ipc, ip, el)
+
+ end select
+
+end function constitutive_damage_getDamage
!--------------------------------------------------------------------------------------------------
!> @brief returns array of constitutive results
diff --git a/code/constitutive_thermal.f90 b/code/constitutive_thermal.f90
index f5803115d..2c55f0048 100644
--- a/code/constitutive_thermal.f90
+++ b/code/constitutive_thermal.f90
@@ -19,6 +19,7 @@ module constitutive_thermal
constitutive_thermal_init, &
constitutive_thermal_microstructure, &
constitutive_thermal_collectDotState, &
+ constitutive_thermal_getTemperature, &
constitutive_thermal_postResults
contains
@@ -185,6 +186,44 @@ subroutine constitutive_thermal_collectDotState(Tstar_v, Lp, ipc, ip, el)
end subroutine constitutive_thermal_collectDotState
+!--------------------------------------------------------------------------------------------------
+!> @brief returns temperature based on each thermal model state layout
+!--------------------------------------------------------------------------------------------------
+function constitutive_thermal_getTemperature(ipc, ip, el)
+ use material, only: &
+ material_phase, &
+ phase_thermal, &
+ THERMAL_none_ID, &
+ THERMAL_adiabatic_ID, &
+ THERMAL_conduction_ID
+ use lattice, only: &
+ lattice_referenceTemperature
+ use thermal_conduction, only: &
+ thermal_conduction_getTemperature
+! use thermal_adiabatic, only: &
+! thermal_adiabatic_getTemperature
+
+ implicit none
+ integer(pInt), intent(in) :: &
+ ipc, & !< grain number
+ ip, & !< integration point number
+ el !< element number
+ real(pReal) :: constitutive_thermal_getTemperature
+
+ select case (phase_thermal(material_phase(ipc,ip,el)))
+ case (THERMAL_none_ID)
+ constitutive_thermal_getTemperature = lattice_referenceTemperature(material_phase(ipc,ip,el))
+
+ case (THERMAL_adiabatic_ID)
+ !constitutive_thermal_getTemperature = thermal_adiabatic_getTemperature(ipc, ip, el)
+
+ case (THERMAL_conduction_ID)
+ constitutive_thermal_getTemperature = thermal_conduction_getTemperature(ipc, ip, el)
+
+ end select
+
+end function constitutive_thermal_getTemperature
+
!--------------------------------------------------------------------------------------------------
!> @brief returns array of constitutive results
!--------------------------------------------------------------------------------------------------
diff --git a/code/damage_gradient.f90 b/code/damage_gradient.f90
index 6a037e3c2..e1d5b02e9 100644
--- a/code/damage_gradient.f90
+++ b/code/damage_gradient.f90
@@ -44,6 +44,7 @@ module damage_gradient
damage_gradient_aTolState, &
damage_gradient_microstructure, &
damage_gradient_dotState, &
+ damage_gradient_getDamage, &
damage_gradient_postResults
contains
@@ -337,6 +338,26 @@ subroutine damage_gradient_dotState(Tstar_v, Lp, ipc, ip, el)
end subroutine damage_gradient_dotState
+!--------------------------------------------------------------------------------------------------
+!> @brief returns temperature based on gradient damage model state layout
+!--------------------------------------------------------------------------------------------------
+function damage_gradient_getDamage(ipc, ip, el)
+ use material, only: &
+ mappingConstitutive, &
+ damageState
+
+ implicit none
+ integer(pInt), intent(in) :: &
+ ipc, & !< grain number
+ ip, & !< integration point number
+ el !< element number
+ real(pReal) :: damage_gradient_getDamage
+
+ damage_gradient_getDamage = &
+ 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
!--------------------------------------------------------------------------------------------------
!> @brief return array of constitutive results
diff --git a/code/damage_local.f90 b/code/damage_local.f90
index 0e30f6ab5..357da9876 100644
--- a/code/damage_local.f90
+++ b/code/damage_local.f90
@@ -42,6 +42,7 @@ module damage_local
damage_local_stateInit, &
damage_local_aTolState, &
damage_local_dotState, &
+ damage_local_getDamage, &
damage_local_postResults
contains
@@ -243,7 +244,8 @@ subroutine damage_local_aTolState(phase,instance)
instance ! number specifying the current instance of the damage
real(pReal), dimension(damageState(phase)%sizeState) :: tempTol
- tempTol = damage_local_aTol(instance)
+ tempTol(1) = 100.0_pReal
+ tempTol(2) = damage_local_aTol(instance)
damageState(phase)%aTolState = tempTol
end subroutine damage_local_aTolState
@@ -257,6 +259,7 @@ subroutine damage_local_dotState(Tstar_v, Fe, Lp, ipc, ip, el)
damageState
use math, only: &
math_Mandel66to3333, &
+ math_Mandel6to33, &
math_mul33x33, &
math_mul3333xx33, &
math_transpose33, &
@@ -292,14 +295,35 @@ subroutine damage_local_dotState(Tstar_v, Fe, Lp, ipc, ip, el)
damageState(phase)%state(1,constituent)))
damageState(phase)%dotState(1,constituent) = &
- 0.0_pReal
+ sum(abs(math_Mandel6to33(Tstar_v)*Lp))/ &
+ (math_trace33(lattice_surfaceEnergy33(1:3,1:3,phase))/3.0_pReal)
damageState(phase)%dotState(2,constituent) = &
damage_local_crack_mobility(instance)* &
(trialDamage - damageState(phase)%state(2,constituent))
end subroutine damage_local_dotState
+!--------------------------------------------------------------------------------------------------
+!> @brief returns temperature based on local damage model state layout
+!--------------------------------------------------------------------------------------------------
+function damage_local_getDamage(ipc, ip, el)
+ use material, only: &
+ mappingConstitutive, &
+ damageState
+
+ implicit none
+ integer(pInt), intent(in) :: &
+ ipc, & !< grain number
+ ip, & !< integration point number
+ el !< element number
+ real(pReal) :: damage_local_getDamage
+ damage_local_getDamage = &
+ 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
+
!--------------------------------------------------------------------------------------------------
!> @brief return array of constitutive results
!--------------------------------------------------------------------------------------------------
diff --git a/code/thermal_adiabatic.f90 b/code/thermal_adiabatic.f90
index 4fbc31110..7273f8bd2 100644
--- a/code/thermal_adiabatic.f90
+++ b/code/thermal_adiabatic.f90
@@ -42,6 +42,7 @@ module thermal_adiabatic
thermal_adiabatic_stateInit, &
thermal_adiabatic_aTolState, &
thermal_adiabatic_dotState, &
+ thermal_adiabatic_getTemperature, &
thermal_adiabatic_postResults
contains
@@ -279,6 +280,25 @@ subroutine thermal_adiabatic_dotState(Tstar_v, Lp, ipc, ip, el)
end subroutine thermal_adiabatic_dotState
+!--------------------------------------------------------------------------------------------------
+!> @brief returns temperature based on adiabatic thermal model state layout
+!--------------------------------------------------------------------------------------------------
+function thermal_adiabatic_getTemperature(ipc, ip, el)
+ use material, only: &
+ mappingConstitutive, &
+ thermalState
+
+ implicit none
+ integer(pInt), intent(in) :: &
+ ipc, & !< grain number
+ ip, & !< integration point number
+ el !< element number
+ real(pReal) :: thermal_adiabatic_getTemperature
+
+ thermal_adiabatic_getTemperature = &
+ thermalState(mappingConstitutive(2,ipc,ip,el))%state(1,mappingConstitutive(1,ipc,ip,el))
+
+end function thermal_adiabatic_getTemperature
!--------------------------------------------------------------------------------------------------
!> @brief return array of constitutive results
diff --git a/code/thermal_conduction.f90 b/code/thermal_conduction.f90
index c407c0b82..08d7508a0 100644
--- a/code/thermal_conduction.f90
+++ b/code/thermal_conduction.f90
@@ -42,6 +42,7 @@ module thermal_conduction
thermal_conduction_stateInit, &
thermal_conduction_aTolState, &
thermal_conduction_microstructure, &
+ thermal_conduction_getTemperature, &
thermal_conduction_postResults
contains
@@ -279,6 +280,25 @@ subroutine thermal_conduction_microstructure(Tstar_v, Lp, ipc, ip, el)
end subroutine thermal_conduction_microstructure
+!--------------------------------------------------------------------------------------------------
+!> @brief returns temperature based on conduction thermal model state layout
+!--------------------------------------------------------------------------------------------------
+function thermal_conduction_getTemperature(ipc, ip, el)
+ use material, only: &
+ mappingConstitutive, &
+ thermalState
+
+ implicit none
+ integer(pInt), intent(in) :: &
+ ipc, & !< grain number
+ ip, & !< integration point number
+ el !< element number
+ real(pReal) :: thermal_conduction_getTemperature
+
+ thermal_conduction_getTemperature = &
+ thermalState(mappingConstitutive(2,ipc,ip,el))%state(2,mappingConstitutive(1,ipc,ip,el))
+
+end function thermal_conduction_getTemperature
!--------------------------------------------------------------------------------------------------
!> @brief return array of constitutive results