| .mochi | |
| apps | |
| packages | |
| .gitignore | |
| .prettierrc | |
| package-lock.json | |
| package.json | |
| README.md | |
| tsconfig.base.json | |
| tsconfig.json | |
| vite.shared.ts | |
| vitest.config.ts |
Plate Mechanics Lab#
An interactive lab for the mechanics of thin metal plates. You specify geometry, material, edge conditions and an excitation; the app solves the damped Kirchhoff-Love equation and shows displacement, surface stress (von Mises and principal) over time, a probe time series and spectrum, and the radiated sound at a listener point, which you can play.
The numerics run in numbl, a MATLAB-syntax environment executing in the browser. The MATLAB source shown on screen is the source that ran: edit any file and rerun. No physics is computed in JavaScript; the host only draws arrays and plays samples.
Layout#
packages/core problem spec, .m generation, numbl runner, result typing, field and colormap primitives (no UI)
packages/core/src/m the MATLAB library: plate_modal.m, plate_fd.m, plate_stress.m, ...
packages/components React components: code view, parameter panel, field view, plots, equations, run status, audio
apps/lab the app: one arrangement of the components
apps/tutorials MDX documents with embedded interactive views (one tutorial: the CFL limit)
The app and the tutorials are peers over the same core and components.
Methods#
Three methods solve the same problem specification, and the app can run any two and compare them directly:
- Modal superposition (
plate_modal.m): closed-form modes of the simply supported rectangle, each integrated exactly in time for piecewise-linear forcing. No time-step limit; the approximation is the modal truncation. - Explicit finite differences (
plate_fd.m): second-order scheme with the 13-point biharmonic stencil, simply supported or clamped edges. Stable only below the CFL bound fromplate_fd_plan.m; the slider goes past it on purpose. - Implicit finite differences (
plate_implicit.m): the same stencils assembled as sparse matrices (plate_matrices.m), stiffness averaged over three time levels (theta scheme, theta = 1/4 is the trapezoidal rule). One sparse Cholesky factorization, two triangular solves per step, no stability limit; the step is chosen for accuracy. Needs numbl 0.4.21 or later for its sparse direct solvers.
A method is a data record (packages/core/src/methods/*.ts) plus a .m file. Adding one means adding both; nothing else in core changes.
The live app#
The lab is deployed at https://plate-mechanics-sim.vault1-sites.magland.org/. .mochi/workflows/deploy.yml
builds apps/lab on every push to main and publishes it; the tutorials are not part of that artifact. The
site sits at the root of an origin of its own, so the build's base path comes from configure-pages rather
than being written into the Vite config.
Running#
npm install
npm run dev # the lab, http://localhost:5173
npm run dev:tutorials # the tutorials
npm test # vitest: runs the .m files in numbl under Node and checks modal vs FD, CFL, frequencies, editing
npm run typecheck
npm run build
The .m files also run unchanged from the numbl CLI, Octave or MATLAB:
npx numbl run --path packages/core/src/m my_script.m
Honest limits#
- Kirchhoff-Love thin-plate theory: no shear deformation or rotary inertia, so thick plates and very high modes are wrong.
- Edge conditions are idealizations; free edges are not yet supported.
- Damping is a two-parameter model, chosen, not measured.
- Stress is a second derivative of the displacement and converges more slowly than displacement in both methods; near the strike it depends on the load footprint.
- Radiated sound is Rayleigh's integral in an infinite baffle: an estimate of the waveform, not a calibrated level.
- Explicit finite differences cost about 0.3 µs per cell-step in the browser, and the stable step scales with dx². The default 41 x 27 grid gives 20 ms in a few seconds; refining to 61 x 41 costs about five times more. The implicit scheme removes the step limit (about 1 ms per step on 61 x 41) at the price of detuning the highest modes; long simulated times still belong to the modal method.