import { MATERIAL_PRESETS, PLATE_PRESETS } from "./presets"; import type { ProblemSpec } from "./types"; /** The default problem: a struck A36 steel sheet, 300 x 200 x 2 mm, simply supported. */ export function defaultSpec(): ProblemSpec { const mat = MATERIAL_PRESETS[0]; return { plate: { ...PLATE_PRESETS[0].plate }, material: { ...mat.material }, bc: "simply-supported", damping: { ...mat.damping }, excitation: { type: "impulse", x: 0.1, y: 0.08, force: 50, duration: 1e-3, radius: 0.012 }, probe: { x: 0.2, y: 0.12 }, listener: { x: 0.15, y: 0.1, z: 1.0, c: 343, rho_air: 1.2, patches: [24, 16] }, output: { fs: 44100, duration: 2.0, nframes: 90, grid: [61, 41] }, modal: { fmax: 20000, max_modes: 400 }, // 41 x 27 keeps 20 ms of simulated time to a few seconds of solve time; a finer grid costs (dx_old/dx_new)^4 more fd: { nx: 41, ny: 27, cfl: 0.9, duration: 0.02 }, // no stability limit: the finer grid and longer window cost one factorization plus a sparse solve per step implicit: { nx: 61, ny: 41, duration: 0.05, steps_per_sample: 1, theta: 0.25 }, }; } /** Deep-copy a spec (specs are plain data). */ export function cloneSpec(spec: ProblemSpec): ProblemSpec { return JSON.parse(JSON.stringify(spec)) as ProblemSpec; }