Materials and sections
Demonstrates how core objects are defined independently from the active plugin implementation.
The script
Section titled “The script”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 ElasticIsotropicfrom xfea.model import RectangularSectionfrom xfea.model import ShellSectionfrom xfea.model import SolidSectionfrom xfea.model import TrussSection
# Generic concrete-like material (SI-mm)E = 30_000 # [MPa] Young's modulusv = 0.2 # [-] Poisson's ratiodensity = 2.4e-9 # [t/mm^3] mass density# Section dimensionsbeam_w = 200 # [mm] rectangular beam widthbeam_h = 300 # [mm] rectangular beam heighttruss_A = 200 # [mm^2] truss cross-section areashell_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