2020-12-30 16:30:47 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @author Martin Diehl, KU Leuven
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-01-26 05:50:45 +05:30
|
|
|
submodule(homogenization) thermal
|
2020-12-30 16:30:47 +05:30
|
|
|
|
2021-04-06 15:25:30 +05:30
|
|
|
interface
|
|
|
|
|
|
|
|
module subroutine pass_init
|
|
|
|
end subroutine pass_init
|
|
|
|
|
2021-04-06 19:23:06 +05:30
|
|
|
module subroutine isotemperature_init
|
|
|
|
end subroutine isotemperature_init
|
2021-04-06 15:25:30 +05:30
|
|
|
|
|
|
|
end interface
|
|
|
|
|
2021-01-24 16:45:18 +05:30
|
|
|
type :: tDataContainer
|
|
|
|
real(pReal), dimension(:), allocatable :: T, dot_T
|
|
|
|
end type tDataContainer
|
|
|
|
|
|
|
|
type(tDataContainer), dimension(:), allocatable :: current
|
|
|
|
|
|
|
|
type :: tParameters
|
|
|
|
character(len=pStringLen), allocatable, dimension(:) :: &
|
|
|
|
output
|
|
|
|
end type tParameters
|
|
|
|
|
|
|
|
type(tparameters), dimension(:), allocatable :: &
|
|
|
|
param
|
|
|
|
|
|
|
|
|
2020-12-30 16:30:47 +05:30
|
|
|
contains
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Allocate variables and set parameters.
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module subroutine thermal_init()
|
|
|
|
|
2022-10-25 21:39:36 +05:30
|
|
|
type(tDict), pointer :: &
|
2021-01-24 16:45:18 +05:30
|
|
|
configHomogenizations, &
|
|
|
|
configHomogenization, &
|
|
|
|
configHomogenizationThermal
|
|
|
|
integer :: ho
|
|
|
|
|
2021-01-08 02:45:18 +05:30
|
|
|
|
2021-11-15 23:05:44 +05:30
|
|
|
print'(/,1x,a)', '<<<+- homogenization:thermal init -+>>>'
|
2020-12-30 16:30:47 +05:30
|
|
|
|
2021-01-24 16:45:18 +05:30
|
|
|
|
2022-10-25 21:39:36 +05:30
|
|
|
configHomogenizations => config_material%get_dict('homogenization')
|
2021-01-24 16:45:18 +05:30
|
|
|
allocate(param(configHomogenizations%length))
|
|
|
|
allocate(current(configHomogenizations%length))
|
|
|
|
|
|
|
|
do ho = 1, configHomogenizations%length
|
2022-02-20 02:12:38 +05:30
|
|
|
allocate(current(ho)%T(count(material_homogenizationID==ho)), source=T_ROOM)
|
2021-04-06 15:08:44 +05:30
|
|
|
allocate(current(ho)%dot_T(count(material_homogenizationID==ho)), source=0.0_pReal)
|
2022-10-25 21:39:36 +05:30
|
|
|
configHomogenization => configHomogenizations%get_dict(ho)
|
2021-01-24 16:45:18 +05:30
|
|
|
associate(prm => param(ho))
|
2022-02-19 23:26:41 +05:30
|
|
|
|
2021-01-24 16:45:18 +05:30
|
|
|
if (configHomogenization%contains('thermal')) then
|
2022-10-25 21:39:36 +05:30
|
|
|
configHomogenizationThermal => configHomogenization%get_dict('thermal')
|
2021-01-24 16:45:18 +05:30
|
|
|
#if defined (__GFORTRAN__)
|
2021-03-11 22:30:07 +05:30
|
|
|
prm%output = output_as1dString(configHomogenizationThermal)
|
2021-01-24 16:45:18 +05:30
|
|
|
#else
|
2021-03-11 22:30:07 +05:30
|
|
|
prm%output = configHomogenizationThermal%get_as1dString('output',defaultVal=emptyStringArray)
|
2021-01-24 16:45:18 +05:30
|
|
|
#endif
|
2022-02-19 23:26:41 +05:30
|
|
|
select case (configHomogenizationThermal%get_asString('type'))
|
|
|
|
|
|
|
|
case ('pass')
|
|
|
|
call pass_init()
|
|
|
|
|
2022-02-23 10:14:12 +05:30
|
|
|
case ('isotemperature')
|
2022-02-19 23:26:41 +05:30
|
|
|
call isotemperature_init()
|
|
|
|
|
|
|
|
end select
|
2021-01-24 16:45:18 +05:30
|
|
|
else
|
|
|
|
prm%output = emptyStringArray
|
2021-11-15 23:05:44 +05:30
|
|
|
end if
|
2022-02-19 23:26:41 +05:30
|
|
|
|
2021-01-24 16:45:18 +05:30
|
|
|
end associate
|
2021-11-15 23:05:44 +05:30
|
|
|
end do
|
2021-01-24 16:45:18 +05:30
|
|
|
|
2020-12-30 16:30:47 +05:30
|
|
|
end subroutine thermal_init
|
|
|
|
|
|
|
|
|
2022-12-30 00:38:05 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Check if thermal homogemization description is present in the configuration file
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module function homogenization_thermal_active() result(active)
|
|
|
|
|
|
|
|
logical :: active
|
|
|
|
|
|
|
|
active = any(thermal_active(:))
|
|
|
|
|
|
|
|
end function homogenization_thermal_active
|
|
|
|
|
|
|
|
|
2020-12-30 16:30:47 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-01-17 19:40:43 +05:30
|
|
|
!> @brief Partition temperature onto the individual constituents.
|
2020-12-30 16:30:47 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-01-24 17:56:01 +05:30
|
|
|
module subroutine thermal_partition(ce)
|
2020-12-30 16:30:47 +05:30
|
|
|
|
2022-06-24 10:34:52 +05:30
|
|
|
integer, intent(in) :: ce
|
2020-12-30 16:30:47 +05:30
|
|
|
|
2021-01-24 17:56:01 +05:30
|
|
|
real(pReal) :: T, dot_T
|
2021-01-17 19:22:52 +05:30
|
|
|
integer :: co
|
2020-12-30 16:30:47 +05:30
|
|
|
|
2021-01-24 17:56:01 +05:30
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
T = current(material_homogenizationID(ce))%T(material_homogenizationEntry(ce))
|
|
|
|
dot_T = current(material_homogenizationID(ce))%dot_T(material_homogenizationEntry(ce))
|
|
|
|
do co = 1, homogenization_Nconstituents(material_homogenizationID(ce))
|
2021-02-09 03:51:53 +05:30
|
|
|
call phase_thermal_setField(T,dot_T,co,ce)
|
2021-11-15 23:05:44 +05:30
|
|
|
end do
|
2020-12-30 16:30:47 +05:30
|
|
|
|
|
|
|
end subroutine thermal_partition
|
|
|
|
|
|
|
|
|
2021-01-24 17:56:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2022-06-24 10:34:52 +05:30
|
|
|
!> @brief Homogenize thermal viscosity.
|
2021-01-24 17:56:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-09 03:10:20 +05:30
|
|
|
module function homogenization_mu_T(ce) result(mu)
|
2021-04-08 02:11:49 +05:30
|
|
|
|
2021-04-07 11:22:57 +05:30
|
|
|
integer, intent(in) :: ce
|
2021-04-09 03:10:20 +05:30
|
|
|
real(pReal) :: mu
|
2021-04-07 11:22:57 +05:30
|
|
|
|
2021-04-11 16:51:27 +05:30
|
|
|
integer :: co
|
|
|
|
|
|
|
|
|
2022-02-07 19:13:32 +05:30
|
|
|
mu = phase_mu_T(1,ce)*material_v(1,ce)
|
2021-04-11 16:51:27 +05:30
|
|
|
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
|
2022-02-07 19:13:32 +05:30
|
|
|
mu = mu + phase_mu_T(co,ce)*material_v(co,ce)
|
2021-11-15 23:05:44 +05:30
|
|
|
end do
|
2021-04-11 12:02:13 +05:30
|
|
|
|
2021-04-09 03:10:20 +05:30
|
|
|
end function homogenization_mu_T
|
2021-04-07 11:22:57 +05:30
|
|
|
|
|
|
|
|
2021-01-24 17:56:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2022-06-24 10:34:52 +05:30
|
|
|
!> @brief Homogenize thermal conductivity.
|
2021-01-24 17:56:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-11 12:02:13 +05:30
|
|
|
module function homogenization_K_T(ce) result(K)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
integer, intent(in) :: ce
|
2021-04-11 12:02:13 +05:30
|
|
|
real(pReal), dimension(3,3) :: K
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
integer :: co
|
|
|
|
|
|
|
|
|
2022-02-07 19:13:32 +05:30
|
|
|
K = phase_K_T(1,ce)*material_v(1,ce)
|
2021-04-07 11:22:57 +05:30
|
|
|
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
|
2022-02-07 19:13:32 +05:30
|
|
|
K = K + phase_K_T(co,ce)*material_v(co,ce)
|
2021-11-15 23:05:44 +05:30
|
|
|
end do
|
2021-01-24 17:56:01 +05:30
|
|
|
|
2021-04-11 12:02:13 +05:30
|
|
|
end function homogenization_K_T
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2022-06-24 10:34:52 +05:30
|
|
|
!> @brief Homogenize heat generation rate.
|
2021-01-24 17:56:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-11 12:02:13 +05:30
|
|
|
module function homogenization_f_T(ce) result(f)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
integer, intent(in) :: ce
|
2021-04-11 12:02:13 +05:30
|
|
|
real(pReal) :: f
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
integer :: co
|
|
|
|
|
|
|
|
|
2022-02-07 19:13:32 +05:30
|
|
|
f = phase_f_T(material_phaseID(1,ce),material_phaseEntry(1,ce))*material_v(1,ce)
|
2021-04-07 11:22:57 +05:30
|
|
|
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
|
2022-02-07 19:13:32 +05:30
|
|
|
f = f + phase_f_T(material_phaseID(co,ce),material_phaseEntry(co,ce))*material_v(co,ce)
|
2021-11-15 23:05:44 +05:30
|
|
|
end do
|
2021-01-24 17:56:01 +05:30
|
|
|
|
2021-04-11 12:02:13 +05:30
|
|
|
end function homogenization_f_T
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-11 12:02:13 +05:30
|
|
|
!> @brief Set thermal field and its rate (T and dot_T).
|
2021-01-24 17:56:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module subroutine homogenization_thermal_setField(T,dot_T, ce)
|
|
|
|
|
|
|
|
integer, intent(in) :: ce
|
2022-06-24 10:34:52 +05:30
|
|
|
real(pReal), intent(in) :: T, dot_T
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
current(material_homogenizationID(ce))%T(material_homogenizationEntry(ce)) = T
|
|
|
|
current(material_homogenizationID(ce))%dot_T(material_homogenizationEntry(ce)) = dot_T
|
2022-02-21 21:58:02 +05:30
|
|
|
call thermal_partition(ce)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
end subroutine homogenization_thermal_setField
|
|
|
|
|
2021-01-24 19:49:57 +05:30
|
|
|
|
2021-01-24 21:04:51 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief writes results to HDF5 output file
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-07 10:56:54 +05:30
|
|
|
module subroutine thermal_results(ho,group)
|
2021-01-24 21:04:51 +05:30
|
|
|
|
|
|
|
integer, intent(in) :: ho
|
|
|
|
character(len=*), intent(in) :: group
|
|
|
|
|
|
|
|
integer :: o
|
|
|
|
|
2022-06-24 10:34:52 +05:30
|
|
|
|
2021-01-24 21:04:51 +05:30
|
|
|
associate(prm => param(ho))
|
|
|
|
outputsLoop: do o = 1,size(prm%output)
|
|
|
|
select case(trim(prm%output(o)))
|
|
|
|
case('T')
|
2021-06-01 20:35:13 +05:30
|
|
|
call results_writeDataset(current(ho)%T,group,'T','temperature','K')
|
2021-01-24 21:04:51 +05:30
|
|
|
end select
|
2021-11-15 23:05:44 +05:30
|
|
|
end do outputsLoop
|
2021-01-24 21:04:51 +05:30
|
|
|
end associate
|
|
|
|
|
2021-04-07 10:56:54 +05:30
|
|
|
end subroutine thermal_results
|
2021-01-24 21:04:51 +05:30
|
|
|
|
2021-01-26 05:50:45 +05:30
|
|
|
end submodule thermal
|