/ proof-of-concept / plate-mechanics-sim
Sign in
proof-of-concept / plate-mechanics-sim
plate-mechanics-sim / packages / core / src / generate / library.ts
159 lines · 5.3 KBBlameHistoryRaw
1import plate_modal from "../m/plate_modal.m?raw";
2import plate_fd from "../m/plate_fd.m?raw";
3import plate_fd_plan from "../m/plate_fd_plan.m?raw";
4import plate_fd_setup from "../m/plate_fd_setup.m?raw";
5import plate_fd_loop from "../m/plate_fd_loop.m?raw";
6import plate_fd_output from "../m/plate_fd_output.m?raw";
7import plate_setup from "../m/plate_setup.m?raw";
8import plate_force_time from "../m/plate_force_time.m?raw";
9import plate_force_footprint from "../m/plate_force_footprint.m?raw";
10import plate_stress from "../m/plate_stress.m?raw";
11import plate_sdof from "../m/plate_sdof.m?raw";
12import plate_listener from "../m/plate_listener.m?raw";
13import plate_spectrum from "../m/plate_spectrum.m?raw";
14import plate_pad from "../m/plate_pad.m?raw";
15import plate_laplacian from "../m/plate_laplacian.m?raw";
16import plate_curvature from "../m/plate_curvature.m?raw";
17import plate_compare from "../m/plate_compare.m?raw";
18import plate_implicit from "../m/plate_implicit.m?raw";
19import plate_implicit_plan from "../m/plate_implicit_plan.m?raw";
20import plate_matrices from "../m/plate_matrices.m?raw";
21import plate_rigid_modes from "../m/plate_rigid_modes.m?raw";
22import plate_curvature_free from "../m/plate_curvature_free.m?raw";
23import plate_domain from "../m/plate_domain.m?raw";
24import plate_curvature_domain from "../m/plate_curvature_domain.m?raw";
25import plate_result_schema from "../m/plate_result_schema.m?raw";
27export interface SourceFile {
28 name: string;
29 source: string;
32export interface LibraryFile extends SourceFile {
33 /** One line for the code view's file list */
34 summary: string;
37/** Every `.m` file the solvers can call. The runner ships all of them with each run. */
38export const LIBRARY_FILES: LibraryFile[] = [
39 {
40 name: "plate_modal.m",
41 source: plate_modal,
42 summary: "Modal superposition on a simply supported rectangle",
43 },
44 {
45 name: "plate_fd.m",
46 source: plate_fd,
47 summary: "Explicit finite differences: setup, time loop and output in turn",
48 },
49 {
50 name: "plate_fd_setup.m",
51 source: plate_fd_setup,
52 summary: "Grid, step, load, probe, listener and operators for the explicit loop",
53 },
54 {
55 name: "plate_fd_loop.m",
56 source: plate_fd_loop,
57 summary: "Explicit time stepping; the lab has a WebGPU port of this file",
58 },
59 {
60 name: "plate_fd_output.m",
61 source: plate_fd_output,
62 summary: "Stresses, audio, spectra and the result struct from the loop's record",
63 },
64 {
65 name: "plate_fd_plan.m",
66 source: plate_fd_plan,
67 summary: "Grid, stable time step and cost of the FD scheme",
68 },
69 {
70 name: "plate_implicit.m",
71 source: plate_implicit,
72 summary: "Implicit theta-scheme: sparse Cholesky once, two triangular solves per step",
73 },
74 {
75 name: "plate_implicit_plan.m",
76 source: plate_implicit_plan,
77 summary: "Grid, accuracy-chosen time step and size of the implicit scheme",
78 },
79 {
80 name: "plate_domain.m",
81 source: plate_domain,
82 summary:
83 "The plate's footprint on the grid: every node for a rectangle, a staircase for an ellipse",
84 },
85 {
86 name: "plate_matrices.m",
87 source: plate_matrices,
88 summary: "Sparse mass, Laplacian and stiffness matrices for every edge condition and shape",
89 },
90 {
91 name: "plate_rigid_modes.m",
92 source: plate_rigid_modes,
93 summary: "Rigid-body motions of a free plate and the projector that removes them",
94 },
95 {
96 name: "plate_setup.m",
97 source: plate_setup,
98 summary: "Bending stiffness and other derived constants",
99 },
100 {
101 name: "plate_force_time.m",
102 source: plate_force_time,
103 summary: "Force history F(t): hammer pulse or harmonic drive",
104 },
105 {
106 name: "plate_force_footprint.m",
107 source: plate_force_footprint,
108 summary: "Raised-cosine spatial footprint of the load, restricted to the plate's nodes",
109 },
110 {
111 name: "plate_stress.m",
112 source: plate_stress,
113 summary: "Surface stresses, von Mises and principal stress from curvatures",
114 },
115 {
116 name: "plate_sdof.m",
117 source: plate_sdof,
118 summary: "Exact step response of one damped oscillator",
119 },
120 {
121 name: "plate_listener.m",
122 source: plate_listener,
123 summary: "Rayleigh-integral weights and delays to the listener",
124 },
125 { name: "plate_spectrum.m", source: plate_spectrum, summary: "Windowed amplitude spectrum" },
126 {
127 name: "plate_pad.m",
128 source: plate_pad,
129 summary: "Ghost layer implementing the edge conditions",
130 },
131 { name: "plate_laplacian.m", source: plate_laplacian, summary: "Five-point Laplacian" },
132 {
133 name: "plate_curvature.m",
134 source: plate_curvature,
135 summary: "Second derivatives by central differences",
136 },
137 {
138 name: "plate_curvature_free.m",
139 source: plate_curvature_free,
140 summary: "Curvatures of a free rectangle, edges from the moment condition",
141 },
142 {
143 name: "plate_curvature_domain.m",
144 source: plate_curvature_domain,
145 summary: "Curvatures on an ellipse: central differences inside, copied along the staircase",
146 },
147 { name: "plate_compare.m", source: plate_compare, summary: "Error norms between two solutions" },
148 {
149 name: "plate_result_schema.m",
150 source: plate_result_schema,
151 summary: "Documentation of the result struct",
152 },
153];
155export function libraryFile(name: string): LibraryFile {
156 const f = LIBRARY_FILES.find((x) => x.name === name);
157 if (!f) throw new Error(`unknown library file ${name}`);
158 return f;
↑↓ move↵openescclose