/ proof-of-concept / plate-mechanics-sim
Sign in
proof-of-concept / plate-mechanics-sim
plate-mechanics-sim / packages / core / src / m / plate_implicit_plan.m
32 lines · 1.4 KBCodeBlameHistory
2546961Plate mechanics lab: Kirchhoff-Love plates solved by numbl in the browserJeremy Magland 1function plan = plate_implicit_plan(params)
2% PLATE_IMPLICIT_PLAN Grid, time step and size of the implicit finite-difference scheme.
3%
4% plan = plate_implicit_plan(params) returns nx, ny, dx, dy, dt, nsteps,
5% ncells, nunknowns and cell_steps for plate_implicit. There is no stability
6% bound for theta >= 1/4; the step is set for accuracy as
7% dt = 1 / (fs * steps_per_sample)
8% and the trade-off is period elongation: for theta = 1/4 a mode of angular
9% frequency omega runs slow by a factor of about 1 + (omega dt)^2 / 12. At one
10% step per audio sample a 10 kHz mode is detuned by about 17 percent; at two
11% steps per sample by about 4 percent.
13P = plate_setup(params);
14plan.nx = P.implicit.nx;
15plan.ny = P.implicit.ny;
16if plan.nx < 5 || plan.ny < 5
17 error('plate_implicit_plan: the grid needs at least 5 nodes in each direction');
18end
19plan.dx = P.plate.Lx / (plan.nx - 1);
20plan.dy = P.plate.Ly / (plan.ny - 1);
21plan.dt = 1 / (P.output.fs * P.implicit.steps_per_sample);
22plan.nsteps = ceil(P.implicit.duration / plan.dt);
23plan.ncells = plan.nx * plan.ny;
81f3b30Elliptical plates, a WebGPU time loop for the explicit method, and WAV exportJeremy Magland 24dom = plate_domain(P.plate, plan.nx, plan.ny);
25if any(strcmp(P.bc, {'free', 'pinned-center'}))
26 plan.nunknowns = dom.nunknowns_free; % every node of the plate is in the system; see plate_matrices
81f3b30Elliptical plates, a WebGPU time loop for the explicit method, and WAV exportJeremy Magland 28 plan.nunknowns = dom.nunknowns_dirichlet; % the boundary ring carries w = 0
2546961Plate mechanics lab: Kirchhoff-Love plates solved by numbl in the browserJeremy Magland 30plan.cell_steps = plan.ncells * plan.nsteps;
31plan.theta = P.implicit.theta;
32end
↑↓ move↵openescclose