Skip to content

URGENT: remove two fabricated 4C input keys from the released knowledge - #52

Merged
alhermann merged 1 commit into
mainfrom
hotfix/remove-fabricated-keys
Aug 7, 2026
Merged

URGENT: remove two fabricated 4C input keys from the released knowledge#52
alhermann merged 1 commit into
mainfrom
hotfix/remove-fabricated-keys

Conversation

@alhermann

Copy link
Copy Markdown
Member

One file, 21 insertions, 11 deletions. Deliberately minimal so it can land ahead of the large consolidation in #50.

What main serves today

"needs":    [... DYN_VISCOSITY, BULK_MODULUS, SOUNDSPEED]
"pitfalls": ["SOUNDSPEED too low → fluid compresses unrealistically;
              rule of thumb c >= 10 * v_max",
             "SMOOTHING_LENGTH too small → spurious tensile-instability
              voids; rule of thumb h ~ 1.3 * particle spacing"]

Measured against the 4C checkout:

key in 4C source in 4C's 2171 upstream decks
SOUNDSPEED 0 files 0 decks
SMOOTHING_LENGTH 0 files 0 decks
MAT_ParticleSPHFluid (the real material) 2 files 60 decks

Two invented keys, listed beside two real ones, one carrying a numeric tuning rule — a rule about a parameter that does not exist. A user who follows it writes a MATERIALS block 4C refuses to parse.

And the diagnostic they get, Failed to match specification in section 'MATERIALS', is the same message a mis-cased real key produces. So the error does not tell them which mistake they made. That is why the corrected entry points at 4C -p, which dumps the accepted grammar from the binary and is the only reliable way to tell a typo from a fabrication.

Why this is separate from #50

#50 fixes this among ~2,900 other files and cannot be reviewed quickly — Copilot declined it for exceeding 300 files. Meanwhile these fabrications are live in the DOI-badged release (10.5281/zenodo.20543501), reachable by anyone who clones or cites it, and have been for the whole time the fix sat on a branch.

Where it was hiding, which is the interesting part

The text lives in the reference-stub catalog, not in a get_knowledge() row. A knowledge-level scan does not reach it — which is why it survived earlier audits — but prepare_simulation serves it, so a user does. Any future audit of served content needs to cover this path.

Verified

  • fourc backend still loads, 48 physics rows intact.
  • The fabricated tuning rule is gone from the source; the correction is present.
  • Every factual claim in the replacement text was checked against /home/alexander/4C directly.

Still outstanding on main after this

src/backends/kratos/generators/dem.py writes PARTICLE_FRICTION into every generated DEM deck. That key is absent even from the full 28-application Kratos build; the real keys are STATIC_FRICTION/DYNAMIC_FRICTION, per contact pair. It is not fixed by #50 either — #50 documents it in a warning while the template still emits it, the same contradiction this PR fixes for SOUNDSPEED. A proper generator rewrite is in progress; it needs a schema change, not a text edit, which is why it is not bundled here.

`main` currently serves, for SPH:

    "needs":    [... DYN_VISCOSITY, BULK_MODULUS, SOUNDSPEED]
    "pitfalls": ["SOUNDSPEED too low -> fluid compresses unrealistically;
                  rule of thumb c >= 10 * v_max",
                 "SMOOTHING_LENGTH too small -> spurious tensile-instability
                  voids; rule of thumb h ~ 1.3 * particle spacing"]

Measured against the 4C checkout: `SOUNDSPEED` appears in 0 files of 4C's
source and 0 of its 2171 upstream decks. So does `SMOOTHING_LENGTH`. Both were
listed beside two real parameters, and one carried a numeric tuning rule — a
rule about a key that does not exist.

A user following it writes a MATERIALS block 4C refuses to parse. Worse, the
message they get, "Failed to match specification in section 'MATERIALS'", is the
SAME message a mis-cased real key produces, so it does not tell them which
mistake they made.

The corrected entry states the absence, names the real material
(`MAT_ParticleSPHFluid`, 2 source files and 60 decks), quotes the actual
diagnostic, and points at `4C -p`, which dumps the accepted grammar from the
binary and is the only way to tell a typo from a fabrication.

This is deliberately a MINIMAL fix — one file, 21 insertions, 11 deletions —
so it can be reviewed in minutes and land ahead of the large consolidation in
PR #50. The fabrications have been reachable in the DOI-badged release the whole
time the fix sat on an unmerged branch.

Note where this text lived: the reference-stub catalog, not a `get_knowledge()`
row. A knowledge-level scan does not reach it, which is why it survived earlier
audits — but `prepare_simulation` serves it, so a user does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR corrects the 4C backend’s reference-stub catalog entry for the SPH dam-break example by removing two fabricated input keys and replacing the guidance with verifiable, solver-grounded instructions. This aligns the served “prepare_simulation” help text with 4C’s actual accepted MATERIALS grammar, reducing the risk that users generate non-parsable decks.

Changes:

  • Replaces the SPH dam-break needs entry to reference the real 4C SPH fluid material (MAT_ParticleSPHFluid) instead of the previously described fabricated parameter set.
  • Removes the fabricated SOUNDSPEED / SMOOTHING_LENGTH pitfalls (including the tuning rule) and replaces them with a warning explaining they are not valid 4C keys and how to verify accepted names via 4C -p.

@alhermann alhermann self-assigned this Aug 7, 2026
@alhermann
alhermann merged commit 863a2e3 into main Aug 7, 2026
5 checks passed
@alhermann
alhermann deleted the hotfix/remove-fabricated-keys branch August 7, 2026 16:47
alhermann added a commit that referenced this pull request Aug 9, 2026
Brings the two published hotfixes (#52, #53) onto the consolidation line
so the release branch is a superset of what is public.

Two conflicts, resolved deliberately:

src/backends/kratos/generators/dem.py — took main's side. It carries the
OMP_NUM_THREADS clamp added in review of PR #53: omp_threads=0 is not
"let OpenMP decide", it is undefined behaviour, and a DEM run reports
particle loss silently, so failing early is the kinder outcome.

src/backends/fourc/backend.py — took the consolidation side, which
deletes a 149-line block of prose "needs/pitfalls" dictionaries that main
still carries. This is not a loss: consolidation replaced all six physics
entries with input decks that actually run —
plasticity_{linear_2d,nonlinear_3d}, porous_media_{terzaghi_2d,
consolidation_3d}, particle_pd_impact and particle_sph_dambreak — each
checked present before the block was dropped.

Verified after resolution: no conflict markers survive; the thread clamp
is present; and none of SOUNDSPEED, SMOOTHING_LENGTH, PARTICLE_FRICTION
or DEM_timestep_safety_factor appears anywhere as a positive assertion.
Every remaining mention is a warning that the key does not exist, which
is the knowledge the hotfixes were written to add.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants