Skip to content

Commit dbaa88d

Browse files
committed
Update llms.txt for model options in FEAScriptWorker
setModelConfig and solve take the same options as FEAScriptModel, so every model can run in the worker. Note that coefficient functions must not use outer variables and that a Content Security Policy must allow 'unsafe-eval'.
1 parent ebea909 commit dbaa88d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎static/llms.txt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,18 @@ Newton–Raphson (nonlinear general form, front propagation): defaults `maxItera
211211
```javascript
212212
const worker = new FEAScriptWorker();
213213
await worker.ping();
214-
await worker.setModelConfig("frontPropagationScript"); // Model name only, no options
214+
await worker.setModelConfig("frontPropagationScript"); // Same options as FEAScriptModel.setModelConfig
215215
await worker.setMeshConfig({ meshDimension: "2D", elementOrder: "quadratic", numElementsX: 12, numElementsY: 8, maxX: 4, maxY: 2 });
216216
await worker.addBoundaryCondition("0", ["constantValue", 0]);
217-
const result = await worker.solve();
217+
const result = await worker.solve(); // Optional { maxIterations, tolerance }
218218
plotSolution(await worker.getModelInfo(), result, "contour", "plotDiv");
219219
worker.terminate();
220220
```
221221

222-
`FEAScriptWorker` cannot take model options (no `coefficientFunctions`, `nonlinear`, `maxIterations` or `tolerance`), so models that need coefficient functions cannot run in it.
222+
- Every method is async. `setModelConfig(name, options)` and `solve(options)` take the same options as `FEAScriptModel`, so every model can run in the worker.
223+
- Coefficient functions are sent to the worker as source code and rebuilt there, so they **must be self-contained**: write values into the function (`D: (x, u) => 0.5 * u ** 2`), never refer to outer variables (`D: (x, u) => Da * u ** 2` fails in the worker with `Da is not defined`). Wrap built-in functions: `(x) => Math.sin(x)`, not `Math.sin`.
224+
- Rebuilding the functions needs `eval`: a page with a Content Security Policy must allow `'unsafe-eval'`.
225+
- `solveAsync` and the `"jacobi-gpu"` method are not available through the worker.
223226

224227
## Errors and logging
225228

0 commit comments

Comments
 (0)