Step 2 - Adding boundary conditions

In the previous step we set up a basic thermal simulation that did... nothing. In this step will prescribe values for the temperature on the left and right sides of the block.

#
# Single block thermal input with boundary conditions
# https://mooseframework.inl.gov/modules/heat_transfer/tutorials/introduction/therm_step02.html
#

[Mesh<<<{"href": "../../../../syntax/Mesh/index.html"}>>>]
  [generated]
    type = GeneratedMeshGenerator<<<{"description": "Create a line, square, or cube mesh with uniformly spaced or biased elements.", "href": "../../../../source/meshgenerators/GeneratedMeshGenerator.html"}>>>
    dim<<<{"description": "The dimension of the mesh to be generated"}>>> = 2
    nx<<<{"description": "Number of elements in the X direction"}>>> = 10
    ny<<<{"description": "Number of elements in the Y direction"}>>> = 10
    xmax<<<{"description": "Upper X Coordinate of the generated mesh"}>>> = 2
    ymax<<<{"description": "Upper Y Coordinate of the generated mesh"}>>> = 1
  []
[]

[Variables<<<{"href": "../../../../syntax/Variables/index.html"}>>>]
  [T]
  []
[]

[Kernels<<<{"href": "../../../../syntax/Kernels/index.html"}>>>]
  [heat_conduction]
    type = HeatConduction<<<{"description": "Diffusive heat conduction term $-\\nabla\\cdot(k\\nabla T)$ of the thermal energy conservation equation", "href": "../../../../source/kernels/HeatConduction.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = T
  []
[]

[Materials<<<{"href": "../../../../syntax/Materials/index.html"}>>>]
  [thermal]
    type = HeatConductionMaterial<<<{"description": "General-purpose material model for heat conduction", "href": "../../../../source/materials/HeatConductionMaterial.html"}>>>
    thermal_conductivity<<<{"description": "The thermal conductivity value"}>>> = 45.0
  []
[]

[BCs<<<{"href": "../../../../syntax/BCs/index.html"}>>>]
  [t_left]
    type = DirichletBC<<<{"description": "Imposes the essential boundary condition $u=g$, where $g$ is a constant, controllable value.", "href": "../../../../source/bcs/DirichletBC.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = T
    value<<<{"description": "Value of the BC"}>>> = 300
    boundary<<<{"description": "The list of boundary IDs from the mesh where this object applies"}>>> = 'left'
  []
  [t_right]
    type = FunctionDirichletBC<<<{"description": "Imposes the essential boundary condition $u=g(t,\\vec{x})$, where $g$ is a (possibly) time and space-dependent MOOSE Function.", "href": "../../../../source/bcs/FunctionDirichletBC.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = T
    function<<<{"description": "The forcing function."}>>> = '300+5*t'
    boundary<<<{"description": "The list of boundary IDs from the mesh where this object applies"}>>> = 'right'
  []
[]

[Executioner<<<{"href": "../../../../syntax/Executioner/index.html"}>>>]
  type = Transient
  end_time = 5
  dt = 1
[]

[Outputs<<<{"href": "../../../../syntax/Outputs/index.html"}>>>]
  exodus<<<{"description": "Output the results using the default settings for Exodus output."}>>> = true
[]
(moose/modules/heat_transfer/tutorials/introduction/therm_step02.i)

Input file

BCs

BCs stands for boundary conditions. Those apply to the boundaries (or sidesets) of the simulation domain. In all boundary condition objects you will see the mandatory boundary parameter, which expects a list of sideset names or IDs.

[BCs<<<{"href": "../../../../syntax/BCs/index.html"}>>>]
  [t_left]
    type = DirichletBC<<<{"description": "Imposes the essential boundary condition $u=g$, where $g$ is a constant, controllable value.", "href": "../../../../source/bcs/DirichletBC.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = T
    value<<<{"description": "Value of the BC"}>>> = 300
    boundary<<<{"description": "The list of boundary IDs from the mesh where this object applies"}>>> = 'left'
  []
  [t_right]
    type = FunctionDirichletBC<<<{"description": "Imposes the essential boundary condition $u=g(t,\\vec{x})$, where $g$ is a (possibly) time and space-dependent MOOSE Function.", "href": "../../../../source/bcs/FunctionDirichletBC.html"}>>>
    variable<<<{"description": "The name of the variable that this residual object operates on"}>>> = T
    function<<<{"description": "The forcing function."}>>> = '300+5*t'
    boundary<<<{"description": "The list of boundary IDs from the mesh where this object applies"}>>> = 'right'
  []
[]
(moose/modules/heat_transfer/tutorials/introduction/therm_step02.i)

DirichletBC

The two Dirichlet boundary conditions are set on the left and right surfaces of the simulation domain. These prescribe the values of the T variable on those surfaces. The GeneratedMeshGenerator that was used to create this simple block mesh defines boundaries named top, bottom, left, and right on the boundaries of that block. Additional boundaries can be added using other MeshGenerators, or boundaries can be defined with an external meshing tool.

In this case, the temperature on the left boundary is fixed to a constant value of 300 using the DirichletBC

FunctionDirichletBC

The temperature on the right boundary is defined using a time-dependent function using the FunctionDirichletBC. As its name implies, this is a Dirichlet boundary condition that is defined using a function rather than a constant value. In this case, an expression for an analytic function is provided for the function parameter. Alternatively, the name of a separately defined Function can be provided. A wide variety of function types is available.

Other boundary conditions

A number of other boundary conditions are available. Some of these are generic boundary conditions that can be applied to any problem, while some are physics-specific.

Questions

Before running the model, consider what the expected solution to this problem with only the conduction term should be.

Click here for the answer.

Now go ahead and run the input and visualize the result to see if it matches the behavior you would expect.

Exploring parameters

Experiment with different settings for the thermal conductivity of the material and the applied boundary conditions. What happens if you change the thermal conductivity?

Click here for the answer.

For a problem like this, it can be very helpful to plot out values of the solution sampled along a line.

Click here for the sidebar on plotting along a line.

Once you've answered the questions and run this example we will move on to Step 3, where additional terms will be added to the heat equation.