FLOOXS » TclLib » Verify

Verify — TclLib Procs

13 documented proc(s) in TclLib/Verify/.

::Verify::finite · ::Verify::fmt · ::Verify::peak_error_field · ::Verify::record · verify_assert · verify_close · verify_count · verify_failures · verify_newton_residual · verify_newton_update · verify_relative · verify_report · verify_reset

::Verify::finite

file: TclLib/Verify/verify.tcl

::Verify::finite — is `v` a real, finite number?

Guards the comparison arithmetic: Tcl's abs() raises on NaN, and a NaN
or Inf measured value must be recorded as a FAILED check rather than
aborting the deck with a domain error.  Returns 1 for a finite double,
0 for NaN / +-Inf / anything non-numeric.

::Verify::fmt

file: TclLib/Verify/verify.tcl

::Verify::fmt — 6-significant-digit rendering for the report lines.

Non-numeric values (a NaN that arrived as a string, an empty field
read) pass through verbatim so the log shows what actually happened.

::Verify::peak_error_field

file: TclLib/Verify/verify.tcl

::Verify::peak_error_field — max |value| of <Sol>_<suffix> over `mater`.

The two nodal error fields FLOOXS writes at every Newton update
(src/BasePDE/Genpde.cc:868-885 create them, :1002-1003 fill them) are
named after the SOLUTION, not the material, so one field per solution
covers every mesh.  Rows the contact BC has remapped are skipped by the
update loop (Genpde.cc:914) and read back as 0, so the peak is over
interior nodes only — which is exactly the set a convergence statement
is about.

The absolute value is taken inside `sel` so `peak` spends its digits on
the magnitude rather than on a sign; a missing field is a hard error
rather than a silent 0, because a bound derived from a field that was
never written would be meaningless.

::Verify::record

file: TclLib/Verify/verify.tcl

::Verify::record — the one place a check enters the log.

`measured` is the quantity being bounded (already reduced to a single
number by the caller), `bound` its allowed magnitude, `just` the
required derivation of that bound.  Prints the structured PASS/FAIL
line immediately so the ordering in the test log matches the deck, and
returns 1 on pass / 0 on fail.

verify_assert

file: TclLib/Verify/verify.tcl

verify_assert — assert |measured| <= bound.

The primitive.  `measured` is a residual, imbalance, or error the deck
has already reduced to one number; `bound` is its derived allowance;
`justification` states where that allowance comes from and is REQUIRED
(blank -> TCL_ERROR).  Returns 1 on pass, 0 on fail.

verify_close

file: TclLib/Verify/verify.tcl

verify_close — assert |measured - expected| <= bound.

Absolute-difference form for comparing against an analytic or
independently-computed value.  Same justification requirement.

verify_count

file: TclLib/Verify/verify.tcl

verify_count — number of checks recorded so far (passed and failed).

verify_failures

file: TclLib/Verify/verify.tcl

verify_failures — number of recorded checks that failed so far.

verify_newton_residual

file: TclLib/Verify/verify.tcl

verify_newton_residual — largest converged-state equation residual.

Same field family, the right-hand-side half: <Sol>_NewtonRHSError holds
|r_i| for the last assembled residual, in the units of the assembled
ROW.  Good for a convergence statement about the equation itself, and
for showing that a re-solve does not grow the residual.

NOT usable, today, to bound a terminal CURRENT: the relationship
between a bulk row's units and the `contact … flux` readback
(Solver::ComputeBoundaryReaction multiplies the flux row by
FluxScale × Bound::Scale) does not reproduce the measured terminal
imbalance — see Test/Verify/README.md, "Nodal error fields".

verify_newton_update

file: TclLib/Verify/verify.tcl

verify_newton_update — largest converged-state Newton update, in the
solutions' own units.

THE POINT.  A bound derived from `math updateLimit` and the per-solution
abserr/relerr states the largest update the convergence TEST would have
accepted.  The solve almost always does far better than it is asked to,
and the solver records by how much: this reads the update actually
applied on the final Newton step out of <Sol>_NewtonUpdError.  Using it
in place of the a-priori criterion typically tightens a
converged-state bound by three to four orders while keeping the same
derivation chain.

CAVEAT, and it is the reason this is a bound and not an identity: the
stored value is the update that PRODUCED the reported state, i.e. the
distance from the previous iterate.  Near a simple root Newton
contracts, so the remaining distance to the exact discrete solution is
no larger — conservative, but it is an assumption about the local
convergence rate and belongs in the deck's justification string.

    set du [verify_newton_update Silicon {DevPsi Qfn Qfp}]

Read it immediately after the solve whose state is being measured; a
cached bias step (`device_cache` with `norunonexists`) restores a
structure WITHOUT solving, leaving the field describing an older state.

verify_relative

file: TclLib/Verify/verify.tcl

verify_relative — assert |measured - expected| / |expected| <= bound.

Relative form, for quantities whose scale is set by the physics rather
than by the discretization.  `expected` == 0 is a usage error (the
relative error is undefined there) and raises TCL_ERROR — use
verify_assert with an absolute bound for near-zero targets.

verify_report

file: TclLib/Verify/verify.tcl

verify_report — print the summary and the harness verdict.

Re-lists every failed check (so the failures are together at the end of
a long log), prints the `Passed` / `Failed` line the CTest
PASS_REGULAR_EXPRESSION looks for, and exits 1 when anything failed.
A deck that never calls this prints no `Passed` line and therefore
fails CTest — that is deliberate.

verify_reset

file: TclLib/Verify/verify.tcl

verify_reset — clear the recorded checks and failure count.

Call once at the top of a deck.  Also used by decks that deliberately
exercise the failure path (see Test/Verify/verify_selftest.tcl) to drop
the intentional failures before the real report.