Skip to content

Coupling convergence: one per-field measure for the stop test, the noise floor and the check - #77

Merged
alhermann merged 2 commits into
mainfrom
fix/per-field-convergence
Nov 13, 2026
Merged

alhermann merged 2 commits into
mainfrom
fix/per-field-convergence

Conversation

@alhermann

Copy link
Copy Markdown
Collaborator

What changes

The coupling driver, its noise-floor measurement and the coupling check now use one convergence measure.

For each exchanged physical field f:

change_f = ||g_new,f - g_prev,f||_2 / ||g_new,f||_2

This is a discrete l2 norm over the interface points with equal weights, the per-field relative measure used by preCICE (Degroote et al. 2009). g_new is the iteration's raw export and g_prev the relaxed input that produced it.

The norm is provisional. On an interface with uneven point spacing it depends on that spacing. A later release replaces it with the exact L2 norm over the declared interface cells.

Rule

  • Statistic and stop test: the statistic is the largest field change. The coupling stops when the statistic is strictly below tol.
  • Zero change: a change at most REL_FLOOR = 1e-14 of the field (non-strict) counts as zero.
  • Undefined field: a field whose new value is exactly zero has no relative change. It is reported as undefined and never passes.
  • Non-finite values: a non-finite value gives inf and never passes.
  • Overflow: both iterates are scaled by one power of two (the largest at or below the largest magnitude) before squaring, so large values cannot overflow.
  • No default tolerance: couple and couple_levels refuse to run without tol, with a message that names the parameter. run_coupling refuses the same way.

Which columns form a field

  • Named columns: the export may name its columns in components, and flux_components does the same for normal_fluxes.
    • Names ending in x/y/z that share a base (for example ux, uy, uz) form one vector field, when at least two are present.
    • Any other name is a field of its own.
    • The coordinate names x, y, z are not fields.
  • No names: all columns of an array are one field. This is a declaration, and the result states it in fields_judged.
  • Column count: the number of columns never decides.
  • Which fields: every exported field is judged. The export format cannot say which arrays a partner receives, so this is the stricter choice. The result says so.

Noise floor

  • Measure: the same statistic, taken between replicate runs on the same imports.
  • Floor: the largest defined value over the replicate pairs. Undefined pairs do not count.
  • No floor: if no pair is defined, there is no floor and the loop continues against tol.
  • Judgement: the run is judged against max(tol, floor). The existing block mean over the last noise_block values stays, as a stated setting.

Removed

  • The entry-by-entry block residuals.
  • Their fixed-point, distance and scale clearances.
  • The per-level "excused if it shrinks" logic for the per-block caveat, including the iteration-caveat verdict branch and its excusal in the ladder verdict.

Unchanged

  • The interface-sensitivity probe keeps its own measure. It asks whether a side responds to its imports, not whether the coupling converged.
  • The balance and point-by-point profile trends.
  • The mesh-ladder (NDOF) check.

Tests

tests/test_convergence_rule.py (19 tests) covers the measure and the following controls. Each control must still fail:

  • Moving small field: a field still moving beside a settled large one, which a lumped norm reads as 1e-11.
  • Planted error: a 10 % error in a small field.
  • Diverging coupling: a coupling that does not converge.
  • Coarse ladder (regression): a mesh that did not get finer is still named by the ladder's NDOF check.
  • Edge cases: a field exported as exactly zero, non-finite values, overflow, REL_FLOOR, and tol without a default.

Further tests:

  • a contracting coupling that converges below tol;
  • the noise floor from replicate runs of a sampled side.

The full suite passes: 134 passed, 15 skipped (Windows run with POSIX shims).

Recorded runs

Recorded runs keep only the global residual history, not the per-iteration field exports, so they cannot be re-judged offline. Flips in either direction can only be found by running again. The one planned re-run will state the openPASO version it used.

…ise floor and the check

For each exchanged field f the change is ||g_new,f - g_prev,f||_2 / ||g_new,f||_2, a discrete l2 over the interface points with equal weights (the per-field relative measure preCICE uses; Degroote et al. 2009). The norm is provisional: on an interface with uneven point spacing it depends on that spacing; a norm weighted by the interface cells would not. The statistic is the largest field's change and the coupling stops when it is strictly below tol. A change at most 1e-14 of the field counts as zero; a field whose new value is exactly zero is undefined and does not pass; a non-finite value never passes; both iterates are scaled by one power of two before squaring.

Fields come from the export's optional column names (components / flux_components): ux, uy, uz form the vector field u, any other name is its own field, x/y/z are not fields. Without names each array is one field, stated in fields_judged; the column count never decides. Every exported field is judged. The noise floor is the same statistic between replicate runs, the largest defined value. The coupling check uses the same measure and limit. Removed: the entry-by-entry block residuals, their fixed-point/distance/scale clearances and the per-level 'excused if it shrinks' caveat. couple and couple_levels require tol. The interface-sensitivity probe keeps its own measure.
@alhermann
alhermann merged commit d52643f into main Nov 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant