/ proof-of-concept / plate-mechanics-sim
Sign in
proof-of-concept / plate-mechanics-sim
plate-mechanics-sim / packages / core / src / spec / defaults.ts
27 lines · 1.3 KBBlameHistoryRaw
1import { MATERIAL_PRESETS, PLATE_PRESETS } from "./presets";
2import type { ProblemSpec } from "./types";
4/** The default problem: a struck A36 steel sheet, 300 x 200 x 2 mm, simply supported. */
5export function defaultSpec(): ProblemSpec {
6 const mat = MATERIAL_PRESETS[0];
7 return {
8 plate: { ...PLATE_PRESETS[0].plate },
9 material: { ...mat.material },
10 bc: "simply-supported",
11 damping: { ...mat.damping },
12 excitation: { type: "impulse", x: 0.1, y: 0.08, force: 50, duration: 1e-3, radius: 0.012 },
13 probe: { x: 0.2, y: 0.12 },
14 listener: { x: 0.15, y: 0.1, z: 1.0, c: 343, rho_air: 1.2, patches: [24, 16] },
15 output: { fs: 44100, duration: 2.0, nframes: 90, grid: [61, 41] },
16 modal: { fmax: 20000, max_modes: 400 },
17 // 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
18 fd: { nx: 41, ny: 27, cfl: 0.9, duration: 0.02 },
19 // no stability limit: the finer grid and longer window cost one factorization plus a sparse solve per step
20 implicit: { nx: 61, ny: 41, duration: 0.05, steps_per_sample: 1, theta: 0.25 },
21 };
24/** Deep-copy a spec (specs are plain data). */
25export function cloneSpec(spec: ProblemSpec): ProblemSpec {
26 return JSON.parse(JSON.stringify(spec)) as ProblemSpec;
↑↓ move↵openescclose