Config¶
The composed simulation config that ties the mesh, the domain and the Elmer physics together, and the solve frame it maps the authored model into.
femforge.config
¶
The composed simulation config: the composition root that ties the gmsh mesh, the domain and the Elmer physics areas together.
Classes:
-
RunMeta–Searchable run metadata: a description and free key=value tags, recorded verbatim in the bundle manifest and
-
SimulationConfig–The single config spanning the whole pipeline, one area model per concern;
solved_physics/resolved_stackgive what the run solves underframe.
RunMeta
pydantic-model
¶
Bases: ConfigArea
Searchable run metadata: a description and free key=value tags, recorded verbatim in the bundle manifest and NEVER part of the run identity — editing them re-labels a run without re-solving it.
Config:
arbitrary_types_allowed:Trueuse_attribute_docstrings:True
Fields:
-
description(str | None) -
tags(TagDict)
description
pydantic-field
¶
description: str | None = None
One line on what this run is for (shown in the driver log, searchable via run.find_runs).
tags
pydantic-field
¶
tags: TagDict
Free key=value labels (the same tag-dict shape the geometry uses); find_runs matches by subset.
matches
¶
Whether these tags satisfy every selector pair (the same containment rule as EntityTag.matches).
SimulationConfig
pydantic-model
¶
Bases: ConfigArea
The single config spanning the whole pipeline, one area model per concern; solved_physics / resolved_stack give what the run solves under frame.
Config:
validate_assignment:True
Fields:
-
geometry(SerializeAsAny[GeometryArea] | None) -
frame(FrameUnion) -
mesh(MeshConfig) -
domain(DomainConfig) -
physics(PhysicsSelection) -
meta(RunMeta)
Validators:
geometry
pydantic-field
¶
geometry: SerializeAsAny[GeometryArea] | None = None
Optional parametric geometry: when set, the driver calls its build_step into the run directory before
meshing and repoints mesh.step at it — the STEP is derived output, and the run identity comes from these
parameters rather than an authored file.
mesh
pydantic-field
¶
mesh: MeshConfig
The gmsh mesh settings: STEP source, global element size, gmsh options.
meta
pydantic-field
¶
meta: RunMeta
Searchable description + tags; excluded from cache_key, so labeling never re-identifies a run.
frame_fits_inputs
pydantic-validator
¶
frame_fits_inputs(frame: Frame, info: ValidationInfo) -> Frame
On reassignment, reject a frame the domain or the physics selection cannot solve.
Source code in src/femforge/config.py
domain_fits_frame
pydantic-validator
¶
domain_fits_frame(domain: DomainConfig, info: ValidationInfo) -> DomainConfig
Reject conditions the frame cannot solve.
Source code in src/femforge/config.py
physics_fits_frame
pydantic-validator
¶
physics_fits_frame(physics: PhysicsSelection, info: ValidationInfo) -> PhysicsSelection
Reject a selection the frame cannot solve.
Source code in src/femforge/config.py
resolved_stack
¶
resolved_stack() -> PhysicsConfig
The solver stack the run solves: the authored physics.overrides, else the solved physics' preset in frame.
Source code in src/femforge/config.py
customize_physics
¶
customize_physics() -> PhysicsConfig
Materialize the resolved stack into physics.overrides (idempotent) and return it for typed editing.
Source code in src/femforge/config.py
femforge.frames
¶
Solve frames: how an authored model maps onto the coordinates the solve runs in.
Modules:
-
axisymmetric–The axisymmetric frame: the r–z half-plane of a model symmetric about an axis.
-
base–The solve frame seam: the
Framebase class every frame implements, and the axes and planes frames are built from. -
cartesian_2d–The Cartesian 2D frame: the planar section of a prismatic model, solved per metre of depth and scaled by its thickness.
-
solid–The solid frame: the authored 3D model solved as-is.
Classes:
-
Axis–A line through
originalongdirection, in the authored model's frame. -
Axisymmetric–Solve the r–z half-plane of a model symmetric about
axis: X = radial, Y = along the axis, Z = 0. -
BodyMismatch–How far one body or named face of the authored model is from passing one frame check.
-
Cartesian2D–Solve the section of a prismatic model on the plane normal to
normal: X =x_dir, Y = normal × X, Z = 0, scaled bythickness. -
Frame–How an authored model maps onto the coordinates the solve runs in; each subclass is one frame.
-
FrameCheck–A rule a sectioning frame holds every body and named face of the authored model to.
-
FrameFact–One row of the Setup tab's Frame section: a label and the value it reads.
-
FrameGeometryError–The authored model does not fit the frame: a body or named face mismatches a frame check beyond its tolerance.
-
GeometryCheck–A frame's verdict on an authored model: every measured body and named face, and the tolerance each was held to.
-
PlaneState–How a 2D elasticity solve treats the out-of-plane direction.
-
SolvePlane–Where a sectioned solve's plane sits in the authored model: its origin and the authored directions of its +X and +Y.
-
Solid–Solve the authored 3D model as-is.
Functions:
-
default_frame–The first shipped frame, with its default fields, that solves on
model_dimdimensions: the frame of a run whose bundle names none; frames with a required field are skipped. -
shipped_frames–The frame classes
FrameUnionadmits, in its order.
Attributes:
-
FrameUnion–Any shipped frame, told apart by its
kind; the type of every serialized frame field.
FrameUnion
module-attribute
¶
FrameUnion = Solid | Axisymmetric | Cartesian2D
Any shipped frame, told apart by its kind; the type of every serialized frame field.
Axis
pydantic-model
¶
Bases: ConfigArea
A line through origin along direction, in the authored model's frame.
Config:
frozen:True
Fields:
direction
pydantic-field
¶
direction: DirectionField
[-]: The axis direction; a scaled direction is the same axis.
label
property
¶
label: str
Z or -X for a coordinate axis through the origin, else its direction and origin.
along
¶
The cosine between direction and this axis (±1), or None when they are not parallel within ALIGNMENT_TOLERANCE.
Source code in src/femforge/frames/base.py
Axisymmetric
pydantic-model
¶
Bases: Frame
Solve the r–z half-plane of a model symmetric about axis: X = radial, Y = along the axis, Z = 0.
Fields:
Validators:
kind
pydantic-field
¶
kind: Literal['axisymmetric'] = 'axisymmetric'
Discriminator that names this frame in a serialized config.
radial
pydantic-field
¶
radial: DirectionField | None = None
[-]: The direction from the axis toward the sectioned half-plane, stored as its unit part perpendicular to the
axis; None picks the world axis least aligned with the symmetry axis.
description
property
¶
description: str
One sentence on what the frame solves, for a reader who has not met it.
coordinate_system
property
¶
coordinate_system: CoordinateSystem
Elmer's Axi Symmetric system, which integrates per radian.
plane
property
¶
plane: SolvePlane
The half-plane through axis toward radial, else toward the world axis least aligned with axis (X first).
perpendicular
pydantic-validator
¶
perpendicular(radial: Direction | None, info: ValidationInfo) -> Direction | None
Reject an axis-parallel radial and store its unit component perpendicular to the axis.
Source code in src/femforge/frames/axisymmetric.py
face_measure
¶
The surface a section line of length metres sweeps about the axis, 2π·r̄·L with r̄ the radius of centroid; None for a line on the axis, which sweeps none.
Parameters:
-
length(float) –L[m]: The group's length in the solve plane. -
centroid(Vec3) –[m]: The group's centroid in the solve frame, X radial.
Source code in src/femforge/frames/axisymmetric.py
measure_geometry
¶
measure_geometry(compound: TaggedCompound) -> GeometryCheck
How far every body and named face of compound changes when turned about axis.
Source code in src/femforge/frames/axisymmetric.py
prepare_geometry
¶
step_out, written with the section of step_in on plane once the model passes the geometry check; the check and the authored-body tessellation land beside it.
Source code in src/femforge/frames/axisymmetric.py
solves
¶
MAGNETOSTATICS_2D for magnetostatics, THERMAL for heat conduction; every other physics raises.
Source code in src/femforge/frames/axisymmetric.py
solve_vector
¶
(0, a) with a the signed length along the axis; a vector off the axis raises.
Source code in src/femforge/frames/axisymmetric.py
total
¶
The full revolution of a per-radian integral: the axial component times 2π, the radial one zero by symmetry.
solve_share
¶
The per-radian share of a full-revolution solve-frame vector: its axial component over 2π, the radial one zero by symmetry.
along
¶
The axial component of vector along axis, the symmetry axis for None; an axis off the symmetry axis raises.
Source code in src/femforge/frames/axisymmetric.py
BodyMismatch
pydantic-model
¶
Bases: BaseModel
How far one body or named face of the authored model is from passing one frame check.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
Cartesian2D
pydantic-model
¶
Bases: Frame
Solve the section of a prismatic model on the plane normal to normal: X = x_dir, Y = normal × X, Z = 0, scaled by thickness.
Config:
frozen:True
Fields:
-
kind(Literal['cartesian_2d']) -
normal(Axis) -
x_dir(DirectionField | None) -
thickness(Length) -
state(PlaneState)
Validators:
kind
pydantic-field
¶
kind: Literal['cartesian_2d'] = 'cartesian_2d'
Discriminator that names this frame in a serialized config.
normal
pydantic-field
¶
The section plane: through the axis origin, normal to its direction.
x_dir
pydantic-field
¶
x_dir: DirectionField | None = None
[-]: The authored direction of the solve +X, stored as its unit part in the plane; None picks the world axis least aligned with the normal.
thickness
pydantic-field
¶
t [mm]: The depth of the prism along the normal, which turns per-metre results into whole-model totals.
state
pydantic-field
¶
state: PlaneState = PlaneState.STRESS
How a linear elasticity solve treats the out-of-plane direction.
description
property
¶
description: str
One sentence on what the frame solves, for a reader who has not met it.
coordinate_system
property
¶
coordinate_system: CoordinateSystem
Elmer's Cartesian 2D system, which integrates per metre of depth.
plane
property
¶
plane: SolvePlane
The plane through the normal's origin: +X toward x_dir, else the world axis least aligned with the normal (X first), and +Y = normal × X.
thickness_m
property
¶
thickness_m: float
t [m]: The thickness in metres, the factor between a per-metre result and its whole-model total.
in_plane_x
pydantic-validator
¶
in_plane_x(x_dir: Direction | None, info: ValidationInfo) -> Direction | None
Reject an x_dir along the normal and store its unit part in the plane.
Source code in src/femforge/frames/cartesian_2d.py
positive
pydantic-validator
¶
Reject a zero or negative thickness.
Source code in src/femforge/frames/cartesian_2d.py
facts
¶
The plane's origin and axes, the thickness, then the plane state.
Source code in src/femforge/frames/cartesian_2d.py
face_measure
¶
The face a section line of length metres stands for: its length times the thickness; centroid is ignored.
Parameters:
-
length(float) –L[m]: The group's length in the solve plane. -
centroid(Vec3) –[m]: The group's centroid in the solve frame.
Source code in src/femforge/frames/cartesian_2d.py
measure_geometry
¶
measure_geometry(compound: TaggedCompound) -> GeometryCheck
How far every body and named face of compound is from a prism through thickness along the normal.
Source code in src/femforge/frames/cartesian_2d.py
prepare_geometry
¶
step_out, written with the section of step_in on plane once the model passes the geometry check; the check and the authored-body tessellation land beside it.
Source code in src/femforge/frames/cartesian_2d.py
solves
¶
MAGNETOSTATICS_2D for magnetostatics, and heat conduction and linear elasticity as themselves; every other physics raises.
Source code in src/femforge/frames/cartesian_2d.py
solve_vector
¶
(v·x, v·y) on the plane basis; a vector with a part along the normal raises.
Source code in src/femforge/frames/cartesian_2d.py
total
¶
The whole prism's total of a per-metre integral: its in-plane components times the thickness.
solve_share
¶
The per-metre share of a whole-prism solve-frame vector: the vector over the thickness.
along
¶
The projection of the solve-frame vector onto the authored axis; None raises, since the frame has no axis of its own.
Source code in src/femforge/frames/cartesian_2d.py
Frame
pydantic-model
¶
Bases: ConfigArea, ABC
How an authored model maps onto the coordinates the solve runs in; each subclass is one frame.
Fields:
description
abstractmethod
property
¶
description: str
One sentence on what the frame solves, for a reader who has not met it.
model_dim
abstractmethod
property
¶
model_dim: Literal[2, 3]
The mesh dimension this frame solves on.
coordinate_system
abstractmethod
property
¶
coordinate_system: CoordinateSystem
The Elmer coordinate system the frame solves in.
plane
abstractmethod
property
¶
plane: SolvePlane | None
Where the solve plane sits in the authored model; None when the model solves whole.
rewrites_geometry
property
¶
rewrites_geometry: bool
Whether the solve meshes a converted STEP rather than the authored one.
lumps_torque
abstractmethod
property
¶
lumps_torque: bool
Whether Elmer's force lumping yields a torque in this frame.
revolves
property
¶
revolves: bool
Whether the solve section stands for a model revolved about an axis.
axis_names
property
¶
The names of the solve plane's X and Y axes: Radial and Axial for a revolving section, else X and Y.
plane_stress
property
¶
plane_stress: bool | None
Whether a 2D elasticity solve is plane stress (True) or plane strain (False); None when the frame poses no plane state.
measure_geometry
abstractmethod
¶
measure_geometry(compound: TaggedCompound) -> GeometryCheck | None
How far every body and named face of the authored compound is from fitting this frame; None when the frame takes any model.
check_geometry
¶
check_geometry(compound: TaggedCompound) -> None
Raise FrameGeometryError when a body or named face of the authored compound does not fit this frame.
Source code in src/femforge/frames/base.py
prepare_geometry
abstractmethod
¶
The STEP the solve meshes: step_in itself, or its conversion written to step_out.
solves
abstractmethod
¶
supports
¶
solve_vector
abstractmethod
¶
The solve-coordinate components of an authored-frame vector; raises ValueError when it has no form here.
total
abstractmethod
¶
solve_share
abstractmethod
¶
The share the solve domain carries of a whole-model solve-frame vector, the inverse of total.
authored_share
¶
The solve-frame share the solve domain carries of an authored whole-model vector; raises ValueError when it has no form here.
Source code in src/femforge/frames/base.py
along
abstractmethod
¶
The component of a solve-frame vector along an authored axis, or along the frame's own axis for None.
facts
¶
Which way the solve plane faces, where it sits and how its axes run in the authored model, then the plane state when the frame poses one; none for a frame that solves the model whole.
Source code in src/femforge/frames/base.py
face_measure
¶
What a boundary group meshed as a line of length metres at centroid measures in the whole model; None for a frame that meshes faces as faces.
Parameters:
-
length(float) –L[m]: The group's length in the solve plane. -
centroid(Vec3) –[m]: The group's centroid in the solve frame.
Source code in src/femforge/frames/base.py
FrameCheck
¶
Bases: StrEnum
A rule a sectioning frame holds every body and named face of the authored model to.
Attributes:
-
TURNED–The leaf is unchanged when turned about the symmetry axis.
-
PRISM–The leaf is its mid-depth section carried through the model's depth along the normal.
-
DEPTH–The body spans the frame's thickness along the normal.
-
failure(str) –What a leaf that fails the check does, worded to follow the leaf's name.
-
remedy(str) –How to author the model so that it passes the check.
TURNED
class-attribute
instance-attribute
¶
The leaf is unchanged when turned about the symmetry axis.
PRISM
class-attribute
instance-attribute
¶
The leaf is its mid-depth section carried through the model's depth along the normal.
DEPTH
class-attribute
instance-attribute
¶
The body spans the frame's thickness along the normal.
FrameFact
pydantic-model
¶
Bases: BaseModel
One row of the Setup tab's Frame section: a label and the value it reads.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
FrameGeometryError
¶
FrameGeometryError(check: GeometryCheck)
Bases: ValueError
The authored model does not fit the frame: a body or named face mismatches a frame check beyond its tolerance.
Methods:
-
__reduce__–Rebuild from the check, so the error survives a trip between processes.
Attributes:
-
check(GeometryCheck) –The whole verdict, passing measurements included.
-
mismatches(tuple[BodyMismatch, ...]) –The measurements above the tolerance.
Source code in src/femforge/frames/base.py
check
instance-attribute
¶
check: GeometryCheck = check
The whole verdict, passing measurements included.
mismatches
instance-attribute
¶
mismatches: tuple[BodyMismatch, ...] = check.mismatches
The measurements above the tolerance.
__reduce__
¶
__reduce__() -> tuple[type[FrameGeometryError], tuple[GeometryCheck]]
Rebuild from the check, so the error survives a trip between processes.
GeometryCheck
pydantic-model
¶
Bases: BaseModel
A frame's verdict on an authored model: every measured body and named face, and the tolerance each was held to.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
measured
pydantic-field
¶
measured: tuple[BodyMismatch, ...]
Every measurement, passing ones included.
raise_for_mismatch
¶
Raise FrameGeometryError when a measurement is above tolerance.
load
classmethod
¶
load(step: Path) -> GeometryCheck | None
The check recorded beside step; None when it has no check file.
Source code in src/femforge/frames/base.py
PlaneState
¶
SolvePlane
pydantic-model
¶
Bases: ConfigArea
Where a sectioned solve's plane sits in the authored model: its origin and the authored directions of its +X and +Y.
Config:
frozen:True
Fields:
x_dir
pydantic-field
¶
x_dir: DirectionField
[-]: The authored direction of the plane's +X, the radial direction at θ = 0 of an axisymmetric section.
y_dir
pydantic-field
¶
y_dir: DirectionField
[-]: The authored direction of the plane's +Y, the symmetry axis of an axisymmetric section.
Solid
pydantic-model
¶
Bases: Frame
Solve the authored 3D model as-is.
Fields:
kind
pydantic-field
¶
kind: Literal['solid'] = 'solid'
Discriminator that names this frame in a serialized config.
description
property
¶
description: str
One sentence on what the frame solves, for a reader who has not met it.
measure_geometry
¶
measure_geometry(compound: TaggedCompound) -> GeometryCheck | None
prepare_geometry
¶
solves
¶
physics itself, except the 2D magnetostatic stack, which raises.
Source code in src/femforge/frames/solid.py
solve_vector
¶
total
¶
solve_share
¶
along
¶
The projection of vector onto axis; None raises, since a solid has no axis of its own.
Source code in src/femforge/frames/solid.py
default_frame
¶
The first shipped frame, with its default fields, that solves on model_dim dimensions: the frame of a run whose bundle names none; frames with a required field are skipped.
Source code in src/femforge/frames/__init__.py
shipped_frames
¶
The frame classes FrameUnion admits, in its order.