1import type { MethodDefinition } from "./types";
2import { GOVERNING_EQUATIONS, RADIATION_EQUATIONS, STRESS_EQUATIONS } from "./common";
4export const IMPLICIT_METHOD: MethodDefinition = {
5 id: "implicit",
6 name: "Implicit finite differences",
7 shortName: "Implicit FD",
8 summary:
9 "Same stencils as the explicit scheme, stiffness averaged in time; one sparse factorization, no step limit.",
10 solverFunction: "plate_implicit",
11 planFunction: "plate_implicit_plan",
12 supports: {
13 bc: ["simply-supported", "clamped"],
14 excitation: ["impulse", "harmonic"],
15 audio: "clip",
16 },
17 readingOrder: [
18 "plate_implicit.m",
19 "plate_implicit_plan.m",
20 "plate_matrices.m",
21 "plate_setup.m",
22 "plate_force_time.m",
23 "plate_force_footprint.m",
24 "plate_stress.m",
25 "plate_pad.m",
26 "plate_curvature.m",
27 "plate_listener.m",
28 "plate_spectrum.m",
29 "plate_result_schema.m",
30 ],
31 equations: [
32 ...GOVERNING_EQUATIONS,
33 {
34 tex: String.raw`\frac{w^{n+1} - 2w^n + w^{n-1}}{\Delta t^2} + \sigma_0\frac{w^{n+1} - w^{n-1}}{\Delta t} - \sigma_1 \mathsf L\frac{w^{n+1} - w^{n-1}}{\Delta t} + \kappa^2 \mathsf B\left(\theta w^{n+1} + (1-2\theta) w^n + \theta w^{n-1}\right) = \frac{F^n s}{\mu}`,
35 caption:
36 "Theta scheme: the biharmonic term is averaged over three time levels. L and B are the sparse Laplacian and biharmonic matrices built from the same stencils as the explicit scheme.",
37 },
38 {
39 tex: String.raw`\mathbf A\, w^{n+1} = \mathbf C\, w^n - \mathbf A_{\mathrm{old}}\, w^{n-1} + \frac{\Delta t^2}{\mu} F^n s, \qquad \mathbf A = (1+\sigma_0\Delta t)\mathbf I - \sigma_1\Delta t\,\mathsf L + \theta\kappa^2\Delta t^2\,\mathsf B`,
40 caption:
41 "One linear system per step with a constant symmetric positive definite matrix: factor A once by sparse Cholesky, then two triangular solves per step.",
42 },
43 {
44 tex: String.raw`\theta \ge \tfrac14 \;\Rightarrow\; \text{stable for every } \Delta t, \qquad \frac{T_{\text{num}}}{T} \approx 1 + \frac{(\omega\Delta t)^2}{12} \;\; (\theta = \tfrac14)`,
45 caption:
46 "No stability limit, so the step is chosen for accuracy. The price is period elongation: modes near half the sample rate run slow by tens of percent unless several steps per sample are used.",
47 },
48 ...STRESS_EQUATIONS,
49 ...RADIATION_EQUATIONS,
50 ],
51 validity: [
52 "Second-order truncation error in dx and dy, identical to the explicit scheme, since the spatial stencils are the same.",
53 "Second order in dt but dispersive: high modes are detuned rather than unstable. Two steps per sample keeps a 10 kHz mode within about 4 percent.",
54 "The probe is snapped to the nearest interior grid node; stress fields are evaluated only at the saved frames.",
55 "Cost per step is a sparse triangular solve pair, about a millisecond for a 61 x 41 grid in the browser, independent of the plate stiffness.",
56 "Audio covers only the simulated window.",
57 ],
58 durationOf: (spec) => spec.implicit.duration,
59 gridOf: (spec) => [spec.implicit.nx, spec.implicit.ny],
60 settingsKey: "implicit",
61 usPerCellStep: 1.0,
62};