Step 3 - Adding additional terms to the heat equation
In the previous step, we modified boundary conditions to solve a meaningful problem that provided the steady-state solution to the heat equation by neglecting time-dependent terms. In this step, we will add terms to the heat equation by adding kernels. The heat equation with the full set of terms typically used for heat transfer within a solid or stationary fluid is:
(1)
where is temperature, is time, is the vector of spatial coordinates, is the density, is the specific heat capacity, is the thermal conductivity, is a heat source, and is the solution domain.
The first step will be to add the time derivative term to this equation, and then in a subsequent step, a volumetric heating term will be added.
#
# Single block thermal input with time derivative term
# https://mooseframework.inl.gov/modules/heat_transfer/tutorials/introduction/therm_step03.html
#
[Mesh]
[generated]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 2
ymax = 1
[]
[]
[Variables]
[T]
initial_condition = 300.0
[]
[]
[Kernels]
[heat_conduction]
type = HeatConduction
variable = T
[]
[time_derivative]
type = HeatConductionTimeDerivative
variable = T
[]
[]
[Materials]
[thermal]
type = HeatConductionMaterial
thermal_conductivity = 45.0
specific_heat = 0.5
[]
[density]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = 8000.0
[]
[]
[BCs]
[t_left]
type = DirichletBC
variable = T
value = 300
boundary = 'left'
[]
[t_right]
type = FunctionDirichletBC
variable = T
function = '300+5*t'
boundary = 'right'
[]
[]
[Executioner]
type = Transient
end_time = 5
dt = 1
[]
[VectorPostprocessors]
[t_sampler]
type = LineValueSampler
variable = T
start_point = '0 0.5 0'
end_point = '2 0.5 0'
num_points = 20
sort_by = x
[]
[]
[Outputs]
exodus = true
[csv]
type = CSV
file_base = therm_step03_out
execute_on = final
[]
[]
(moose/modules/heat_transfer/tutorials/introduction/therm_step03.i)Input file
Variables
The first change necessary to convert this from a quasi-steady-state problem to a transient problem is to define a reasonable initial condition for the temperature variable. The default initial value of variables is 0, which did not affect the steady-state solution in the previous step, but has a significant effect on the transient solution. The initial_condition
parameter is set for the T
variable to 300. Units of Kelvin are used here, and this is close to room temperature.
[Variables]
[T]
initial_condition = 300.0
[]
[]
(moose/modules/heat_transfer/tutorials/introduction/therm_step03.i)Kernels
An additional block is added under the Kernels
top level block to include the time dependent term in the heat equation. The Kernel that provides this term is named HeatConductionTimeDerivative
because this term has a dependence on the time derivative of the temperature.
[Kernels]
[heat_conduction]
type = HeatConduction
variable = T
[]
[time_derivative]
type = HeatConductionTimeDerivative
variable = T
[]
[]
(moose/modules/heat_transfer/tutorials/introduction/therm_step03.i)Materials
The HeatConductionTimeDerivative
Kernel depends on two additional material properties: density
and specific_heat
, which must be provided by material models. The specific heat can be provided by adding an additional parameter to the HeatConductionMaterial
Material block.
The density is not provided by HeatConductionMaterial
because that is a property that is used by other physics models, in particular by the models for solid mechanics. There is a specialized model to compute the density of a deforming material that is commonly used in those calculations, but there is no deformation in the present simulation, so a constant property can be used. The GenericConstantMaterial
is a material model that can be used to define one or more properties by providing the name of the property and the constant value. This is used here as a simple way to define the density.
[Materials]
[thermal]
type = HeatConductionMaterial
thermal_conductivity = 45.0
specific_heat = 0.5
[]
[density]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = 8000.0
[]
[]
(moose/modules/heat_transfer/tutorials/introduction/therm_step03.i)Questions
Before running the model, consider the initial conditions and boundary conditions, and estimate what expected solution should be when the time-dependent term is included.
Now go ahead and run the input and visualize the result to see if it matches the behavior you would expect.
Exploring parameters
Which parameters would you expect to be able to change to give a solution that matches more closely with the steady-state solution? Try changing those parameters to see if they have the expected effect after re-running the model.
Sidebar:
Some problems also have volumetric heating, which can be included by adding another Kernel.
Comparison of results
A Python script called therm_soln_compare.py
in this directory is set up to plot the results of the problems from steps 2a, 3, and 3a to show a side-by-side comparison of the temperature profiles at the end of the analysis for these cases. This script depends on having the matplotlib
and pandas
libraries available in your Python installation. It is executed by typing:
./therm_soln_compare.py
from the directory where the problems are run. It will generate an image called therm_soln_compare.png
with line plots for these three cases.