crashmetrics.quality¶
quality
¶
Model quality check sheet: is this run fit to be trusted?
Before anyone reads injury values or intrusions from a crash run, the
run itself is checked: did it finish, is the mass right, how much mass
did mass scaling add, is the energy balance sound, do the contacts
behave. check_model does that in one pass from the files every run
writes and returns a QualitySheet with a status per check.
- Run (d3hsp, glstat): termination, end time reached, errors, warnings.
- Mass (d3hsp, glstat, matsum): total mass and centre of gravity against targets; added mass at the start and at its peak, its growth, added mass per part.
- Time step (glstat, d3hsp): time step and its drop, the mass scaling setting, the smallest elements and the mass factor they need.
- Energy (glstat, matsum): energy ratio, hourglass, negative contact
energy, damping and the part checks of
crashmetrics.energy_check. - Contacts (sleout, glstat): negative energy of each contact.
A check is PASS, FAIL, WARN (advisory limits), INFO (no
limit) or SKIP (file or value missing); a sheet passes when nothing
fails. Limits are in QualityLimits; they are common practice, not a
standard, so set your team's values. Values are reported in kg, mm,
ms and kJ. quality_matrix puts several runs side by side.
crashmetrics.synthetic writes runs to try this without a solver.
MASS_TO_KG
module-attribute
¶
MASS_TO_KG: dict[str, float] = {
"mm-ms-kg": 1.0,
"mm-s-t": 1000.0,
"mm-s-kg": 1.0,
"m-s-kg": 1.0,
}
Unit system -> factor from the model's mass unit to kg.
QualityLimits
dataclass
¶
QualityLimits(
mass_tolerance: float = 1.0,
cg_tolerance: float = 10.0,
added_mass: float | None = 5.0,
added_mass_growth: float | None = 1.0,
part_added_mass: float | None = 20.0,
end_time: float = 99.5,
timestep_drop: float | None = 10.0,
element_mass_factor: float | None = 4.0,
contact_negative: float | None = 1.0,
warnings: int | None = None,
energy: EnergyLimits = EnergyLimits(),
)
Acceptance limits of the check sheet (None switches a check to
INFO). Breaking a limit fails the check, except the advisory
ones, which warn.
mass_tolerance
class-attribute
instance-attribute
¶
Total mass against the target, %.
cg_tolerance
class-attribute
instance-attribute
¶
Distance of the centre of gravity from the target, mm.
added_mass
class-attribute
instance-attribute
¶
Added mass at the start and at its peak, % of the model mass.
added_mass_growth
class-attribute
instance-attribute
¶
Advisory: growth of the added mass during the run, % points.
part_added_mass
class-attribute
instance-attribute
¶
Added mass of a part, % of the part's mass.
end_time
class-attribute
instance-attribute
¶
Problem time reached, % of the termination time.
timestep_drop
class-attribute
instance-attribute
¶
Advisory: fall of the time step below its first value, %.
element_mass_factor
class-attribute
instance-attribute
¶
Advisory: mass factor the smallest element needs to reach the
mass-scaled time step, (dt / dt_element)^2.
contact_negative
class-attribute
instance-attribute
¶
Most negative energy of one contact, % of the peak internal energy.
warnings
class-attribute
instance-attribute
¶
Advisory: number of solver warnings.
energy
class-attribute
instance-attribute
¶
energy: EnergyLimits = field(default_factory=EnergyLimits)
Limits of the energy checks (its added mass limit is not used:
added_mass above is).
QualityCheck
dataclass
¶
QualitySheet
dataclass
¶
QualitySheet(
run: str,
checks: tuple[QualityCheck, ...],
files: dict[str, str] = dict(),
notes: tuple[str, ...] = (),
)
check_model_data
¶
check_model_data(
name: str,
*,
d3hsp: D3hsp | None = None,
glstat: GlobalEnergies | None = None,
matsum: PartEnergies | None = None,
sleout: AsciiOutput | None = None,
unit_system: str = "mm-ms-kg",
target_mass: float | None = None,
target_cg: Sequence[float] | None = None,
limits: QualityLimits | None = None,
files: dict[str, str] | None = None,
notes: Sequence[str] = (),
) -> QualitySheet
The check sheet from data already read (see check_model).
check_model
¶
check_model(
directory: str | Path,
name: str | None = None,
*,
unit_system: str = "mm-ms-kg",
target_mass: float | None = None,
target_cg: Sequence[float] | None = None,
limits: QualityLimits | None = None,
) -> QualitySheet
The model quality check sheet of a run folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | Path
|
Run folder with |
required |
name
|
str | None
|
Run name; the folder name by default. |
None
|
unit_system
|
str
|
Unit system of the model (masses to kg, lengths to mm, times to ms, energies to kJ). |
'mm-ms-kg'
|
target_mass
|
float | None
|
Target vehicle mass (kg) and centre of gravity (x, y, z in mm, in the model's coordinate system); without them mass and centre of gravity are reported only. |
None
|
target_cg
|
float | None
|
Target vehicle mass (kg) and centre of gravity (x, y, z in mm, in the model's coordinate system); without them mass and centre of gravity are reported only. |
None
|
limits
|
QualityLimits | None
|
|
None
|
quality_matrix
¶
quality_matrix(
sheets: Sequence[QualitySheet], *, values: bool = True
) -> str
Markdown table of several runs side by side: one row per check, one column per run (status, and the number where the check has one).