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
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module source_thermal_externalheat
|
2019-05-28 15:36:21 +05:30
|
|
|
use prec
|
|
|
|
use debug
|
2019-06-14 13:35:39 +05:30
|
|
|
use discretization
|
2019-05-28 15:36:21 +05:30
|
|
|
use material
|
|
|
|
use config
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-02-23 01:07:41 +05:30
|
|
|
implicit none
|
|
|
|
private
|
2019-05-28 15:36:21 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
integer, dimension(:), allocatable, public, protected :: &
|
2019-02-23 01:07:41 +05:30
|
|
|
source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism?
|
|
|
|
source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
integer, dimension(:,:), allocatable, target, public :: &
|
2019-02-23 01:07:41 +05:30
|
|
|
source_thermal_externalheat_sizePostResult !< size of each post result output
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
character(len=64), dimension(:,:), allocatable, target, public :: &
|
2019-02-23 01:07:41 +05:30
|
|
|
source_thermal_externalheat_output !< name of each post result output
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
integer, dimension(:), allocatable, target, public :: &
|
2019-02-23 01:07:41 +05:30
|
|
|
source_thermal_externalheat_Noutput !< number of outputs per instance of this source
|
2018-12-31 01:28:38 +05:30
|
|
|
|
2019-05-28 15:36:21 +05:30
|
|
|
type :: tParameters !< container type for internal constitutive parameters
|
2019-02-23 01:07:41 +05:30
|
|
|
real(pReal), dimension(:), allocatable :: &
|
|
|
|
time, &
|
|
|
|
heat_rate
|
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
|
|
|
|
|
|
|
|
2019-02-23 01:07:41 +05:30
|
|
|
public :: &
|
|
|
|
source_thermal_externalheat_init, &
|
|
|
|
source_thermal_externalheat_dotState, &
|
|
|
|
source_thermal_externalheat_getRateAndItsTangent
|
2015-07-27 16:39:37 +05:30
|
|
|
|
|
|
|
contains
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief module initialization
|
|
|
|
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-02-23 01:07:41 +05:30
|
|
|
subroutine source_thermal_externalheat_init
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
integer :: maxNinstance,instance,source,sourceOffset,NofMyPhase,p
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-02-23 01:07:41 +05:30
|
|
|
write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_externalheat_label//' init -+>>>'
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-02-23 01:07:41 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
maxNinstance = count(phase_source == SOURCE_thermal_externalheat_ID)
|
|
|
|
if (maxNinstance == 0) return
|
|
|
|
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0) &
|
2019-02-23 01:07:41 +05:30
|
|
|
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
|
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
allocate(source_thermal_externalheat_offset(material_Nphase), source=0)
|
|
|
|
allocate(source_thermal_externalheat_instance(material_Nphase), source=0)
|
2019-02-23 01:07:41 +05:30
|
|
|
|
|
|
|
do p = 1, material_Nphase
|
|
|
|
source_thermal_externalheat_instance(p) = count(phase_source(:,1:p) == SOURCE_thermal_externalheat_ID)
|
|
|
|
do source = 1, phase_Nsources(p)
|
|
|
|
if (phase_source(source,p) == SOURCE_thermal_externalheat_ID) &
|
|
|
|
source_thermal_externalheat_offset(p) = source
|
|
|
|
enddo
|
|
|
|
enddo
|
2019-02-22 19:51:48 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
allocate(source_thermal_externalheat_sizePostResult(maxval(phase_Noutput),maxNinstance),source=0)
|
2019-02-23 01:07:41 +05:30
|
|
|
allocate(source_thermal_externalheat_output (maxval(phase_Noutput),maxNinstance))
|
|
|
|
source_thermal_externalheat_output = ''
|
2019-03-24 15:48:59 +05:30
|
|
|
allocate(source_thermal_externalheat_Noutput(maxNinstance), source=0)
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-02-23 01:07:41 +05:30
|
|
|
allocate(param(maxNinstance))
|
|
|
|
|
|
|
|
do p=1, size(config_phase)
|
|
|
|
if (all(phase_source(:,p) /= SOURCE_thermal_externalheat_ID)) cycle
|
|
|
|
instance = source_thermal_externalheat_instance(p)
|
|
|
|
sourceOffset = source_thermal_externalheat_offset(p)
|
2019-06-14 13:35:39 +05:30
|
|
|
NofMyPhase = count(material_phaseAt==p) * discretization_nIP
|
2019-02-23 01:07:41 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
param(instance)%time = config_phase(p)%getFloats('externalheat_time')
|
|
|
|
param(instance)%nIntervals = size(param(instance)%time) - 1
|
2019-02-23 01:07:41 +05:30
|
|
|
|
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
param(instance)%heat_rate = config_phase(p)%getFloats('externalheat_rate',requiredSize = size(param(instance)%time))
|
2019-02-23 01:07:41 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
call material_allocateSourceState(p,sourceOffset,NofMyPhase,1,1,0)
|
2019-02-23 01:07:41 +05:30
|
|
|
|
|
|
|
enddo
|
|
|
|
|
2015-07-27 16:39:37 +05:30
|
|
|
end subroutine source_thermal_externalheat_init
|
|
|
|
|
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
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-03-24 15:48:59 +05:30
|
|
|
subroutine source_thermal_externalheat_dotState(phase, of)
|
|
|
|
|
|
|
|
integer, intent(in) :: &
|
|
|
|
phase, &
|
|
|
|
of
|
|
|
|
integer :: &
|
|
|
|
sourceOffset
|
2015-07-27 16:39:37 +05:30
|
|
|
|
2019-03-24 15:48:59 +05:30
|
|
|
sourceOffset = source_thermal_externalheat_offset(phase)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2016-10-19 01:53:52 +05:30
|
|
|
!> @brief returns local heat generation rate
|
2015-07-27 16:39:37 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2019-03-24 15:48:59 +05:30
|
|
|
subroutine source_thermal_externalheat_getRateAndItsTangent(TDot, dTDot_dT, phase, of)
|
|
|
|
|
|
|
|
integer, intent(in) :: &
|
|
|
|
phase, &
|
|
|
|
of
|
|
|
|
real(pReal), intent(out) :: &
|
|
|
|
TDot, &
|
|
|
|
dTDot_dT
|
|
|
|
integer :: &
|
|
|
|
instance, sourceOffset, interval
|
|
|
|
real(pReal) :: &
|
|
|
|
frac_time
|
|
|
|
|
|
|
|
instance = source_thermal_externalheat_instance(phase)
|
|
|
|
sourceOffset = source_thermal_externalheat_offset(phase)
|
|
|
|
|
|
|
|
do interval = 1, param(instance)%nIntervals ! scan through all rate segments
|
|
|
|
frac_time = (sourceState(phase)%p(sourceOffset)%state(1,of) - &
|
|
|
|
param(instance)%time(interval)) / &
|
|
|
|
(param(instance)%time(interval+1) - &
|
|
|
|
param(instance)%time(interval)) ! fractional time within segment
|
|
|
|
if ( (frac_time < 0.0_pReal .and. interval == 1) &
|
|
|
|
.or. (frac_time >= 1.0_pReal .and. interval == param(instance)%nIntervals) &
|
|
|
|
.or. (frac_time >= 0.0_pReal .and. frac_time < 1.0_pReal) ) &
|
|
|
|
TDot = param(instance)%heat_rate(interval ) * (1.0_pReal - frac_time) + &
|
|
|
|
param(instance)%heat_rate(interval+1) * frac_time ! interpolate heat rate between segment boundaries...
|
2016-10-19 01:53:52 +05:30
|
|
|
! ...or extrapolate if outside of bounds
|
2019-03-24 15:48:59 +05:30
|
|
|
enddo
|
|
|
|
dTDot_dT = 0.0
|
2015-07-27 16:39:37 +05:30
|
|
|
|
|
|
|
end subroutine source_thermal_externalheat_getRateAndItsTangent
|
|
|
|
|
|
|
|
end module source_thermal_externalheat
|