fem.SimulationResult

fem.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.SimulationResult.describe()

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

Returns

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

max

fem.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.SimulationResult.mean()

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

A JAX scalar; differentiable through a traced solve.

nodal_scalar

fem.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.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.SimulationResult.von_mises()

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