Heat Conduction

LowLevelFEM.FDMMethod
FDM(K, C, q, bc, T0, n, Δt; ϑ=0.5)

Solves a transient diffusion-type problem (e.g. heat conduction) using the finite difference method in time (ϑ-method).

The semi-discrete system


C * Ẋ(t) + K * X(t) = q(t)

is integrated in time using the ϑ-scheme:

  • ϑ = 0 : Forward Euler (explicit)
  • ϑ = 1/2 : Crank–Nicolson
  • ϑ = 1 : Backward Euler (implicit)
  • 0 < ϑ < 1 : intermediate schemes

The method supports:

  • time-independent or time-dependent load vectors q
  • time-independent or time-dependent Dirichlet boundary conditions
  • ScalarField and VectorField unknowns
  • consistent treatment of constraint-induced volume terms (i.e. contributions of prescribed values appear automatically in the RHS)

Boundary conditions are applied solver-side: on constrained DOFs the prescribed values override the initial condition, while on free DOFs the initial condition T0 is used.

If q.nsteps == 1, the load is treated as time-independent. If q.nsteps == n, a true ϑ-weighted load


q^{n+ϑ} = (1-ϑ) q^n + ϑ q^{n+1}

is used.

For ϑ = 0 and diagonal C, a fully explicit update is used.


Arguments

  • K::SystemMatrix Diffusion (conductivity / stiffness) matrix.
  • C::SystemMatrix Capacity (mass / heat capacity) matrix.
  • q::Union{ScalarField,VectorField} Load / source vector. May be time-independent (nsteps = 1) or time-dependent (nsteps = n).
  • bc::Vector{BoundaryCondition} Dirichlet boundary conditions (possibly time-dependent).
  • T0::Union{ScalarField,VectorField} Initial condition. On constrained DOFs this is overridden by bc.
  • n::Int Number of time steps.
  • Δt::Float64 Time step size.
  • ϑ::Float64 (keyword, default = 0.5) Parameter of the ϑ-method.

Returns

  • T::Union{ScalarField,VectorField} Nodal solution field at all time steps (ndof × nsteps), with time vector t = 0:Δt:(n-1)Δt.

Notes

  • Stability depends on ϑ and the spectrum of the generalized eigenproblem K x = λ C x. For ϑ ≥ 1/2 the method is unconditionally stable.
  • The algorithm itself is agnostic to the physical meaning of the field (scalar, vector, tensor), as long as K, C and the fields are consistent.
source
LowLevelFEM.applyHeatConvection!Method
applyHeatConvection!(heatCondMat, heatFluxVec, heatConv)

Applies heat convectiom boundary conditions heatConv on a heat conduction matrix heatCondMat and heat flux vector heatFluxVec. Mesh details are in problem. heatConv is a tuple of name of physical group and prescribed heat transfer coefficient h and ambient temperature Tₐ. The ambient temperature can be either a constant or a function of x, y and z coordinates.

Returns: nothing

Types:

  • problem: Problem
  • heatCondMat: SystemMatrix
  • heatFluxVec: VectorField
  • heatConv: Vector{Tuple{String, Float64, Float64, Float64}}
source
LowLevelFEM.heatCapacityMatrixMethod
heatCapacityMatrix(problem; lumped=...)

Solves the heat capacity matrix of the problem. If lumped is true, solves lumped heat capacity matrix.

Return: heatCapMat

Types:

  • problem: Problem
  • lumped: Boolean
  • massMat: SystemMatrix
source
LowLevelFEM.heatConductionMatrixMethod
heatConductionMatrix(problem)

Solves the heat conduction matrix of the problem.

Returns: heatCondMat

Types:

  • problem: Problem
  • heatCondMat: SystemMatrix

Examples

Kth = heatConductionMatrix(problem)
source
LowLevelFEM.heatConvectionMatrixMethod
heatConvectionMatrix(problem, heatConvection)

