A JavaScript Finite Element Simulation Library

FEAScript is a lightweight, open-source finite element simulation library developed in JavaScript. It allows users to create and run simulations for physics and engineering problems in both browser-based and server-side environments. 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.

Getting Started

There are two ways to create simulations with FEAScript:


FEAScript latest stable release: 0.1.2 (npm External Link Icon) - See also the roadmap for the upcoming major release 0.2.0
💖 If you find FEAScript useful, please consider supporting its development through a donation:

Quick Start: To use FEAScript in your HTML, include it from our hosted build (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" from Gmsh External Link Icon ) 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 illustrative example. 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.

Features

The following lists highlights key FEAScript features:

Tutorials

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.

Documentation

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.

Licensing

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.