/ proof-of-concept / plate-mechanics-sim
Sign in
proof-of-concept / plate-mechanics-sim
plate-mechanics-sim / packages / core / src / methods / fd.ts
71 lines · 3.2 KBBlameHistoryRaw
1import type { MethodDefinition } from "./types";
2import {
3 FREE_EDGE_EQUATIONS,
4 GOVERNING_EQUATIONS,
5 RADIATION_EQUATIONS,
6 STRESS_EQUATIONS,
7} from "./common";
9export const FD_METHOD: MethodDefinition = {
10 id: "fd",
11 name: "Explicit finite differences",
12 shortName: "Explicit FD",
13 summary: "Explicit second-order time stepping of the 13-point biharmonic stencil.",
14 solverFunction: "plate_fd",
15 planFunction: "plate_fd_plan",
16 supports: {
17 bc: ["simply-supported", "clamped", "free"],
18 excitation: ["impulse", "harmonic"],
19 audio: "clip",
20 },
21 readingOrder: [
22 "plate_fd.m",
23 "plate_fd_plan.m",
24 "plate_setup.m",
25 "plate_pad.m",
26 "plate_laplacian.m",
27 "plate_curvature.m",
28 "plate_matrices.m",
29 "plate_rigid_modes.m",
30 "plate_curvature_free.m",
31 "plate_force_time.m",
32 "plate_force_footprint.m",
33 "plate_stress.m",
34 "plate_listener.m",
35 "plate_spectrum.m",
36 "plate_result_schema.m",
37 ],
38 equations: [
39 ...GOVERNING_EQUATIONS,
40 {
41 tex: String.raw`(1+\sigma_0\Delta t)\,w^{n+1} = 2w^n - (1-\sigma_0\Delta t)\,w^{n-1} - \kappa^2\Delta t^2\, \mathsf L\mathsf L\, w^n + 2\sigma_1\Delta t\,\mathsf L\!\left(w^n - w^{n-1}\right) + \frac{\Delta t^2}{\mu} F^n s`,
42 caption:
43 "Explicit scheme, second order in space and time; L is the five-point Laplacian and LL the resulting 13-point biharmonic stencil.",
44 },
45 {
46 tex: String.raw`\mathsf L w_{ij} = \frac{w_{i,j+1} - 2w_{ij} + w_{i,j-1}}{\Delta x^2} + \frac{w_{i+1,j} - 2w_{ij} + w_{i-1,j}}{\Delta y^2}`,
47 caption:
48 "Supported and clamped edges enter through one ghost layer: odd reflection for simply supported (w = w_nn = 0), even reflection for clamped (w = w_n = 0). Free edges take the energy-method operators below.",
49 },
50 {
51 tex: String.raw`\Delta t \le \frac{2}{\lambda_{\max}\left(\sigma_1 + \sqrt{\kappa^2 + \sigma_1^2}\right)}, \qquad \lambda_{\max} = \frac{4}{\Delta x^2} + \frac{4}{\Delta y^2}`,
52 caption:
53 "Stability bound from von Neumann analysis; for a square grid without sigma1 it reads dt <= dx^2 / (4 kappa). Because dt scales with dx^2, halving the spacing costs eight times more work.",
54 },
55 ...FREE_EDGE_EQUATIONS,
56 ...STRESS_EQUATIONS,
57 ...RADIATION_EQUATIONS,
58 ],
59 validity: [
60 "Second-order truncation error in dx, dy and dt; the top modes on the grid are dispersive and their frequencies are too low.",
61 "The probe is snapped to the nearest interior grid node.",
62 "Stress fields are evaluated only at the saved frames, so the envelope samples the true peak.",
63 "The time-step limit makes long simulated times expensive: cost grows as (1/dx)^4 for a fixed duration.",
64 "Audio is a short clip covering only the simulated window, box-averaged onto audio samples.",
65 "Free edges: the moment and shear conditions are natural conditions of a discrete bending energy, met to first order at the boundary and second order inside; the three rigid-body motions are removed after every step, so the displacement is that of a plate on soft supports, not one drifting in space.",
66 ],
67 durationOf: (spec) => spec.fd.duration,
68 gridOf: (spec) => [spec.fd.nx, spec.fd.ny],
69 settingsKey: "fd",
70 usPerCellStep: 0.35,
71};
↑↓ move↵openescclose