Solves the heat convection matrix of the problem. heatConvection is a vector of heat convection boundary condicions defined in function heatConduction. With the heat convection vector (see the heatConvectionVector function) heatConvVec, temperature field vector T in hand the heat flux vector qCV arising from the heat convection boundary condition can be solved. qCV = heatConvMat * T - heatConvVec

Return: heatConvMat

Types:

  • problem: Problem
  • heatConvection: Vector{Tuple{String, Float64, Float64, Float64}}
  • heatConvMat: SystemMatrix
source
LowLevelFEM.heatConvectionVectorMethod
heatConvectionVector(problem, heatConvection)

Solves a heat convection vector of problem. heatConvection is a vector of heat convection boundary condicions defined in function heatConduction. With the heat convection matrix (see the heatConvectionMatrix function) heatConvMat, temperature field vector T in hand the heat flux vector qCV arising from the heat convection boundary condition can be solved. qCV = heatConvMat * T - heatConvVec

Return: heatConvVec

Types:

  • problem: Problem
  • heatConvection: Vector{Tuple{String, Float64, Float64, Float64}}
  • heatConvVec: ScalarField
source
LowLevelFEM.heatFluxVectorMethod
heatFluxVector(problem, heatFlux)

Solves a heat flux or heat source vector of problem. heatFlux is a tuple of name of physical group name, heat flux qn normal to the surface of the body. The outward direction is positive. It can solve heat flux (or heat source) depending on the problem.

  • In case of 2D problems and Point physical group means concentrated heat flux.
  • In case of 2D problems and Line physical group means surface heat flux.
  • In case of 2D problems and Surface physical group means body heat source.
  • In case of 3D problems and Point physical group means concentrated heat flux.
  • In case of 3D problems and Line physical group means edge heat source.
  • In case of 3D problems and Surface physical group means surface heat flux.
  • In case of 3D problems and Volume physical group means body heat source.

Return: heatFluxVec

Types:

  • problem: Problem
  • heatFlux: Vector{Tuple{String, Float64, Float64, Float64}}
  • heatFluxVec: VectorField
source
LowLevelFEM.heatSourceVectorMethod
heatSourceVector(problem, heatSource)

Solves a heat flux or heat source vector of problem. heatSource is a tuple of name of physical group name, heat flux qn normal to the surface of the body. The outward direction is positive. It can solve heat flux (or heat source) depending on the problem.

  • In case of 2D problems and Point physical group means concentrated heat flux.
  • In case of 2D problems and Line physical group means surface heat flux.
  • In case of 2D problems and Surface physical group means body heat source.
  • In case of 3D problems and Point physical group means concentrated heat flux.
  • In case of 3D problems and Line physical group means edge heat source.
  • In case of 3D problems and Surface physical group means surface heat flux.
  • In case of 3D problems and Volume physical group means body heat source.

Same as the heatFluxVector function.

Return: heatSourceVec

Types:

  • problem: Problem
  • heatSource: Vector{Tuple{String, Float64, Float64, Float64}}
  • heatSourceVec: VectorField
source
LowLevelFEM.initialTemperature!Method
initialTemperature!(T0, name; T=...)

Changes the tempetature value to T at nodes belonging to physical group name. Original values are in temperature vector T0.

Returns: nothing

Types:

  • name: String
  • T0: ScalarField
  • T: Float64
source
LowLevelFEM.initialTemperatureMethod
initialTemperature(problem, name; T=...)

Sets the temperature value T at nodes belonging to physical group name. Returns the T0 initial nodal temperature vector.

Return: T0

Types:

  • problem: Problem
  • name: String
  • T: Float64
  • T0: ScalarField
source
LowLevelFEM.latentHeatMatrixMethod
latentHeatMatrix(problem, u, v, T0)

Solves the latent heat matrix of the problem. With this matrix the generated heat due to deformations (given with displacement field u and velocity field v) can be solved. T0 is the current temperature field which is given in absolute temperature scale (Kelvin).

Return: latHeatMat

