2015-07-27 16:39:37 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-23 01:07:41 +05:30
|
|
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
2015-07-27 16:39:37 +05:30
|
|
|
!> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH
|
2016-10-19 01:53:52 +05:30
|
|
|
!> @author Philip Eisenlohr, Michigan State University
|
|
|
|
!> @brief material subroutine for variable heat source
|
2015-07-27 16:39:37 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2020-07-09 04:31:08 +05:30
|
|
|
submodule(constitutive:constitutive_thermal) source_thermal_externalheat
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
|
2019-12-21 12:25:42 +05:30
|
|
|
integer, dimension(:), allocatable :: &
|
2019-12-05 15:50:05 +05:30
|
|
|
source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism?
|
|
|
|
source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism
|
2018-12-31 01:28:38 +05:30
|
|
|
|
2020-08-15 19:32:10 +05:30
|
|
|
type :: tParameters !< container type for internal constitutive parameters
|
2019-02-23 01:07:41 +05:30
|
|
|
real(pReal), dimension(:), allocatable :: &
|
2020-09-23 04:38:13 +05:30
|
|
|
t_n, &
|
|
|
|
f_T
|
2019-03-24 15:48:59 +05:30
|
|
|
integer :: &
|
2019-02-23 01:07:41 +05:30
|
|
|
nIntervals
|
|
|
|
end type tParameters
|
2018-12-31 01:28:38 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
type(tParameters), dimension(:), allocatable :: param !< containers of constitutive parameters (len Ninstance)
|
2018-12-31 01:28:38 +05:30
|
|
|
|
|
|
|
|
2015-07-27 16:39:37 +05:30
|
|
|
contains
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief module initialization
|
|
|
|
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2020-08-15 19:32:10 +05:30
|
|
|
module function source_thermal_externalheat_init(source_length) result(mySources)
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-08-15 19:32:10 +05:30
|
|
|
integer, intent(in) :: source_length
|
|
|
|
logical, dimension(:,:), allocatable :: mySources
|
|
|
|
|
|
|
|
class(tNode), pointer :: &
|
|
|
|
phases, &
|
|
|
|
phase, &
|
|
|
|
sources, &
|
|
|
|
src
|
2020-03-16 22:59:15 +05:30
|
|
|
integer :: Ninstance,sourceOffset,NipcMyPhase,p
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-09-18 02:27:56 +05:30
|
|
|
print'(/,a)', ' <<<+- source_thermal_externalHeat init -+>>>'
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-08-15 19:32:10 +05:30
|
|
|
mySources = source_active('thermal_externalheat',source_length)
|
|
|
|
Ninstance = count(mySources)
|
2020-09-22 16:39:12 +05:30
|
|
|
print'(a,i2)', ' # instances: ',Ninstance; flush(IO_STDOUT)
|
2020-08-15 19:32:10 +05:30
|
|
|
if(Ninstance == 0) return
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-09-13 14:09:17 +05:30
|
|
|
phases => config_material%get('phase')
|
2020-02-26 23:07:17 +05:30
|
|
|
allocate(param(Ninstance))
|
2020-08-15 19:32:10 +05:30
|
|
|
allocate(source_thermal_externalheat_offset (phases%length), source=0)
|
|
|
|
allocate(source_thermal_externalheat_instance(phases%length), source=0)
|
|
|
|
|
|
|
|
do p = 1, phases%length
|
|
|
|
phase => phases%get(p)
|
|
|
|
if(any(mySources(:,p))) source_thermal_externalheat_instance(p) = count(mySources(:,1:p))
|
|
|
|
if(count(mySources(:,p)) == 0) cycle
|
|
|
|
sources => phase%get('source')
|
|
|
|
do sourceOffset = 1, sources%length
|
|
|
|
if(mySources(sourceOffset,p)) then
|
2020-02-29 12:33:06 +05:30
|
|
|
source_thermal_externalheat_offset(p) = sourceOffset
|
2020-08-15 19:32:10 +05:30
|
|
|
associate(prm => param(source_thermal_externalheat_instance(p)))
|
|
|
|
src => sources%get(sourceOffset)
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-09-23 04:38:13 +05:30
|
|
|
prm%t_n = src%get_asFloats('t_n')
|
|
|
|
prm%nIntervals = size(prm%t_n) - 1
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-09-23 04:38:13 +05:30
|
|
|
prm%f_T = src%get_asFloats('f_T',requiredSize = size(prm%t_n))
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-10-28 01:57:26 +05:30
|
|
|
NipcMyPhase = count(material_phaseAt==p) * discretization_nIPs
|
2020-08-15 19:32:10 +05:30
|
|
|
call constitutive_allocateState(sourceState(p)%p(sourceOffset),NipcMyPhase,1,1,0)
|
|
|
|
end associate
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-08-15 19:32:10 +05:30
|
|
|
endif
|
|
|
|
enddo
|
2019-02-23 01:07:41 +05:30
|
|
|
enddo
|
|
|
|
|
2020-08-15 19:32:10 +05:30
|
|
|
end function source_thermal_externalheat_init
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-02-22 19:51:48 +05:30
|
|
|
|
2015-07-27 16:39:37 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2016-10-19 01:53:52 +05:30
|
|
|
!> @brief rate of change of state
|
|
|
|
!> @details state only contains current time to linearly interpolate given heat powers
|
2015-07-27 16:39:37 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2020-07-09 04:31:08 +05:30
|
|
|
module subroutine source_thermal_externalheat_dotState(phase, of)
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
integer, intent(in) :: &
|
|
|
|
phase, &
|
|
|
|
of
|
2020-02-29 12:28:33 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
integer :: &
|
|
|
|
sourceOffset
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
sourceOffset = source_thermal_externalheat_offset(phase)
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
sourceState(phase)%p(sourceOffset)%dotState(1,of) = 1.0_pReal ! state is current time
|
2015-07-27 16:39:37 +05:30
|
|
|
|
|
|
|
end subroutine source_thermal_externalheat_dotState
|
|
|
|
|
2019-12-05 15:50:05 +05:30
|
|
|
|
2015-07-27 16:39:37 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2020-02-26 23:07:17 +05:30
|
|
|
!> @brief returns local heat generation rate
|
2015-07-27 16:39:37 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2020-07-09 04:31:08 +05:30
|
|
|
module subroutine source_thermal_externalheat_getRateAndItsTangent(TDot, dTDot_dT, phase, of)
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
integer, intent(in) :: &
|
|
|
|
phase, &
|
|
|
|
of
|
|
|
|
real(pReal), intent(out) :: &
|
|
|
|
TDot, &
|
|
|
|
dTDot_dT
|
2020-02-29 12:28:33 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
integer :: &
|
2020-02-29 12:28:33 +05:30
|
|
|
sourceOffset, interval
|
2019-03-24 15:48:59 +05:30
|
|
|
real(pReal) :: &
|
2020-02-26 23:07:17 +05:30
|
|
|
frac_time
|
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
sourceOffset = source_thermal_externalheat_offset(phase)
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-02-29 12:28:33 +05:30
|
|
|
associate(prm => param(source_thermal_externalheat_instance(phase)))
|
2020-02-29 19:04:19 +05:30
|
|
|
do interval = 1, prm%nIntervals ! scan through all rate segments
|
2020-09-23 04:38:13 +05:30
|
|
|
frac_time = (sourceState(phase)%p(sourceOffset)%state(1,of) - prm%t_n(interval)) &
|
|
|
|
/ (prm%t_n(interval+1) - prm%t_n(interval)) ! fractional time within segment
|
2019-03-24 15:48:59 +05:30
|
|
|
if ( (frac_time < 0.0_pReal .and. interval == 1) &
|
2020-02-29 12:28:33 +05:30
|
|
|
.or. (frac_time >= 1.0_pReal .and. interval == prm%nIntervals) &
|
2019-03-24 15:48:59 +05:30
|
|
|
.or. (frac_time >= 0.0_pReal .and. frac_time < 1.0_pReal) ) &
|
2020-09-23 04:38:13 +05:30
|
|
|
TDot = prm%f_T(interval ) * (1.0_pReal - frac_time) + &
|
|
|
|
prm%f_T(interval+1) * frac_time ! interpolate heat rate between segment boundaries...
|
2020-02-29 19:04:19 +05:30
|
|
|
! ...or extrapolate if outside of bounds
|
2019-03-24 15:48:59 +05:30
|
|
|
enddo
|
|
|
|
dTDot_dT = 0.0
|
2020-02-29 12:28:33 +05:30
|
|
|
end associate
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2015-07-27 16:39:37 +05:30
|
|
|
end subroutine source_thermal_externalheat_getRateAndItsTangent
|
2020-02-26 23:07:17 +05:30
|
|
|
|
2020-07-09 04:31:08 +05:30
|
|
|
end submodule source_thermal_externalheat
|