1/**
2 * The PDEs the app can solve and preset right-hand sides / coefficients.
3 * Expressions are MATLAB, elementwise in the surface coordinates x, y, z;
4 * they are pasted verbatim into the generated solver call (everything runs
5 * client-side, so this is the user talking to their own interpreter).
6 */
8export interface ExprPreset {
9 label: string
10 expr: string
11}
13export interface PdeDef {
14 id: 'poisson' | 'helmholtz'
15 label: string
16 equation: string
17 note: string
18 fPresets: ExprPreset[]
19 cPresets: ExprPreset[] | null
20}
22export const PDES: PdeDef[] = [
23 {
24 id: 'poisson',
25 label: 'Poisson (Laplace–Beltrami)',
26 equation: 'Δu = f',
27 note:
28 'On a closed surface f is projected to mean zero and the mean-zero ' +
29 'solution is returned; on an open surface, u = 0 on the boundary.',
30 fPresets: [
31 { label: 'x·y·z', expr: 'x.*y.*z' },
32 { label: 'sin(3x)·cos(3y)', expr: 'sin(3*x).*cos(3*y)' },
33 { label: 'tanh(5z)', expr: 'tanh(5*z)' },
34 { label: 'x', expr: 'x' },
35 ],
36 cPresets: null,
37 },
38 {
39 id: 'helmholtz',
40 label: 'Helmholtz (variable coefficient)',
41 equation: '(Δ + c)u = f',
42 note:
43 'c may vary over the surface. With c near an eigenvalue of −Δ the ' +
44 'problem approaches singular and the solution blows up.',
45 fPresets: [
46 { label: 'Constant 1', expr: '1' },
47 { label: 'x·y·z', expr: 'x.*y.*z' },
48 { label: 'sin(3x)·cos(3y)', expr: 'sin(3*x).*cos(3*y)' },
49 ],
50 cPresets: [
51 { label: '100·(1 − z)', expr: '100*(1 - z)' },
52 { label: 'Constant 100', expr: '100' },
53 { label: '50·(1 + x)', expr: '50*(1 + x)' },
54 ],
55 },
56]
58/** Above this many cells, warn that the solve may take a while. */
59export const SLOW_CELLS = 1500
61export const MIN_ORDER = 2
62export const MAX_ORDER = 10
63export const DEFAULT_ORDER = 6