1"""Assemble the submission JSON from the per-solution meta files written by vk_modal_disk.py.
3Usage: python make_submission.py <solutions/<challenge-id>/<submission-id>> tag1 tag2 ... (in order of increasing accuracy)
4"""
5import json
6import sys
7from pathlib import Path
9HARDWARE = "Intel Core i7-1355U laptop (2 performance + 8 efficiency cores, 40 GB), single process, numpy/scipy with OpenBLAS"
12def main():
13 out_dir = Path(sys.argv[1])
14 tags = sys.argv[2:]
15 challenge_id = out_dir.parent.name
16 submission_id = out_dir.name
17 sols = []
18 prev = None
19 for tag in tags:
20 m = json.load(open(out_dir / f"vk-{tag}.meta.json"))
21 entry = {
22 "solution_id": m["solution_id"],
23 "output": m["output"],
24 "method": m["method"],
25 "parameters": m["parameters"],
26 "timing_seconds": m["timing_seconds"],
27 "more_accurate_than": [prev] if prev else [],
28 "hardware": HARDWARE,
29 }
30 if "fields" in m:
31 entry["fields"] = m["fields"]
32 sols.append(entry)
33 prev = m["solution_id"]
34 sub = {
35 "schema_version": 1,
36 "submission_id": submission_id,
37 "challenge_id": challenge_id,
38 "submitter": {"name": "Jeremy Magland", "email": "jmagland@flatironinstitute.org"},
39 "date": "2026-09-17",
40 "description": (
41 "Von Karman thin-plate reduction (Airy stress function, in-plane inertia neglected, damping on bending only) of the challenge model "
42 "on a Cartesian grid: the disk is approximated by the square cells whose centers lie inside it (a staircase boundary) at 8 mm and 4 mm spacing. "
43 "Linear free-plate modes and clamped Airy modes come from Bogner-Fox-Schmit finite elements on the cells and a sparse shift-invert eigensolver; "
44 "the bases are restricted to functions even in y, which is exact because the strike is centered on the x axis. The cubic coupling tensor is integrated "
45 "on the cells, the time stepping is a two-step scheme exact in the linear part, and the retarded Rayleigh integral uses cubic fractional delays. "
46 "The chain is ordered by grid spacing, number of modes, and time step; the mode truncation caps the frequency the cascade can reach."
47 ),
48 "code_url": "https://vault1.magland.org/challenges/cymbal-solutions/blob/main/solvers/vonkarman-modal-disk/vk_modal_disk.py",
49 "viz_url": "https://vault1.magland.org/challenges/cymbal-solutions/site/",
50 "solutions": sols,
51 }
52 with open(out_dir.parent / f"{submission_id}.json", "w") as f:
53 json.dump(sub, f, indent=1)
54 print(f"wrote {out_dir.parent / (submission_id + '.json')} with {len(sols)} solutions")
57if __name__ == "__main__":
58 main()