fem.result.SimulationResult

fem.result.SimulationResult(
    name,
    kind,
    field,
    solution,
    sim_mesh=None,
    mass=None,
    yield_strength=None,
)

One solved study: named, typed, inspectable, exportable.

Attributes

Name Type Description
name str The study’s name.
kind str "thermal" or "elastic".
field str Display scalar name — "temperature" or "von_mises".
solution ThermalResult | ElasticResult The underlying solver result (:class:~cadjoint.fem.simulate.ThermalResult or :class:~cadjoint.fem.simulate.ElasticResult).
sim_mesh Any The :class:~cadjoint.fem.simmesh.SimMesh the study solved on (None when a raw HexMesh was passed to solve).
mass Any Mass of the solved domain in kg — sum(rho_e * V_e) over the elements — or None when the scene’s materials state no density. Traced whenever the solve was, so it can be optimized against.
yield_strength Any Per-element yield strength (C,) in Pa, or None when the materials state none; drives :attr:safety_factor.

Methods

Name Description
describe JSON-ready summary of the solved result (concrete results only).
max Max of the objective scalar (temperature / displacement magnitude).
mean Mean of the objective scalar (temperature / displacement magnitude).
nodal_scalar The concrete per-node display field named by :attr:field.
to_vtk Write mesh + fields as a VTK file for ParaView (concrete only).
von_mises Per-cell von Mises stress (C,) (elastic results, concrete only).

describe

fem.result.SimulationResult.describe()

JSON-ready summary of the solved result (concrete results only).

Returns

Name Type Description
dict[str, Any] {"name", "kind", "field", "mesh", "nodes", "elements", | | | dict\[str, Any\] | "range", "fields", "mass", "safety_factor", "refinement"}
dict[str, Any] where mesh is
dict[str, Any] the SimMesh name (or None), range is the [min, max] of
dict[str, Any] the display field of :meth:nodal_scalar, fields maps each
dict[str, Any] solved field to a {"min", "mean", "max"} summary
dict[str, Any] (displacement summarized by magnitude, von Mises per cell), and
dict[str, Any] mass (kg) / safety_factor are None when the scene’s
dict[str, Any] materials do not make them computable. refinement is None
dict[str, Any] unless the tet mesher had to re-dice the declared grid, in
dict[str, Any] which case it is {"declared", "used", "attempts"} — the
dict[str, Any] declared and actually-used cell counts and how many
dict[str, Any] extractions it took (:attr:refinement holds the full record).

max

fem.result.SimulationResult.max()

Max of the objective scalar (temperature / displacement magnitude).

A JAX scalar; differentiable through a traced solve (subgradient at ties, as usual for max).

mean

fem.result.SimulationResult.mean()

Mean of the objective scalar (temperature / displacement magnitude).

A JAX scalar; differentiable through a traced solve.

nodal_scalar

fem.result.SimulationResult.nodal_scalar()

The concrete per-node display field named by :attr:field.

Temperature for thermal results; the cell-centered von Mises stress averaged onto nodes for elastic results. Concrete only (this is the array the viewer colors the surface with).

to_vtk

fem.result.SimulationResult.to_vtk(path)

Write mesh + fields as a VTK file for ParaView (concrete only).

Reuses the underlying result’s writer: temperature for thermal, displacement + von Mises for elastic.

von_mises

fem.result.SimulationResult.von_mises()

Per-cell von Mises stress (C,) (elastic results, concrete only).