2020-07-15 18:05:21 +05:30
|
|
|
!----------------------------------------------------------------------------------------------------
|
2020-08-13 00:44:00 +05:30
|
|
|
!> @brief internal microstructure state for all thermal sources and kinematics constitutive models
|
2020-07-15 18:05:21 +05:30
|
|
|
!----------------------------------------------------------------------------------------------------
|
2021-01-27 01:22:48 +05:30
|
|
|
submodule(phase) thermal
|
2020-12-30 18:27:37 +05:30
|
|
|
|
2021-04-11 12:16:31 +05:30
|
|
|
type :: tThermalParameters
|
|
|
|
real(pReal) :: C_p = 0.0_pReal !< heat capacity
|
|
|
|
real(pReal), dimension(3,3) :: K = 0.0_pReal !< thermal conductivity
|
|
|
|
end type tThermalParameters
|
|
|
|
|
2021-02-13 23:11:30 +05:30
|
|
|
integer, dimension(:), allocatable :: &
|
|
|
|
thermal_Nsources
|
|
|
|
|
2021-02-13 12:25:32 +05:30
|
|
|
type(tSourceState), allocatable, dimension(:) :: &
|
|
|
|
thermalState
|
|
|
|
|
2021-01-08 04:20:06 +05:30
|
|
|
enum, bind(c); enumerator :: &
|
|
|
|
THERMAL_UNDEFINED_ID ,&
|
|
|
|
THERMAL_DISSIPATION_ID, &
|
|
|
|
THERMAL_EXTERNALHEAT_ID
|
|
|
|
end enum
|
|
|
|
|
2021-03-05 01:46:36 +05:30
|
|
|
type :: tDataContainer ! ?? not very telling name. Better: "fieldQuantities" ??
|
2021-01-24 15:46:17 +05:30
|
|
|
real(pReal), dimension(:), allocatable :: T, dot_T
|
2020-12-30 17:04:00 +05:30
|
|
|
end type tDataContainer
|
2021-01-24 15:46:17 +05:30
|
|
|
integer(kind(THERMAL_UNDEFINED_ID)), dimension(:,:), allocatable :: &
|
2021-01-08 02:45:18 +05:30
|
|
|
thermal_source
|
2020-12-30 18:27:37 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
type(tDataContainer), dimension(:), allocatable :: current ! ?? not very telling name. Better: "field" ?? MD: current(ho)%T(en) reads quite good
|
2020-07-09 04:31:08 +05:30
|
|
|
|
2021-04-11 12:16:31 +05:30
|
|
|
type(tThermalParameters), dimension(:), allocatable :: param
|
|
|
|
|
2021-01-08 02:45:18 +05:30
|
|
|
integer :: thermal_source_maxSizeDotState
|
2021-01-26 12:25:06 +05:30
|
|
|
|
|
|
|
|
2020-07-09 04:31:08 +05:30
|
|
|
interface
|
|
|
|
|
2021-01-26 12:25:06 +05:30
|
|
|
module function dissipation_init(source_length) result(mySources)
|
|
|
|
integer, intent(in) :: source_length
|
|
|
|
logical, dimension(:,:), allocatable :: mySources
|
|
|
|
end function dissipation_init
|
2020-12-30 14:24:06 +05:30
|
|
|
|
2021-01-26 12:25:06 +05:30
|
|
|
module function externalheat_init(source_length) result(mySources)
|
|
|
|
integer, intent(in) :: source_length
|
|
|
|
logical, dimension(:,:), allocatable :: mySources
|
|
|
|
end function externalheat_init
|
2020-08-13 00:44:00 +05:30
|
|
|
|
2021-01-27 04:36:41 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
module subroutine externalheat_dotState(ph, en)
|
2021-01-26 12:25:06 +05:30
|
|
|
integer, intent(in) :: &
|
|
|
|
ph, &
|
2021-04-25 11:36:52 +05:30
|
|
|
en
|
2021-01-26 12:25:06 +05:30
|
|
|
end subroutine externalheat_dotState
|
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
module function dissipation_f_T(ph,en) result(f_T)
|
2021-01-26 12:25:06 +05:30
|
|
|
integer, intent(in) :: &
|
2021-01-27 04:14:11 +05:30
|
|
|
ph, &
|
2021-04-25 11:36:52 +05:30
|
|
|
en
|
2021-04-08 02:11:49 +05:30
|
|
|
real(pReal) :: f_T
|
|
|
|
end function dissipation_f_T
|
2021-01-26 12:25:06 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
module function externalheat_f_T(ph,en) result(f_T)
|
2021-01-19 15:00:10 +05:30
|
|
|
integer, intent(in) :: &
|
2021-01-19 15:02:56 +05:30
|
|
|
ph, &
|
2021-04-25 11:36:52 +05:30
|
|
|
en
|
2021-04-08 02:11:49 +05:30
|
|
|
real(pReal) :: f_T
|
|
|
|
end function externalheat_f_T
|
2020-07-09 04:31:08 +05:30
|
|
|
|
|
|
|
end interface
|
2020-07-12 20:14:26 +05:30
|
|
|
|
2020-07-09 04:31:08 +05:30
|
|
|
contains
|
|
|
|
|
2020-07-12 20:14:26 +05:30
|
|
|
!----------------------------------------------------------------------------------------------
|
|
|
|
!< @brief initializes thermal sources and kinematics mechanism
|
|
|
|
!----------------------------------------------------------------------------------------------
|
2020-12-30 17:04:00 +05:30
|
|
|
module subroutine thermal_init(phases)
|
2020-12-30 18:27:37 +05:30
|
|
|
|
2020-12-30 17:04:00 +05:30
|
|
|
class(tNode), pointer :: &
|
|
|
|
phases
|
2020-12-30 18:27:37 +05:30
|
|
|
|
2021-01-08 02:45:18 +05:30
|
|
|
class(tNode), pointer :: &
|
|
|
|
phase, thermal, sources
|
|
|
|
|
2020-12-30 17:04:00 +05:30
|
|
|
integer :: &
|
2021-01-08 02:45:18 +05:30
|
|
|
ph, so, &
|
2021-03-05 01:46:36 +05:30
|
|
|
Nmembers
|
2020-12-30 17:04:00 +05:30
|
|
|
|
|
|
|
|
2021-01-27 15:14:03 +05:30
|
|
|
print'(/,a)', ' <<<+- phase:thermal init -+>>>'
|
2020-12-30 17:04:00 +05:30
|
|
|
|
|
|
|
allocate(current(phases%length))
|
|
|
|
|
2021-03-05 01:46:36 +05:30
|
|
|
allocate(thermalState(phases%length))
|
2021-01-08 02:45:18 +05:30
|
|
|
allocate(thermal_Nsources(phases%length),source = 0)
|
2021-04-11 12:16:31 +05:30
|
|
|
allocate(param(phases%length))
|
2020-07-09 04:31:08 +05:30
|
|
|
|
2020-12-30 17:04:00 +05:30
|
|
|
do ph = 1, phases%length
|
2021-04-06 15:08:44 +05:30
|
|
|
Nmembers = count(material_phaseID == ph)
|
2021-03-05 01:46:36 +05:30
|
|
|
allocate(current(ph)%T(Nmembers),source=300.0_pReal)
|
|
|
|
allocate(current(ph)%dot_T(Nmembers),source=0.0_pReal)
|
2021-01-08 02:45:18 +05:30
|
|
|
phase => phases%get(ph)
|
2021-03-05 01:46:36 +05:30
|
|
|
thermal => phase%get('thermal',defaultVal=emptyDict)
|
2021-05-24 20:50:33 +05:30
|
|
|
param(ph)%C_p = thermal%get_asFloat('C_p',defaultVal=0.0_pReal)
|
2021-05-24 13:32:28 +05:30
|
|
|
param(ph)%K(1,1) = thermal%get_asFloat('K_11',defaultVal=0.0_pReal) ! ToDo: make mandatory?
|
|
|
|
param(ph)%K(3,3) = thermal%get_asFloat('K_33',defaultVal=0.0_pReal) ! ToDo: depends on symmtery
|
2021-04-11 17:25:30 +05:30
|
|
|
param(ph)%K = lattice_applyLatticeSymmetry33(param(ph)%K,phase%get_asString('lattice'))
|
|
|
|
|
|
|
|
sources => thermal%get('source',defaultVal=emptyList)
|
2021-03-05 01:46:36 +05:30
|
|
|
thermal_Nsources(ph) = sources%length
|
2021-01-08 02:45:18 +05:30
|
|
|
allocate(thermalstate(ph)%p(thermal_Nsources(ph)))
|
2021-04-11 17:25:30 +05:30
|
|
|
|
2020-12-30 17:04:00 +05:30
|
|
|
enddo
|
2020-12-30 18:27:37 +05:30
|
|
|
|
2021-01-08 04:20:06 +05:30
|
|
|
allocate(thermal_source(maxval(thermal_Nsources),phases%length), source = THERMAL_UNDEFINED_ID)
|
2021-01-08 02:45:18 +05:30
|
|
|
|
2021-03-05 01:46:36 +05:30
|
|
|
if (maxval(thermal_Nsources) /= 0) then
|
2021-01-26 12:25:06 +05:30
|
|
|
where(dissipation_init (maxval(thermal_Nsources))) thermal_source = THERMAL_DISSIPATION_ID
|
|
|
|
where(externalheat_init(maxval(thermal_Nsources))) thermal_source = THERMAL_EXTERNALHEAT_ID
|
2020-12-30 14:24:06 +05:30
|
|
|
endif
|
|
|
|
|
2021-01-08 02:45:18 +05:30
|
|
|
thermal_source_maxSizeDotState = 0
|
2021-03-05 01:46:36 +05:30
|
|
|
do ph = 1,phases%length
|
2021-01-08 02:45:18 +05:30
|
|
|
|
|
|
|
do so = 1,thermal_Nsources(ph)
|
2021-01-25 18:33:49 +05:30
|
|
|
thermalState(ph)%p(so)%state = thermalState(ph)%p(so)%state0
|
2021-01-08 02:45:18 +05:30
|
|
|
enddo
|
|
|
|
|
2021-01-25 18:33:49 +05:30
|
|
|
thermal_source_maxSizeDotState = max(thermal_source_maxSizeDotState, &
|
|
|
|
maxval(thermalState(ph)%p%sizeDotState))
|
2021-03-05 01:46:36 +05:30
|
|
|
enddo
|
2021-01-08 02:45:18 +05:30
|
|
|
|
2020-07-09 04:31:08 +05:30
|
|
|
end subroutine thermal_init
|
|
|
|
|
|
|
|
|
2020-07-12 20:14:26 +05:30
|
|
|
!----------------------------------------------------------------------------------------------
|
|
|
|
!< @brief calculates thermal dissipation rate
|
|
|
|
!----------------------------------------------------------------------------------------------
|
2021-04-25 11:36:52 +05:30
|
|
|
module function phase_f_T(ph,en) result(f)
|
2020-12-29 11:50:37 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
integer, intent(in) :: ph, en
|
2021-04-09 03:10:20 +05:30
|
|
|
real(pReal) :: f
|
2020-07-09 04:31:08 +05:30
|
|
|
|
2021-04-08 02:11:49 +05:30
|
|
|
|
|
|
|
integer :: so
|
2020-08-13 00:44:00 +05:30
|
|
|
|
|
|
|
|
2021-04-09 03:10:20 +05:30
|
|
|
f = 0.0_pReal
|
2021-01-27 04:14:11 +05:30
|
|
|
|
2021-01-27 04:26:20 +05:30
|
|
|
do so = 1, thermal_Nsources(ph)
|
|
|
|
select case(thermal_source(so,ph))
|
2021-04-08 02:11:49 +05:30
|
|
|
|
2021-01-27 04:26:20 +05:30
|
|
|
case (THERMAL_DISSIPATION_ID)
|
2021-04-25 11:36:52 +05:30
|
|
|
f = f + dissipation_f_T(ph,en)
|
2020-08-13 00:44:00 +05:30
|
|
|
|
2021-01-27 04:26:20 +05:30
|
|
|
case (THERMAL_EXTERNALHEAT_ID)
|
2021-04-25 11:36:52 +05:30
|
|
|
f = f + externalheat_f_T(ph,en)
|
2020-08-13 00:44:00 +05:30
|
|
|
|
2021-01-27 04:26:20 +05:30
|
|
|
end select
|
2021-04-08 02:11:49 +05:30
|
|
|
|
2021-01-27 04:26:20 +05:30
|
|
|
enddo
|
2021-01-27 04:14:11 +05:30
|
|
|
|
2021-04-08 02:11:49 +05:30
|
|
|
end function phase_f_T
|
2020-07-09 04:31:08 +05:30
|
|
|
|
2020-07-15 18:05:21 +05:30
|
|
|
|
2021-01-08 02:45:18 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief contains the constitutive equation for calculating the rate of change of microstructure
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-25 11:36:52 +05:30
|
|
|
function phase_thermal_collectDotState(ph,en) result(broken)
|
2021-01-08 02:45:18 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
integer, intent(in) :: ph, en
|
2021-01-08 02:45:18 +05:30
|
|
|
logical :: broken
|
|
|
|
|
|
|
|
integer :: i
|
|
|
|
|
|
|
|
|
|
|
|
broken = .false.
|
|
|
|
|
|
|
|
SourceLoop: do i = 1, thermal_Nsources(ph)
|
|
|
|
|
2021-01-08 04:20:06 +05:30
|
|
|
if (thermal_source(i,ph) == THERMAL_EXTERNALHEAT_ID) &
|
2021-04-25 11:36:52 +05:30
|
|
|
call externalheat_dotState(ph,en)
|
2021-01-08 02:45:18 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
broken = broken .or. any(IEEE_is_NaN(thermalState(ph)%p(i)%dotState(:,en)))
|
2021-01-08 02:45:18 +05:30
|
|
|
|
|
|
|
enddo SourceLoop
|
|
|
|
|
2021-02-09 03:51:53 +05:30
|
|
|
end function phase_thermal_collectDotState
|
2021-01-08 02:45:18 +05:30
|
|
|
|
|
|
|
|
2021-04-11 16:51:27 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-15 15:37:33 +05:30
|
|
|
!> @brief Thermal viscosity.
|
2021-04-11 16:51:27 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module function phase_mu_T(co,ce) result(mu)
|
|
|
|
|
|
|
|
integer, intent(in) :: co, ce
|
|
|
|
real(pReal) :: mu
|
|
|
|
|
|
|
|
|
2021-04-11 17:25:30 +05:30
|
|
|
mu = lattice_rho(material_phaseID(co,ce)) &
|
|
|
|
* param(material_phaseID(co,ce))%C_p
|
2021-04-11 16:51:27 +05:30
|
|
|
|
|
|
|
end function phase_mu_T
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-15 15:37:33 +05:30
|
|
|
!> @brief Thermal conductivity/diffusivity in reference configuration.
|
2021-04-11 16:51:27 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module function phase_K_T(co,ce) result(K)
|
|
|
|
|
|
|
|
integer, intent(in) :: co, ce
|
|
|
|
real(pReal), dimension(3,3) :: K
|
|
|
|
|
|
|
|
|
2021-04-11 17:25:30 +05:30
|
|
|
K = crystallite_push33ToRef(co,ce,param(material_phaseID(co,ce))%K)
|
2021-04-11 16:51:27 +05:30
|
|
|
|
|
|
|
end function phase_K_T
|
|
|
|
|
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
module function thermal_stress(Delta_t,ph,en) result(converged_) ! ?? why is this called "stress" when it seems closer to "updateState" ??
|
2021-01-17 14:00:42 +05:30
|
|
|
|
|
|
|
real(pReal), intent(in) :: Delta_t
|
2021-04-25 11:36:52 +05:30
|
|
|
integer, intent(in) :: ph, en
|
2021-01-17 14:00:42 +05:30
|
|
|
logical :: converged_
|
|
|
|
|
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
converged_ = .not. integrateThermalState(Delta_t,ph,en)
|
2021-01-17 14:00:42 +05:30
|
|
|
|
|
|
|
end function thermal_stress
|
|
|
|
|
2021-01-08 05:10:21 +05:30
|
|
|
|
2021-01-08 02:45:18 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-01-08 05:10:21 +05:30
|
|
|
!> @brief integrate state with 1st order explicit Euler method
|
2021-01-08 02:45:18 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-25 11:36:52 +05:30
|
|
|
function integrateThermalState(Delta_t, ph,en) result(broken)
|
2021-01-08 02:45:18 +05:30
|
|
|
|
2021-01-08 05:10:21 +05:30
|
|
|
real(pReal), intent(in) :: Delta_t
|
2021-04-25 11:36:52 +05:30
|
|
|
integer, intent(in) :: ph, en
|
2021-01-08 05:10:21 +05:30
|
|
|
logical :: &
|
|
|
|
broken
|
2021-01-08 02:45:18 +05:30
|
|
|
|
|
|
|
integer :: &
|
2021-01-08 05:10:21 +05:30
|
|
|
so, &
|
|
|
|
sizeDotState
|
2021-01-08 02:45:18 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
broken = phase_thermal_collectDotState(ph,en)
|
2021-03-05 01:46:36 +05:30
|
|
|
if (broken) return
|
2021-01-08 02:45:18 +05:30
|
|
|
|
|
|
|
do so = 1, thermal_Nsources(ph)
|
2021-01-08 05:10:21 +05:30
|
|
|
sizeDotState = thermalState(ph)%p(so)%sizeDotState
|
2021-04-25 11:36:52 +05:30
|
|
|
thermalState(ph)%p(so)%state(1:sizeDotState,en) = thermalState(ph)%p(so)%state0(1:sizeDotState,en) &
|
|
|
|
+ thermalState(ph)%p(so)%dotState(1:sizeDotState,en) * Delta_t
|
2021-01-08 02:45:18 +05:30
|
|
|
enddo
|
|
|
|
|
|
|
|
end function integrateThermalState
|
|
|
|
|
|
|
|
|
2020-12-31 14:24:13 +05:30
|
|
|
module subroutine thermal_forward()
|
|
|
|
|
|
|
|
integer :: ph, so
|
|
|
|
|
|
|
|
|
|
|
|
do ph = 1, size(thermalState)
|
2021-01-08 02:45:18 +05:30
|
|
|
do so = 1, size(thermalState(ph)%p)
|
2020-12-31 14:24:13 +05:30
|
|
|
thermalState(ph)%p(so)%state0 = thermalState(ph)%p(so)%state
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
end subroutine thermal_forward
|
|
|
|
|
|
|
|
|
2020-12-30 18:27:37 +05:30
|
|
|
!----------------------------------------------------------------------------------------------
|
|
|
|
!< @brief Get temperature (for use by non-thermal physics)
|
|
|
|
!----------------------------------------------------------------------------------------------
|
2021-04-25 11:36:52 +05:30
|
|
|
module function thermal_T(ph,en) result(T)
|
2020-12-30 14:24:06 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
integer, intent(in) :: ph, en
|
2020-12-30 14:24:06 +05:30
|
|
|
real(pReal) :: T
|
|
|
|
|
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
T = current(ph)%T(en)
|
2020-12-30 14:24:06 +05:30
|
|
|
|
2020-12-30 17:04:00 +05:30
|
|
|
end function thermal_T
|
2020-12-30 14:24:06 +05:30
|
|
|
|
|
|
|
|
2021-01-27 04:36:41 +05:30
|
|
|
!----------------------------------------------------------------------------------------------
|
|
|
|
!< @brief Get rate of temperature (for use by non-thermal physics)
|
|
|
|
!----------------------------------------------------------------------------------------------
|
2021-04-25 11:36:52 +05:30
|
|
|
module function thermal_dot_T(ph,en) result(dot_T)
|
2021-01-27 04:36:41 +05:30
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
integer, intent(in) :: ph, en
|
2021-01-27 04:36:41 +05:30
|
|
|
real(pReal) :: dot_T
|
|
|
|
|
|
|
|
|
2021-04-25 11:36:52 +05:30
|
|
|
dot_T = current(ph)%dot_T(en)
|
2021-01-27 04:36:41 +05:30
|
|
|
|
|
|
|
end function thermal_dot_T
|
|
|
|
|
|
|
|
|
2020-12-30 18:27:37 +05:30
|
|
|
!----------------------------------------------------------------------------------------------
|
|
|
|
!< @brief Set temperature
|
|
|
|
!----------------------------------------------------------------------------------------------
|
2021-02-09 03:51:53 +05:30
|
|
|
module subroutine phase_thermal_setField(T,dot_T, co,ce)
|
2020-12-30 18:27:37 +05:30
|
|
|
|
2021-01-24 17:56:01 +05:30
|
|
|
real(pReal), intent(in) :: T, dot_T
|
2021-01-17 19:22:52 +05:30
|
|
|
integer, intent(in) :: ce, co
|
2020-12-30 18:27:37 +05:30
|
|
|
|
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
current(material_phaseID(co,ce))%T(material_phaseEntry(co,ce)) = T
|
|
|
|
current(material_phaseID(co,ce))%dot_T(material_phaseEntry(co,ce)) = dot_T
|
2020-12-30 18:27:37 +05:30
|
|
|
|
2021-02-09 03:51:53 +05:30
|
|
|
end subroutine phase_thermal_setField
|
2020-12-30 16:30:47 +05:30
|
|
|
|
|
|
|
|
2021-01-08 02:45:18 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief checks if a source mechanism is active or not
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
function thermal_active(source_label,src_length) result(active_source)
|
|
|
|
|
|
|
|
character(len=*), intent(in) :: source_label !< name of source mechanism
|
|
|
|
integer, intent(in) :: src_length !< max. number of sources in system
|
|
|
|
logical, dimension(:,:), allocatable :: active_source
|
|
|
|
|
|
|
|
class(tNode), pointer :: &
|
|
|
|
phases, &
|
|
|
|
phase, &
|
|
|
|
sources, thermal, &
|
|
|
|
src
|
|
|
|
integer :: p,s
|
|
|
|
|
|
|
|
phases => config_material%get('phase')
|
|
|
|
allocate(active_source(src_length,phases%length), source = .false. )
|
|
|
|
do p = 1, phases%length
|
|
|
|
phase => phases%get(p)
|
2021-03-05 01:46:36 +05:30
|
|
|
thermal => phase%get('thermal',defaultVal=emptyDict)
|
|
|
|
sources => thermal%get('source',defaultVal=emptyList)
|
|
|
|
do s = 1, sources%length
|
|
|
|
src => sources%get(s)
|
|
|
|
active_source(s,p) = src%get_asString('type') == source_label
|
|
|
|
enddo
|
2021-01-08 02:45:18 +05:30
|
|
|
enddo
|
|
|
|
|
|
|
|
|
|
|
|
end function thermal_active
|
|
|
|
|
|
|
|
|
2021-01-26 05:50:45 +05:30
|
|
|
end submodule thermal
|