Skip to content

Constant properties: producers declare their pure outputs; phase simplified - #164

Merged
petlenz merged 6 commits into
feature/constant-properties-enginefrom
feature/constant-properties-producers
Oct 21, 2026
Merged

petlenz merged 6 commits into
feature/constant-properties-enginefrom
feature/constant-properties-producers

Conversation

@petlenz

@petlenz petlenz commented Oct 21, 2026

Copy link
Copy Markdown
Member

The producers declare their pure outputs constant (part 2 of 3, split from #161; stacked on #163). As a result, the global mean-field composite of constant phases runs its kernel once: per update, Mori–Tanaka goes from 7.0 to 0.09 µs and self-consistent from 12.6 to 0.5 µs, with identical results.

What

  • Producers declaring their pure outputs (with constant_output or add_callback(...).constant() from Constant properties: engine and API #163):

    Producer Constant output(s) Reads
    constant_scalar value —
    poisson_ratio_from_moduli value —
    linear_elasticity tangent —
    Depolarisation tensors tensor —
    isotropic_tangent tangent all inputs (K, G)
    isotropic_moduli K, G, ν all inputs (the tangent)
    Eshelby tensors tensor all inputs (ν)
    phase (one group; not constant when the tangent comes over a local edge, i.e. the previous pass's) all outputs all inputs
    scalar_split every part all inputs (the source)
    weighted_sum tangent weights, tangents (not the stresses)
    mean_field_composite_global tangent, concentrations all inputs (the phase properties)
  • phase simplified: each output and the input it republishes form a relay, and input(key) reads the <key>_source/<key>_property pair (null without a source).

    • The optional Eshelby and depolarisation tensors need no branches, and the edge kind of the tangent comes from its input.
    • The constructor ends in one add_callback(...).constant().
    • The parameters are unchanged. An empty tangent_source or fraction_source now fails at construction with a clear message, instead of as a wiring error at finalize().
  • Not constant, as before: stresses, the local composites, and anything reading a history or a local edge.

  • docs/mean_field.md §3 describes when the global composite is computed once.

Measured

Global composite: matrix plus aligned spheroids (aspect ratio 5, c = 0.2), linear_stress on top, 2000 updates with a changing strain, -O2.

kernel before after stress checksum
Mori–Tanaka 7.01 µs / update 0.09 µs identical
self-consistent 12.55 µs / update 0.50 µs (mostly the first update) identical

Tests

  • MeanField.ConstantPhasesAreHomogenisedOnce:
    • a counting Mori–Tanaka kernel, registered through kernel_registry::add, is called once over five updates with a changing strain;
    • the stress follows the strain;
    • the tangent equals the plain Mori–Tanaka one exactly.
    • Before the change the kernel was called 5 times.
  • Phase.* (3 tests, written before the refactor): inconsistent parameters (initial tangent without a local edge, unknown edge, empty source, Eshelby in 2D), a negative fraction, and which tensors are relayed. Against the old code only the empty-source checks failed.

Gates (GCC 14, fetched dependencies): 1180/1180 tests, each also under ASan, 0 warnings. The build has no NDEBUG, so the whole suite ran with verification on: none of the declarations above changes on a rerun (self-consistent included).

constant_scalar, poisson_ratio_from_moduli, linear_elasticity, the Eshelby and
depolarisation tensors, isotropic_tangent, isotropic_moduli, scalar_split,
weighted_sum, phase and the global mean-field composite. With constant phases
the global composite runs its kernel once. phase relays its outputs and reads
its inputs by key.
The concentrations and the strains are separate callbacks; the concentrations
are declared constant over the phase reads and the strains run after them.
@petlenz
petlenz merged commit 3f6eefe into feature/constant-properties-engine Oct 21, 2026
0 of 3 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