/ proof-of-concept / plate-mechanics-sim
Sign in
proof-of-concept / plate-mechanics-sim
plate-mechanics-sim / README.md
4.3 KBPreviewCodeBlameHistoryRaw

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:

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#

↑↓ move↵openescclose