From dce8f9e635084ee0f663ab280253169d82c2e269 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 19 Feb 2022 18:56:41 +0100 Subject: [PATCH] enable output of temperature per phase --- PRIVATE | 2 +- src/homogenization.f90 | 2 +- src/homogenization_thermal.f90 | 12 +++++- src/homogenization_thermal_isotemperature.f90 | 5 ++- src/homogenization_thermal_pass.f90 | 5 ++- src/phase.f90 | 6 +++ src/phase_damage.f90 | 2 +- src/phase_mechanical.f90 | 3 +- src/phase_thermal.f90 | 37 +++++++++++++++++++ 9 files changed, 65 insertions(+), 9 deletions(-) diff --git a/PRIVATE b/PRIVATE index 0f9076b0b..0ef96051a 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 0f9076b0b589f5134b0304f6676e0076b99d887f +Subproject commit 0ef96051aa5bda4f8e3c22d6a2e0be3853e4ca7d diff --git a/src/homogenization.f90 b/src/homogenization.f90 index c259825c3..ff31447d5 100644 --- a/src/homogenization.f90 +++ b/src/homogenization.f90 @@ -466,7 +466,7 @@ subroutine parseHomogenization if (homog%contains('thermal')) then homogThermal => homog%get('thermal') select case (homogThermal%get_asString('type')) - case('pass') + case('pass','isotemperature') thermal_type(h) = THERMAL_conduction_ID case default call IO_error(500,ext_msg=homogThermal%get_asString('type')) diff --git a/src/homogenization_thermal.f90 b/src/homogenization_thermal.f90 index 9aa727041..db15a355e 100644 --- a/src/homogenization_thermal.f90 +++ b/src/homogenization_thermal.f90 @@ -56,6 +56,7 @@ module subroutine thermal_init() 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__) @@ -63,13 +64,22 @@ module subroutine thermal_init() #else prm%output = configHomogenizationThermal%get_as1dString('output',defaultVal=emptyStringArray) #endif + select case (configHomogenizationThermal%get_asString('type')) + + case ('pass') + call pass_init() + + case ('isothermal') + call isotemperature_init() + + end select else prm%output = emptyStringArray end if + end associate end do - call pass_init() end subroutine thermal_init diff --git a/src/homogenization_thermal_isotemperature.f90 b/src/homogenization_thermal_isotemperature.f90 index 7358ecf08..9733890d3 100644 --- a/src/homogenization_thermal_isotemperature.f90 +++ b/src/homogenization_thermal_isotemperature.f90 @@ -1,13 +1,14 @@ !-------------------------------------------------------------------------------------------------- !> @author Martin Diehl, KU Leuven -!> @brief Dummy homogenization scheme for 1 constituent per material point +!> @brief Isotemperature homogenization !-------------------------------------------------------------------------------------------------- submodule(homogenization:thermal) isotemperature contains -module subroutine isotemperature_init +module subroutine isotemperature_init() + print'(/,1x,a)', '<<<+- homogenization:thermal:isotemperature init -+>>>' end subroutine isotemperature_init diff --git a/src/homogenization_thermal_pass.f90 b/src/homogenization_thermal_pass.f90 index 2673c2789..ac12aa0b1 100644 --- a/src/homogenization_thermal_pass.f90 +++ b/src/homogenization_thermal_pass.f90 @@ -7,9 +7,12 @@ submodule(homogenization:thermal) thermal_pass contains module subroutine pass_init() - + print'(/,1x,a)', '<<<+- homogenization:thermal:pass init -+>>>' + if (homogenization_Nconstituents(1) /= 1) & + call IO_error(211,ext_msg='N_constituents (pass)') + end subroutine pass_init end submodule thermal_pass diff --git a/src/phase.f90 b/src/phase.f90 index c161fb48c..9987a5252 100644 --- a/src/phase.f90 +++ b/src/phase.f90 @@ -91,6 +91,11 @@ module phase integer, intent(in) :: ph end subroutine damage_results + module subroutine thermal_results(group,ph) + character(len=*), intent(in) :: group + integer, intent(in) :: ph + end subroutine thermal_results + module subroutine mechanical_forward() end subroutine mechanical_forward @@ -487,6 +492,7 @@ subroutine phase_results() call mechanical_results(group,ph) call damage_results(group,ph) + call thermal_results(group,ph) end do diff --git a/src/phase_damage.f90 b/src/phase_damage.f90 index e4700938f..9022131e2 100644 --- a/src/phase_damage.f90 +++ b/src/phase_damage.f90 @@ -336,7 +336,7 @@ end subroutine damage_results !-------------------------------------------------------------------------------------------------- -!> @brief contains the constitutive equation for calculating the rate of change of microstructure +!> @brief Constitutive equation for calculating the rate of change of microstructure. !-------------------------------------------------------------------------------------------------- function phase_damage_collectDotState(ph,en) result(broken) diff --git a/src/phase_mechanical.f90 b/src/phase_mechanical.f90 index 882110bc3..4c4e703f0 100644 --- a/src/phase_mechanical.f90 +++ b/src/phase_mechanical.f90 @@ -880,7 +880,7 @@ end function integrateStateRK !-------------------------------------------------------------------------------------------------- -!> @brief writes crystallite results to HDF5 output file +!> @brief Write mechanical results to HDF5 output file. !-------------------------------------------------------------------------------------------------- subroutine results(group,ph) @@ -1336,5 +1336,4 @@ module subroutine phase_set_F(F,co,ce) end subroutine phase_set_F - end submodule mechanical diff --git a/src/phase_thermal.f90 b/src/phase_thermal.f90 index 11314531e..924ae2f5d 100644 --- a/src/phase_thermal.f90 +++ b/src/phase_thermal.f90 @@ -6,6 +6,7 @@ submodule(phase) thermal type :: tThermalParameters real(pReal) :: C_p = 0.0_pReal !< heat capacity real(pReal), dimension(3,3) :: K = 0.0_pReal !< thermal conductivity + character(len=pStringLen), allocatable, dimension(:) :: output end type tThermalParameters integer, dimension(:), allocatable :: & @@ -108,6 +109,11 @@ module subroutine thermal_init(phases) if (any(phase_lattice(ph) == ['hP','tI'])) param(ph)%K(3,3) = thermal%get_asFloat('K_33') param(ph)%K = lattice_symmetrize_33(param(ph)%K,phase_lattice(ph)) +#if defined(__GFORTRAN__) + param(ph)%output = output_as1dString(thermal) +#else + param(ph)%output = thermal%get_as1dString('output',defaultVal=emptyStringArray) +#endif sources => thermal%get('source',defaultVal=emptyList) thermal_Nsources(ph) = sources%length else @@ -381,4 +387,35 @@ function thermal_active(source_label,src_length) result(active_source) end function thermal_active +!---------------------------------------------------------------------------------------------- +!< @brief writes damage sources results to HDF5 output file +!---------------------------------------------------------------------------------------------- +module subroutine thermal_results(group,ph) + + character(len=*), intent(in) :: group + integer, intent(in) :: ph + + + integer :: ou + + if (allocated(param(ph)%output)) then + call results_closeGroup(results_addGroup(group//'thermal')) + else + return + endif + + do ou = 1, size(param(ph)%output) + + select case(trim(param(ph)%output(ou))) + + case ('T') + call results_writeDataset(current(ph)%T,group//'thermal','T', 'temperature','T') + + end select + + end do + +end subroutine thermal_results + + end submodule thermal