DAMASK_EICMD/src/homogenization_thermal.f90

212 lines
6.6 KiB
Fortran
Raw Normal View History

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
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()
type(tDict), pointer :: &
configHomogenizations, &
configHomogenization, &
configHomogenizationThermal
integer :: ho
2021-01-08 02:45:18 +05:30
print'(/,1x,a)', '<<<+- homogenization:thermal init -+>>>'
2020-12-30 16:30:47 +05:30
configHomogenizations => config_material%get_dict('homogenization')
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)
configHomogenization => configHomogenizations%get_dict(ho)
associate(prm => param(ho))
2022-02-19 23:26:41 +05:30
if (configHomogenization%contains('thermal')) then
configHomogenizationThermal => configHomogenization%get_dict('thermal')
#if defined (__GFORTRAN__)
2021-03-11 22:30:07 +05:30
prm%output = output_as1dString(configHomogenizationThermal)
#else
2021-03-11 22:30:07 +05:30
prm%output = configHomogenizationThermal%get_as1dString('output',defaultVal=emptyStringArray)
#endif
2022-02-19 23:26:41 +05:30
select case (configHomogenizationThermal%get_asString('type'))
case ('pass')
call pass_init()
case ('isotemperature')
2022-02-19 23:26:41 +05:30
call isotemperature_init()
end select
else
prm%output = emptyStringArray
end if
2022-02-19 23:26:41 +05:30
end associate
end do
2020-12-30 16:30:47 +05:30
end subroutine thermal_init
!--------------------------------------------------------------------------------------------------
!> @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
!--------------------------------------------------------------------------------------------------
!> @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
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)
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
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))
mu = mu + phase_mu_T(co,ce)*material_v(co,ce)
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
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))
K = K + phase_K_T(co,ce)*material_v(co,ce)
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
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))
f = f + phase_f_T(material_phaseID(co,ce),material_phaseEntry(co,ce))*material_v(co,ce)
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
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
!--------------------------------------------------------------------------------------------------
2023-01-19 22:07:45 +05:30
module subroutine thermal_result(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')
2023-01-19 22:07:45 +05:30
call result_writeDataset(current(ho)%T,group,'T','temperature','K')
2021-01-24 21:04:51 +05:30
end select
end do outputsLoop
2021-01-24 21:04:51 +05:30
end associate
2023-01-19 22:07:45 +05:30
end subroutine thermal_result
2021-01-24 21:04:51 +05:30
2021-01-26 05:50:45 +05:30
end submodule thermal