Skip to content

Cantilever beam — Thermal analysis — 3D Solid elements

Steady-state heat conduction through a cantilever beam modelled as a solid box (L x b x h). Fixed temperatures at both ends: T_hot = 373.15 K (100 C) at x = 0 T_cold = 293.15 K (20 C) at x = L

Analytical (1D steady-state conduction): T(x) = T_hot + (T_cold - T_hot) * x / L

The model before it is solved: parts, supports and loads

The model before it is solved: its parts, supports (red) and loads (blue).

The result: the model coloured by temperature (T [K])

The model, coloured by temperature (T [K]), in xfea’s 3D viewer.

Open in 3D turn it, cut it, pick any field: in xfea's viewer, in your browser

In the latest verification run, on 2026-11-21, through the conversion service as users solve, 3 of 3 checks pass.

Quantity / reference fromxfeaReferenceDeviationTolerance
Min temperature (x=L) [K]
analytical
293.15293.150.00 %1 %
Max temperature (x=0) [K]
analytical
373.15373.150.00 %1 %
Mid-span temperature [K]
analytical
333.15333.150.00 %1 %

examples/scripts/04_reference_cases/benchmarks/cantilever_thermal_3d.py. Run it from the repository with uv run python examples/scripts/04_reference_cases/benchmarks/cantilever_thermal_3d.py, or, with xfea-examples installed, xfea-examples run 04_reference_cases/benchmarks/cantilever_thermal_3d.py.

from xfea.meshing import MeshingSettings
from xfea.model import Model, Part, SolidSection
from xfea.problem import HeatTransferStep, Problem
from xfea.results import TemperatureFieldResults
from _bench_utils import (
CANTILEVER_LENGTH,
BEAM_WIDTH,
BEAM_HEIGHT,
T_COLD,
T_HOT,
_ensure_box_step,
compare,
out_dir,
thermal_material,
)
from xfea_examples.models import _nodes_at_extreme
# ── Model ─────────────────────────────────────────────────────────────────
L = CANTILEVER_LENGTH
b = BEAM_WIDTH
h = BEAM_HEIGHT
step_path = _ensure_box_step("beam_cantilever_3d.stp", L, b, h)
mat = thermal_material()
sec = SolidSection(material=mat)
model = Model(name="bench_cantilever_thermal_3d")
with model:
part = model.add_part(Part(name="solid"))
part.base_geometry = step_path
part.mesh(settings=MeshingSettings(min=15, max=30), section=sec)
hot_nodes = _nodes_at_extreme(part.nodes, axis="x", mode="min")
cold_nodes = _nodes_at_extreme(part.nodes, axis="x", mode="max")
model.add_uniform_thermal_ics_field(T0=T_COLD, nodes=part.nodes)
model.add_thermal_bc(nodes=hot_nodes, temperature=T_HOT)
model.add_thermal_bc(nodes=cold_nodes, temperature=T_COLD)
# ── Problem ───────────────────────────────────────────────────────────────
problem = model.add_problem(Problem(name="cantilever_thermal_3d"))
step = problem.add_step(
HeatTransferStep(
name="steady_state",
steady_state=True,
)
)
temp = TemperatureFieldResults()
step.add_field_outputs([temp])
problem.analyse_and_extract(path=out_dir(model.name), verbose=True)
# ── Comparison ────────────────────────────────────────────────────────────
print()
print("=" * 65)
print("Cantilever Beam — Thermal (Steady-State) — 3D Solid Elements")
print("=" * 65)
print()
min_temp = temp.get_min_result("T")
max_temp = temp.get_max_result("T")
fea_min_K = float(min_temp.T)
fea_max_K = float(max_temp.T)
compare("Min temperature (x=L) [K]", fea_min_K, T_COLD, tol_pct=1.0)
compare("Max temperature (x=0) [K]", fea_max_K, T_HOT, tol_pct=1.0)
# Mid-span temperature check
T_mid_ref = (T_HOT + T_COLD) / 2.0
mid_x = L / 2.0
mid_temps = []
for r in temp.results:
if abs(r.node.x - mid_x) < 5.0:
val = float(r.T)
mid_temps.append(val)
if mid_temps:
fea_mid_K = sum(mid_temps) / len(mid_temps)
compare("Mid-span temperature [K]", fea_mid_K, T_mid_ref, tol_pct=1.0)
else:
print(f" Expected mid-span temperature: {T_mid_ref:.2f} K ({T_mid_ref - 273.15:.1f} C)")
print(" (No nodes found near mid-span to verify)")

© 2026 Francesco Ranaudo · Text and pictures CC BY 4.0 · Code Elastic License 2.0 · how to reuse them