Installation
FEAScript 0.2.0 solves linear systems with math.js, which it expects as a global
math object. Load math.js before you call solve(), as shown below.
In the browser
Load math.js with a <script> tag, then import the ES module build of FEAScript 0.2.0 from a CDN:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/11.12.0/math.min.js"></script>
<script type="module">
import { FEAScriptModel } from "https://cdn.jsdelivr.net/npm/feascript@0.2.0/dist/feascript.esm.js";
</script>
https://core.feascript.com/dist/feascript.esm.js always serves the latest release of FEAScript, not 0.2.0. Pin
the version in the URL, as above, to keep using 0.2.0.
FEAScriptWorker and the "jacobi-gpu" solver
start web workers whose scripts are not part of the bundled build. To use them, import the source modules
instead:
import { FEAScriptWorker } from "https://cdn.jsdelivr.net/npm/feascript@0.2.0/src/index.js";
You can also download the release from GitHub Releases and import it locally.
With Node.js
npm install feascript@0.2.0 mathjs
import * as math from "mathjs";
global.math = math;
import { FEAScriptModel } from "feascript";
FEAScript is built as an ES module. In a new project, set "type": "module" in your package.json.
Optional dependencies
The plotting functions use Plotly, through the global Plotly object. In the
browser, load plotly.min.js with a <script> tag (see Visualization).
Environments
| Feature | Browser | Node.js |
|---|---|---|
Models, meshes, solve() | ✓ | ✓ |
importGmshQuadTri | ✓ | ✓ (pass an object with a text() method) |
| Plotting with Plotly | ✓ | |
FEAScriptWorker | ✓ | |
"jacobi-gpu" with solveAsync() | ✓ (WebGPU required) |