Types:

  • problem: Problem
  • u: VectorField
  • v: VectorField
  • T0: ScalarField
  • latHeatMat: SystemMatrix
source
LowLevelFEM.solveHeatFluxMethod
solveHeatFlux(T; DoFResults=false)

Solves the heat flux field q from temperature vector T. heat flux is given per elements, so it usually contains jumps at the boundary of elements. Details of mesh is available in problem. If DoFResults is true, q is a matrix with nodal results. In this case showDoFResults can be used to show the results (otherwise showHeatFluxResults or showElementResults).

Return: q

Types:

  • problem: Problem
  • T: ScalarField
  • q: VectorField
source
LowLevelFEM.solveTemperatureMethod
solveTemperature(problem, u; T0=273.0)

Solves the raise of temperature T during reversible (no dissipation) elastic deformations, where u is the displacement field, and problem is a heat cunduction problem.

Return: T

Types:

  • problem: Problem
  • u: VectorField
  • T0: Float64
  • T: ScalarField
source
LowLevelFEM.solveTemperatureMethod
solveTemperature(problem;
                 heatFlux = BoundaryCondition[],
                 temperatureConstraint = BoundaryCondition[],
                 heatConvection = BoundaryCondition[])

Computes the temperature field T for a given [Problem] subject to prescribed heat fluxes, temperature constraints, and optional heat convection boundary conditions.

The heat conduction matrix and load vector are assembled internally. Heat convection terms, if present, are incorporated into the system before solving.

This is the high-level, user-facing temperature solver.

Arguments

  • problem::Problem: Finite element heat transfer problem definition.
  • heatFlux::Vector{BoundaryCondition} (keyword, optional): Prescribed heat flux boundary conditions.
  • temperatureConstraint::Vector{BoundaryCondition} (keyword, optional): Prescribed temperature constraints (Dirichlet boundary conditions).
  • heatConvection::Vector{BoundaryCondition} (keyword, optional): Heat convection boundary conditions contributing to both the system matrix and the load vector.

Returns

  • T::ScalarField: Temperature field defined on the problem degrees of freedom.

Notes

  • Temperature constraints are enforced by eliminating constrained degrees of freedom from the linear system.
  • Heat convection terms are added to the conduction matrix and load vector via applyHeatConvection!.
  • This function internally assembles the heat conduction matrix and heat flux vector, then solves the reduced linear system.
source
LowLevelFEM.solveTemperatureMethod
solveTemperature(K, q;
                 temperatureConstraint = [])

Solves the linear heat conduction problem

K * T = q

for the temperature field T, where K is the assembled heat conduction matrix and q is the heat flux (load) vector. Essential temperature constraints (Dirichlet-type boundary conditions) are imposed via temperatureConstraint.

This is a low-level temperature solver operating directly on a preassembled [SystemMatrix] and a heat flux [ScalarField]. It assumes that the system matrix already contains all material contributions.

Arguments

  • K::SystemMatrix: Assembled heat conduction matrix associated with a [Problem].
  • q::ScalarField: Heat flux vector (right-hand side of the heat equation).
  • temperatureConstraint::Vector{BoundaryCondition} (keyword, optional): Prescribed temperature constraints (Dirichlet boundary conditions). Default is an empty vector (no temperature constraints).

Returns

  • T::ScalarField: Temperature field satisfying the prescribed constraints.

Notes

  • Only the unconstrained degrees of freedom are solved for; constrained values are imposed explicitly.
  • This function is primarily intended for internal or advanced use. Most users should prefer the high-level solveTemperature(problem; ...) interface.
source
LowLevelFEM.thermalLoadVectorMethod
thermalLoadVector(problem, T; T₀=...)

Solves the thermal load vector from a temperature field T for problem problem. T₀ is the initial temperature field. problem is an elastic problem.

Return: thermLoadVec

Types:

  • problem: Problem
  • T: ScalarField
  • T₀: ScalarField
  • thermLoadVec: VectorField
source