Skip to content

Materials and sections

Demonstrates how core objects are defined independently from the active plugin implementation.

examples/scripts/02_core_concepts/model/materials_and_sections.py. Run it from the repository with uv run python examples/scripts/02_core_concepts/model/materials_and_sections.py, or, with xfea-examples installed, xfea-examples run 02_core_concepts/model/materials_and_sections.py.

from xfea.model import ElasticIsotropic
from xfea.model import RectangularSection
from xfea.model import ShellSection
from xfea.model import SolidSection
from xfea.model import TrussSection
# Generic concrete-like material (SI-mm)
E = 30_000 # [MPa] Young's modulus
v = 0.2 # [-] Poisson's ratio
density = 2.4e-9 # [t/mm^3] mass density
# Section dimensions
beam_w = 200 # [mm] rectangular beam width
beam_h = 300 # [mm] rectangular beam height
truss_A = 200 # [mm^2] truss cross-section area
shell_t = 12 # [mm] shell thickness
material = ElasticIsotropic(E=E, v=v, density=density, name="generic_material")
beam_section = RectangularSection(w=beam_w, h=beam_h, material=material)
truss_section = TrussSection(A=truss_A, material=material)
shell_section = ShellSection(t=shell_t, material=material)
solid_section = SolidSection(material=material)
print(f"Material: {material.name}")
print(f"Beam section area: {beam_section.A}")
print(f"Truss section area: {truss_section.A}")
print(f"Shell section thickness: {shell_section.t}")
print(f"Solid section material: {solid_section.material.name}")

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