consistent access pattern and naming

This commit is contained in:
Martin Diehl 2021-01-26 23:44:11 +01:00
parent 9292bc91ea
commit 69f6de0e4f
5 changed files with 51 additions and 72 deletions

View File

@ -225,13 +225,19 @@ module subroutine thermal_conduction_getSource(Tdot, ip,el)
real(pReal), intent(out) :: &
Tdot
integer :: &
homog
integer :: co, ho,ph,me
real(pReal) :: dot_T_temp
homog = material_homogenizationAt(el)
call constitutive_thermal_getRate(TDot, ip,el)
ho = material_homogenizationAt(el)
Tdot = 0.0_pReal
do co = 1, homogenization_Nconstituents(ho)
ph = material_phaseAt(co,el)
me = material_phasememberAt(co,ip,el)
call constitutive_thermal_getRate(dot_T_temp, ph,me)
Tdot = Tdot + dot_T_temp
enddo
Tdot = Tdot/real(homogenization_Nconstituents(homog),pReal)
Tdot = Tdot/real(homogenization_Nconstituents(ho),pReal)
end subroutine thermal_conduction_getSource

View File

@ -244,10 +244,8 @@ module phase
dPhiDot_dPhi
end subroutine constitutive_damage_getRateAndItsTangents
module subroutine constitutive_thermal_getRate(TDot, ip,el)
integer, intent(in) :: &
ip, & !< integration point number
el !< element number
module subroutine constitutive_thermal_getRate(TDot, ph,me)
integer, intent(in) :: ph, me
real(pReal), intent(out) :: &
TDot
end subroutine constitutive_thermal_getRate

View File

@ -44,13 +44,10 @@ submodule(phase) thermal
me
end subroutine externalheat_dotState
module subroutine thermal_dissipation_getRate(TDot, Tstar,Lp,phase)
module subroutine thermal_dissipation_getRate(TDot, ph,me)
integer, intent(in) :: &
phase !< phase ID of element
real(pReal), intent(in), dimension(3,3) :: &
Tstar !< 2nd Piola Kirchhoff stress tensor for a given element
real(pReal), intent(in), dimension(3,3) :: &
Lp !< plastic velocuty gradient for a given element
ph, &
me
real(pReal), intent(out) :: &
TDot
end subroutine thermal_dissipation_getRate
@ -135,33 +132,24 @@ end subroutine thermal_init
!----------------------------------------------------------------------------------------------
!< @brief calculates thermal dissipation rate
!----------------------------------------------------------------------------------------------
module subroutine constitutive_thermal_getRate(TDot, ip, el)
module subroutine constitutive_thermal_getRate(TDot, ph,me)
integer, intent(in) :: &
ip, & !< integration point number
el !< element number
integer, intent(in) :: ph, me
real(pReal), intent(out) :: &
TDot
real(pReal) :: &
my_Tdot
integer :: &
ph, &
homog, &
me, &
so, &
co
so
homog = material_homogenizationAt(el)
TDot = 0.0_pReal
do co = 1, homogenization_Nconstituents(homog)
ph = material_phaseAt(co,el)
me = material_phasememberAt(co,ip,el)
do so = 1, thermal_Nsources(ph)
select case(thermal_source(so,ph))
case (THERMAL_DISSIPATION_ID)
call thermal_dissipation_getRate(my_Tdot, mech_S(ph,me),mech_L_p(ph,me),ph)
call thermal_dissipation_getRate(my_Tdot, ph,me)
case (THERMAL_EXTERNALHEAT_ID)
call thermal_externalheat_getRate(my_Tdot, ph,me)
@ -171,7 +159,7 @@ module subroutine constitutive_thermal_getRate(TDot, ip, el)
end select
Tdot = Tdot + my_Tdot
enddo
enddo
end subroutine constitutive_thermal_getRate

View File

