"""Write solutions//hermite-fem.json from the .meta.json files the solver leaves beside its wavs. Usage: python make_submission.py ...""" import json import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[2] DESCRIPTIONS = { "hermite-fem": "Displacement-based finite elements on a Cartesian grid masked to the annulus: bicubic Hermite (Bogner-Fox-Schmit) elements for u, v and w, lumped mass, explicit leapfrog at the in-plane stability limit, Hertz sticks as point masses stepped with the shell, Rayleigh integral accumulated at the retarded times, rigid motion held by the rigid reaction and projection. Chain ordered by grid spacing (8 mm, 5 mm).", "hermite-modal": "The same finite element system as hermite-fem, solved in its eigenmodes below a cutoff frequency: exact propagation of the damped linear part, the nonlinear force evaluated at the Gauss points of the mesh and projected on the modes, Hertz sticks, Rayleigh integral by a retarded weight table. The rigid fields are excluded from the basis. Chain ordered by grid spacing, cutoff and step.", } cid = sys.argv[1] sid = sys.argv[2] tags = sys.argv[3:] out_dir = ROOT / "solutions" / cid / sid sols = [] for k, tag in enumerate(tags): m = json.load(open(out_dir / f"{tag}.meta.json")) m.pop("peak_si", None) sticks = m.pop("sticks", None) m["notes"] = (f"Sticks: impulse {sticks['impulse_Ns']} N s, contact {sticks['contact_ms']} ms, peak force {sticks['peak_force_N']} N, " f"rebound {sticks['rebound_mps']} m/s (bell, mid, rim)." if sticks else "") m["more_accurate_than"] = tags[:k] if "output" in m: m["output"] = f"{sid}/{Path(m['output']).name}" if "fields" in m: m["fields"]["path"] = f"{sid}/{Path(m['fields']['path']).name}" sols.append(m) sub = { "schema_version": 1, "submission_id": sid, "challenge_id": cid, "submitter": {"name": "Jeremy Magland", "url": "https://vault1.magland.org/challenges/cymbal2-solutions"}, "date": "2026-09-18", "description": DESCRIPTIONS[sid], "code_url": "https://vault1.magland.org/challenges/cymbal2-solutions/tree/main/solvers/hermite-fem", "viz_url": "https://vault1.magland.org/challenges/cymbal2-solutions/site/", "solutions": sols, } with open(ROOT / "solutions" / cid / "hermite-fem.json", "w") as fh: json.dump(sub, fh, indent=1) print(ROOT / "solutions" / cid / "hermite-fem.json")