using new table functionality

This commit is contained in:
Martin Diehl 2022-12-07 21:55:20 +01:00
parent 06f8697bd1
commit 7b986f6f77
2 changed files with 6 additions and 22 deletions

View File

@ -9,6 +9,7 @@ module phase
use math use math
use rotations use rotations
use polynomials use polynomials
use tables
use IO use IO
use config use config
use material use material

View File

@ -11,11 +11,7 @@ submodule(phase:thermal) externalheat
source_thermal_externalheat_offset !< which source is my current thermal dissipation mechanism? source_thermal_externalheat_offset !< which source is my current thermal dissipation mechanism?
type :: tParameters !< container type for internal constitutive parameters type :: tParameters !< container type for internal constitutive parameters
real(pReal), dimension(:), allocatable :: & type(tTable) :: f
t_n, &
f_T
integer :: &
nIntervals
end type tParameters end type tParameters
type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstances) type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstances)
@ -64,10 +60,7 @@ module function externalheat_init(source_length) result(mySources)
associate(prm => param(ph)) associate(prm => param(ph))
src => sources%get_dict(so) src => sources%get_dict(so)
prm%t_n = src%get_as1dFloat('t_n') prm%f = table(src,'t_n','f_T')
prm%nIntervals = size(prm%t_n) - 1
prm%f_T = src%get_as1dFloat('f_T',requiredSize = size(prm%t_n))
Nmembers = count(material_phaseID == ph) Nmembers = count(material_phaseID == ph)
call phase_allocateState(thermalState(ph)%p(so),Nmembers,1,1,0) call phase_allocateState(thermalState(ph)%p(so),Nmembers,1,1,0)
@ -111,23 +104,13 @@ module function externalheat_f_T(ph,en) result(f_T)
f_T f_T
integer :: & integer :: &
so, interval so
real(pReal) :: &
frac_time
so = source_thermal_externalheat_offset(ph) so = source_thermal_externalheat_offset(ph)
associate(prm => param(ph)) associate(prm => param(ph))
do interval = 1, prm%nIntervals ! scan through all rate segments f_T = prm%f%at(thermalState(ph)%p(so)%state(1,en))
frac_time = (thermalState(ph)%p(so)%state(1,en) - 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) &
.or. (frac_time >= 0.0_pReal .and. frac_time < 1.0_pReal) ) &
f_T = prm%f_T(interval ) * (1.0_pReal - frac_time) + &
prm%f_T(interval+1) * frac_time ! interpolate heat rate between segment boundaries...
! ...or extrapolate if outside of bounds
end do
end associate end associate
end function externalheat_f_T end function externalheat_f_T