Heat Conduction
LowLevelFEM.FDM — MethodFDM(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
ScalarFieldandVectorFieldunknowns- 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::SystemMatrixDiffusion (conductivity / stiffness) matrix.C::SystemMatrixCapacity (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 bybc.n::IntNumber of time steps.Δt::Float64Time 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 vectort = 0:Δt:(n-1)Δt.
Notes
- Stability depends on
ϑand the spectrum of the generalized eigenproblemK x = λ C x. Forϑ ≥ 1/2the method is unconditionally stable. - The algorithm itself is agnostic to the physical meaning of the field (scalar, vector, tensor), as long as
K,Cand the fields are consistent.
LowLevelFEM.applyHeatConvection! — MethodapplyHeatConvection!(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: ProblemheatCondMat: SystemMatrixheatFluxVec: VectorFieldheatConv: Vector{Tuple{String, Float64, Float64, Float64}}
LowLevelFEM.heatCapacityMatrix — MethodheatCapacityMatrix(problem; lumped=...)Solves the heat capacity matrix of the problem. If lumped is true, solves lumped heat capacity matrix.
Return: heatCapMat
Types:
problem: Problemlumped: BooleanmassMat: SystemMatrix
LowLevelFEM.heatConductionMatrix — MethodheatConductionMatrix(problem)Solves the heat conduction matrix of the problem.
Returns: heatCondMat
Types:
problem: ProblemheatCondMat: SystemMatrix
Examples
Kth = heatConductionMatrix(problem)LowLevelFEM.heatConvectionMatrix — MethodheatConvectionMatrix(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: ProblemheatConvection: Vector{Tuple{String, Float64, Float64, Float64}}heatConvMat: SystemMatrix
LowLevelFEM.heatConvectionVector — MethodheatConvectionVector(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: ProblemheatConvection: Vector{Tuple{String, Float64, Float64, Float64}}heatConvVec: ScalarField
LowLevelFEM.heatFluxVector — MethodheatFluxVector(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: ProblemheatFlux: Vector{Tuple{String, Float64, Float64, Float64}}heatFluxVec: VectorField
LowLevelFEM.heatSourceVector — MethodheatSourceVector(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: ProblemheatSource: Vector{Tuple{String, Float64, Float64, Float64}}heatSourceVec: VectorField
LowLevelFEM.initialTemperature! — MethodinitialTemperature!(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: StringT0: ScalarFieldT: Float64
LowLevelFEM.initialTemperature — MethodinitialTemperature(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: Problemname: StringT: Float64T0: ScalarField
LowLevelFEM.latentHeatMatrix — MethodlatentHeatMatrix(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: Problemu: VectorFieldv: VectorFieldT0: ScalarFieldlatHeatMat: SystemMatrix
LowLevelFEM.solveHeatFlux — MethodsolveHeatFlux(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: ProblemT: ScalarFieldq: VectorField
LowLevelFEM.solveTemperature — MethodsolveTemperature(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: Problemu: VectorFieldT0: Float64T: ScalarField
LowLevelFEM.solveTemperature — MethodsolveTemperature(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.
LowLevelFEM.solveTemperature — MethodsolveTemperature(K, q;
temperatureConstraint = [])Solves the linear heat conduction problem
K * T = qfor 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.
LowLevelFEM.thermalLoadVector — MethodthermalLoadVector(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: ProblemT: ScalarFieldT₀: ScalarFieldthermLoadVec: VectorField