FEAScript is a lightweight, open-source finite element simulation library developed in JavaScript. It allows users to create and run client-side, browser-based simulations for physics and engineering problems without requiring additional installations. FEAScript serves as an excellent tool for building interactive web applications and facilitates hands-on learning of computational mechanics by providing a versatile platform to explore and solve complex problems. Our goal is to democratize finite element analysis by making simulation capabilities accessible to everyone, everywhere.
FEAScript requires only a simple HTML page to operate. All simulations are executed locally in your browser, without the need for any cloud services. The entire workflow is performed using JavaScript objects directly in the HTML file.
There are two ways to create simulations with FEAScript:
Quick Start: To use FEAScript in your HTML include it via CDN
(https://core.feascript.com/dist/feascript.esm.js
) or download it from
GitHub → add a canvas
(e.g., <div id="solutionPlot"></div>
) → add a mesh file (e.g., "your.msh")
or use FEAScript mesh generation tools → create and run a simulation using the JavaScript API (see
tutorials for detailed examples):
<body> <!-- ...body region... --> <script type="module"> // Import FEAScript library import { FEAScriptModel, importGmshQuadTri, plotSolution } from "https://core.feascript.com/dist/feascript.esm.js"; window.addEventListener("DOMContentLoaded", async () => { // Load and parse Gmsh mesh const meshContent = await (await fetch("path/to/your.msh")).text(); const meshFile = new File([meshContent], "your.msh"); const parsedMesh = await importGmshQuadTri(meshFile); // Create and configure model const model = new FEAScriptModel(); model.setSolverConfig("solverType"); // e.g., "solidHeatTransferScript" model.setMeshConfig({parsedMesh, meshDimension: "2D", elementOrder: "linear"}); // Apply boundary conditions (Gmsh physical group tags) model.addBoundaryCondition("boundaryIndex", ["conditionType", /* parameters */]); // Solve const { solutionVector, nodesCoordinates } = model.solve(); // Plot results plotSolution(solutionVector, nodesCoordinates, model.solverConfig, model.meshConfig.meshDimension, "contour", "solutionPlot", "unstructured"); }); </script> <!-- ...continue of body region... --> </body>
The above code is an indicative usage example of FEAScript. Adapt paths, solver types, and boundary conditions to your specific problem.
🚧 FEAScript is currently under heavy development with new features being added regularly. Interested in contributing? Please check out our contribution guidelines to get started.
The following lists contain some, but not all, of the available features in FEAScript:
For a visual approach to creating simulations, we are also developing the
FEAScript platform - a
browser-based visual editor built on the
Blockly
library. This no-code interface allows users to build and run finite element
simulations directly in their browser by connecting visual blocks. While FEAScript's JavaScript API
offers full programmatic control for advanced customization, the FEAScript platform provides an
accessible entry point for users without coding experience. FEAScript platform also provides the ability
to save and load projects in XML format, enabling easy sharing and reuse of simulation configurations.
Below, you can explore tutorials that provide a step-by-step introduction to FEAScript. These tutorials show you how to use FEAScript's JavaScript API directly - for integrating finite element simulations into your own websites and applications - or how to use the FEAScript platform visual editor for a no-code experience.
Please report any feedback on the above tutorials to the GitHub discussions or issues.
The documentation for FEAScript is currently under development. In the meantime, for information on the numerical methods used in FEAScript and other technical resources, please visit the FEAScript Blog.
The core library of FEAScript is distributed under the terms of the MIT license. This website is licensed under a Creative Commons Attribution 4.0 license.