checks pack

6 nodes, in noodlelab and in the tiers that build on it.

Checks

Expect Conserved

checks.expect_conserved

Expect a quantity that should be conserved (energy, mass, charge, momentum) to be the same after a calculation as before it: within the tolerances, or within k standard uncertainties of the difference. The uncertainty is taken on the difference itself, so what before and after share cancels.

Inputs

Name

Type

Description

before

Any

after

Any

Optional.

relative

float

Relative tolerance, as a fraction of the value before Default 1e-06.

absolute

float

Absolute tolerance, in the unit of the value before Default 0.0.

coverage

float

With uncertainties: agree within k combined standard uncertainties Default 2.0.

Outputs

Name

Type

Description

value

Any

check

Check

Expect Converged

checks.expect_converged

Expect a result to have converged under refinement: the results of the same calculation on successively finer meshes, smaller time steps or tighter solver tolerances, coarsest first, each level finer than the one before by refinement_ratio. This is Roache’s Grid Convergence Index, the estimate of discretisation error that ASME V&V 20 uses for the numerical uncertainty of a simulation.

Inputs

Name

Type

Description

results

Any

refinement_ratio

float

How much finer each level is than the one before (h_coarse / h_fine) Default 2.0.

relative

float

The largest Grid Convergence Index allowed, as a fraction Default 0.001.

Outputs

Name

Type

Description

value

Any

check

Check

extrapolated

Any

order

float

gci

float

Expect In Range

checks.expect_in_range

Expect a number, an array or a column to lie within limits (either may be left empty). Missing values (NaN) fail unless allowed.

Inputs

Name

Type

Description

value

Any

minimum

float | None

Optional.

maximum

float | None

Optional.

unit

str

The limits’ unit, for a quantity Default ''.

allow_missing

bool

Default False.

Outputs

Name

Type

Description

value

Any

check

Check

Expect Limit

checks.expect_limit

Expect a result to approach a known limiting value: a model that must reduce to the textbook answer as a parameter goes to zero or to infinity (a correction that vanishes for small angles, a thick-plate formula that tends to the thin-plate one, a steady state after a long time). Link x and y from a sweep.

Inputs

Name

Type

Description

x

Any

y

Any

expected

Uncertain

Default 0.0.

toward

Literal['zero', 'infinity', 'value']

Where x goes: to zero, to its largest value, or to the value ‘at’ Default 'zero'.

at

float

The value x approaches, when toward is ‘value’ Default 0.0.

relative

float

Tolerance at the limit, as a fraction of the expected value (of the largest |y| when the expected value is zero) Default 0.01.

absolute

float

Absolute tolerance, in the expected value’s unit Default 0.0.

points

int

How many points nearest the limit must approach Default 3.

coverage

float

With uncertainties: agree within k combined standard uncertainties Default 2.0.

Outputs

Name

Type

Description

value

Any

check

Check

Expect Table

checks.expect_table

Expect a table to have its columns, no gaps where it matters, a unique key and a plausible number of rows.

Inputs

Name

Type

Description

table

DataFrame

columns

str

Columns it must have, comma-separated Default ''.

complete

str

Columns without missing values (* for all) Default ''.

unique

str

A column whose values must not repeat Default ''.

min_rows

int

Default 1.

max_rows

int

0: no limit Default 0.

Outputs

Name

Type

Description

value

Any

check

Check

Expect Value

checks.expect_value

Expect a result to equal a value: typed (“9.81”, “9.81 m/s^2”, “9.81 ± 0.02”) or linked. Passes within the tolerance, or, when either side has an uncertainty, when |Δ| ≤ k·u(Δ), the standard uncertainty of the difference (which is √(u₁² + u₂²) when they share no inputs). Complex values are compared by the modulus of the difference. Arrays are compared element-wise.

Inputs

Name

Type

Description

value

Any

expected

Uncertain

Default 0.0.

tolerance

float

Absolute tolerance, in the expected value’s unit Default 0.0.

relative

float

Relative tolerance, in % of the expected value Default 0.0.

coverage

float

With uncertainties: agree within k combined standard uncertainties Default 2.0.

Outputs

Name

Type

Description

value

Any

check

Check