DAMASK_EICMD/src/homogenization_thermal.f90

198 lines
6.1 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-01-24 17:56:01 +05:30
use lattice
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()
class(tNode), pointer :: &
configHomogenizations, &
configHomogenization, &
configHomogenizationThermal
integer :: ho
2021-01-08 02:45:18 +05:30
2021-01-27 15:14:03 +05:30
print'(/,a)', ' <<<+- homogenization:thermal init -+>>>'
2020-12-30 16:30:47 +05:30
configHomogenizations => config_material%get('homogenization')
allocate(param(configHomogenizations%length))
allocate(current(configHomogenizations%length))
do ho = 1, configHomogenizations%length
2021-04-06 15:08:44 +05:30
allocate(current(ho)%T(count(material_homogenizationID==ho)), source=300.0_pReal)
allocate(current(ho)%dot_T(count(material_homogenizationID==ho)), source=0.0_pReal)
configHomogenization => configHomogenizations%get(ho)
associate(prm => param(ho))
if (configHomogenization%contains('thermal')) then
configHomogenizationThermal => configHomogenization%get('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
else
prm%output = emptyStringArray
endif
end associate
enddo
2021-04-11 19:02:17 +05:30
call pass_init()
2020-12-30 16:30:47 +05:30
end subroutine thermal_init
!--------------------------------------------------------------------------------------------------
!> @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
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)
enddo
2020-12-30 16:30:47 +05:30
end subroutine thermal_partition
2021-01-24 17:56:01 +05:30
!--------------------------------------------------------------------------------------------------
2021-04-11 12:02:13 +05:30
!> @brief Homogenized 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)
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
mu = mu + phase_mu_T(co,ce)
enddo
2021-04-11 12:02:13 +05:30
2021-04-11 16:51:27 +05:30
mu = mu / real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal)
2021-04-07 11:22:57 +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
!--------------------------------------------------------------------------------------------------
2021-04-11 12:02:13 +05:30
!> @brief Homogenized thermal conductivity in reference configuration.
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
2021-04-11 16:51:27 +05:30
K = phase_K_T(1,ce)
2021-04-07 11:22:57 +05:30
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
2021-04-11 16:51:27 +05:30
K = K + phase_K_T(co,ce)
2021-01-24 17:56:01 +05:30
enddo
2021-04-11 12:02:13 +05:30
K = K / real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal)
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
!--------------------------------------------------------------------------------------------------
2021-04-11 12:02:13 +05:30
!> @brief Homogenized 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
2021-04-11 12:02:13 +05:30
f = phase_f_T(material_phaseID(1,ce),material_phaseEntry(1,ce))
2021-04-07 11:22:57 +05:30
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
2021-04-11 12:02:13 +05:30
f = f + phase_f_T(material_phaseID(co,ce),material_phaseEntry(co,ce))
2021-01-24 17:56:01 +05:30
enddo
2021-04-11 12:02:13 +05:30
f = f/real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal)
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
real(pReal), intent(in) :: T, dot_T
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
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
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
enddo outputsLoop
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