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
|
|
|
|
|
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()
|
|
|
|
|
2021-01-24 16:45:18 +05:30
|
|
|
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 -+>>>'
|
2021-04-07 12:17:46 +05:30
|
|
|
print'(/,a)', ' <<<+- homogenization:thermal:pass init -+>>>'
|
2021-01-27 15:14:03 +05:30
|
|
|
|
2020-12-30 16:30:47 +05:30
|
|
|
|
2021-01-24 16:45:18 +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)
|
2021-01-24 16:45:18 +05:30
|
|
|
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)
|
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
|
|
|
|
else
|
|
|
|
prm%output = emptyStringArray
|
|
|
|
endif
|
|
|
|
end associate
|
|
|
|
enddo
|
|
|
|
|
2020-12-30 16:30:47 +05:30
|
|
|
end subroutine thermal_init
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
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
|
|
|
|
2021-01-17 19:22: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-01-17 19:22:52 +05:30
|
|
|
enddo
|
2020-12-30 16:30:47 +05:30
|
|
|
|
|
|
|
end subroutine thermal_partition
|
|
|
|
|
|
|
|
|
2021-01-17 19:40:43 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Homogenize temperature rates
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
module subroutine thermal_homogenize(ip,el)
|
|
|
|
|
|
|
|
integer, intent(in) :: ip,el
|
|
|
|
|
2021-02-09 03:51:53 +05:30
|
|
|
!call phase_thermal_getRate(homogenization_dot_T((el-1)*discretization_nIPs+ip), ip,el)
|
2021-01-17 19:40:43 +05:30
|
|
|
|
|
|
|
end subroutine thermal_homogenize
|
|
|
|
|
|
|
|
|
2021-01-24 17:56:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return homogenized thermal conductivity in reference configuration
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-09 03:10:20 +05:30
|
|
|
module function homogenization_K_T(ce) result(K)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
2021-02-23 19:40:34 +05:30
|
|
|
integer, intent(in) :: ce
|
2021-01-24 17:56:01 +05:30
|
|
|
real(pReal), dimension(3,3) :: K
|
|
|
|
|
|
|
|
integer :: &
|
2021-02-23 19:40:34 +05:30
|
|
|
co
|
2021-01-24 17:56:01 +05:30
|
|
|
|
2021-04-11 11:05:43 +05:30
|
|
|
K = crystallite_push33ToRef(co,1,lattice_K_T(:,:,material_phaseID(1,ce)))
|
|
|
|
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
|
|
|
|
K = K + crystallite_push33ToRef(co,ce,lattice_K_T(:,:,material_phaseID(co,ce)))
|
2021-01-24 17:56:01 +05:30
|
|
|
enddo
|
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
K = K / real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
2021-04-09 03:10:20 +05:30
|
|
|
end function homogenization_K_T
|
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-09 03:10:20 +05:30
|
|
|
mu = c_P(ce) * rho(ce)
|
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
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief returns homogenized specific heat capacity
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-07 11:22:57 +05:30
|
|
|
function c_P(ce)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
integer, intent(in) :: ce
|
|
|
|
real(pReal) :: c_P
|
|
|
|
|
|
|
|
integer :: co
|
|
|
|
|
|
|
|
|
2021-04-07 11:22:57 +05:30
|
|
|
c_P = lattice_c_p(material_phaseID(1,ce))
|
|
|
|
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
|
2021-04-06 15:08:44 +05:30
|
|
|
c_P = c_P + lattice_c_p(material_phaseID(co,ce))
|
2021-01-24 17:56:01 +05:30
|
|
|
enddo
|
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
c_P = c_P / real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
2021-04-07 11:22:57 +05:30
|
|
|
end function c_P
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief returns homogenized mass density
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-07 11:22:57 +05:30
|
|
|
function rho(ce)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
integer, intent(in) :: ce
|
|
|
|
real(pReal) :: rho
|
|
|
|
|
|
|
|
integer :: co
|
|
|
|
|
|
|
|
|
2021-04-07 11:22:57 +05:30
|
|
|
rho = lattice_rho(material_phaseID(1,ce))
|
|
|
|
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
|
2021-04-06 15:08:44 +05:30
|
|
|
rho = rho + lattice_rho(material_phaseID(co,ce))
|
2021-01-24 17:56:01 +05:30
|
|
|
enddo
|
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
rho = rho / real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal)
|
2021-01-24 17:56:01 +05:30
|
|
|
|
2021-04-07 11:22:57 +05:30
|
|
|
end function rho
|
2021-01-24 17:56:01 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Set thermal field and its rate (T and dot_T)
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
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')
|
|
|
|
call results_writeDataset(group,current(ho)%T,'T','temperature','K')
|
|
|
|
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-04-08 02:11:49 +05:30
|
|
|
module function homogenization_T(ce) result(T)
|
2021-01-24 19:49:57 +05:30
|
|
|
|
|
|
|
integer, intent(in) :: ce
|
|
|
|
real(pReal) :: T
|
|
|
|
|
2021-04-06 15:08:44 +05:30
|
|
|
T = current(material_homogenizationID(ce))%T(material_homogenizationEntry(ce))
|
2021-01-24 19:49:57 +05:30
|
|
|
|
2021-04-08 02:11:49 +05:30
|
|
|
end function homogenization_T
|
2021-01-24 19:49:57 +05:30
|
|
|
|
|
|
|
|
2021-01-24 21:34:41 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return heat generation rate
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2021-04-09 03:10:20 +05:30
|
|
|
module function homogenization_f_T(ce) result(f)
|
2021-04-08 02:11:49 +05:30
|
|
|
|
|
|
|
integer, intent(in) :: ce
|
2021-04-09 03:10:20 +05:30
|
|
|
real(pReal) :: f
|
2021-04-08 02:11:49 +05:30
|
|
|
|
|
|
|
integer :: co
|
|
|
|
|
2021-04-09 03:10:20 +05:30
|
|
|
f = phase_f_T(material_phaseID(1,ce),material_phaseEntry(1,ce))
|
2021-04-08 02:11:49 +05:30
|
|
|
do co = 2, homogenization_Nconstituents(material_homogenizationID(ce))
|
2021-04-09 03:10:20 +05:30
|
|
|
f = f + phase_f_T(material_phaseID(co,ce),material_phaseEntry(co,ce))
|
2021-01-27 04:14:11 +05:30
|
|
|
enddo
|
2021-01-24 21:34:41 +05:30
|
|
|
|
2021-04-09 03:10:20 +05:30
|
|
|
f = f/real(homogenization_Nconstituents(material_homogenizationID(ce)),pReal)
|
2021-01-24 21:34:41 +05:30
|
|
|
|
2021-04-08 02:11:49 +05:30
|
|
|
end function homogenization_f_T
|
2021-01-24 21:34:41 +05:30
|
|
|
|
|
|
|
|
2021-01-26 05:50:45 +05:30
|
|
|
end submodule thermal
|