@ -6,10 +6,6 @@
!--------------------------------------------------------------------------------------------------
submodule(phase:thermal) dissipation
integer, dimension(:), allocatable :: &
source_thermal_dissipation_offset, & !< which source is my current thermal dissipation mechanism?
source_thermal_dissipation_instance !< instance of thermal dissipation source mechanism
type :: tParameters !< container type for internal constitutive parameters
real(pReal) :: &
kappa !< TAYLOR-QUINNEY factor
@ -35,7 +31,7 @@ module function dissipation_init(source_length) result(mySources)
phase, &
sources, thermal, &
src
integer :: Ninstances,sourceOffset,Nconstituents,p
integer :: Ninstances,so,Nconstituents,ph
print'(/,a)', ' <<<+- thermal_dissipation init -+>>>'
@ -46,25 +42,21 @@ module function dissipation_init(source_length) result(mySources)
if(Ninstances == 0) return
phases => config_material%get('phase')
allocate(param(Ninstances))
allocate(source_thermal_dissipation_offset (phases%length), source=0)
allocate(source_thermal_dissipation_instance(phases%length), source=0)
allocate(param(phases%length))
do p = 1, phases%length
phase => phases%get(p)
if(any(mySources(:,p))) source_thermal_dissipation_instance(p) = count(mySources(:,1:p))
if(count(mySources(:,p)) == 0) cycle
do ph = 1, phases%length
phase => phases%get(ph)
if(count(mySources(:,ph)) == 0) cycle !ToDo: error if > 1
thermal => phase%get('thermal')
sources => thermal%get('source')
do sourceOffset = 1, sources%length
if(mySources(sourceOffset,p)) then
source_thermal_dissipation_offset(p) = sourceOffset
associate(prm => param(source_thermal_dissipation_instance(p)))
src => sources%get(sourceOffset)
do so = 1, sources%length
if(mySources(so,ph)) then
associate(prm => param(ph))
src => sources%get(so)
prm%kappa = src%get_asFloat('kappa')
Nconstituents = count(material_phaseAt==p) * discretization_nIPs
call constitutive_allocateState(thermalState(p)%p(sourceOffset),Nconstituents,0,0,0)
prm%kappa = src%get_asFloat('kappa')
Nconstituents = count(material_phaseAt2 == ph)
call constitutive_allocateState(thermalState(ph)%p(so),Nconstituents,0,0,0)
end associate
endif
@ -78,20 +70,15 @@ end function dissipation_init
!--------------------------------------------------------------------------------------------------
!> @brief Ninstancess dissipation rate
!--------------------------------------------------------------------------------------------------
module subroutine thermal_dissipation_getRate(TDot, Tstar, Lp, phase)
integer, intent(in) :: &
phase
real(pReal), intent(in), dimension(3,3) :: &
Tstar
real(pReal), intent(in), dimension(3,3) :: &
Lp
module subroutine thermal_dissipation_getRate(TDot, ph,me)
integer, intent(in) :: ph, me
real(pReal), intent(out) :: &
TDot
associate(prm => param(source_thermal_dissipation_instance(phase)))
TDot = prm%kappa*sum(abs(Tstar*Lp))
associate(prm => param(ph))
TDot = prm%kappa*sum(abs(mech_S(ph,me)*mech_L_p(ph,me)))
end associate
end subroutine thermal_dissipation_getRate

View File

@ -39,7 +39,7 @@ module function externalheat_init(source_length) result(mySources)
phase, &
sources, thermal, &
src
integer :: Ninstances,sourceOffset,Nconstituents,p
integer :: Ninstances,so,Nconstituents,p
print'(/,a)', ' <<<+- thermal_externalheat init -+>>>'
@ -60,11 +60,11 @@ module function externalheat_init(source_length) result(mySources)
if(count(mySources(:,p)) == 0) cycle
thermal => phase%get('thermal')
sources => thermal%get('source')
do sourceOffset = 1, sources%length
if(mySources(sourceOffset,p)) then
source_thermal_externalheat_offset(p) = sourceOffset
do so = 1, sources%length
if(mySources(so,p)) then
source_thermal_externalheat_offset(p) = so
associate(prm => param(source_thermal_externalheat_instance(p)))
src => sources%get(sourceOffset)
src => sources%get(so)
prm%t_n = src%get_asFloats('t_n')
prm%nIntervals = size(prm%t_n) - 1
@ -72,7 +72,7 @@ module function externalheat_init(source_length) result(mySources)
prm%f_T = src%get_asFloats('f_T',requiredSize = size(prm%t_n))
Nconstituents = count(material_phaseAt==p) * discretization_nIPs
call constitutive_allocateState(thermalState(p)%p(sourceOffset),Nconstituents,1,1,0)
call constitutive_allocateState(thermalState(p)%p(so),Nconstituents,1,1,0)
end associate
endif
enddo
@ -92,11 +92,11 @@ module subroutine externalheat_dotState(ph, me)
me
integer :: &
sourceOffset
so
sourceOffset = source_thermal_externalheat_offset(ph)
so = source_thermal_externalheat_offset(ph)
thermalState(ph)%p(sourceOffset)%dotState(1,me) = 1.0_pReal ! state is current time
thermalState(ph)%p(so)%dotState(1,me) = 1.0_pReal ! state is current time
end subroutine externalheat_dotState
@ -113,15 +113,15 @@ module subroutine thermal_externalheat_getRate(TDot, ph, me)
TDot
integer :: &
sourceOffset, interval
so, interval
real(pReal) :: &
frac_time
sourceOffset = source_thermal_externalheat_offset(ph)
so = source_thermal_externalheat_offset(ph)
associate(prm => param(source_thermal_externalheat_instance(ph)))
do interval = 1, prm%nIntervals ! scan through all rate segments
frac_time = (thermalState(ph)%p(sourceOffset)%state(1,me) - prm%t_n(interval)) &
frac_time = (thermalState(ph)%p(so)%state(1,me) - prm%t_n(interval)) &
/ (prm%t_n(interval+1) - prm%t_n(interval)) ! fractional time within segment
if ( (frac_time < 0.0_pReal .and. interval == 1) &
.or. (frac_time >= 1.0_pReal .and. interval == prm%nIntervals) &