Latest release GitHub release badge npm version badge Get early access to FEAScript Studio

A JavaScript finite element library, for the web.

FEAScript enables engineering simulations across both browser-based and server-side environments without the overhead of traditional desktop software.

Try it live in your browser
npm install feascript
MIT licensed View on GitHub Prefer no code? Try Tri's Lab or FEAScript Studio

Why use FEAScript

Engineering simulation, without the barriers.

FEAScript brings the finite element method to the web. You set up the model, solve it and plot the results in JavaScript, in a browser or in Node.js, and you can build the simulation into your own web pages and applications.

Nothing to install in the browser

A web page loads FEAScript from a URL, so simulations run with no setup, licenses or admin rights. In Node.js, FEAScript is one npm package.

Runs where JavaScript runs

In current web browsers on desktops, tablets and phones, and in Node.js on Windows, macOS and Linux.

Open source

The core library is free to use, change and build on under the MIT license, with no license fees.

How to use FEAScript

Run a simulation with a few lines.

Call FEAScript from JavaScript in a web page, in a playground such as CodePen or Scribbler, or in Node.js. The example below solves heat conduction in a 2D fin with a hole, live in this page: move a slider and both the code and the result change. Save the code as an HTML file to run it yourself.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Heat Conduction in a 2D Fin with a Hole</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/plotly.js/2.35.3/plotly.min.js"></script>
</head>
<body>
  <div id="resultsCanvas"></div>

  <script type="module">
    import {
      FEAScriptModel,
      importGmshMesh,
      plotInterpolatedSolution,
    } from "https://core.feascript.com/dist/feascript.esm.js";

    window.addEventListener("DOMContentLoaded", async () => {
      // 1. Create the model and select the physics
      const model = new FEAScriptModel();
      model.setModelConfig("heatConductionScript");

      // 2. Load the Gmsh mesh (any hosted .msh file works)
      const response = await fetch("https://feascript.com/tutorials/rect_with_hole_quad_quadratic.msh");
      const meshFile = new File([await response.text()], "rect_with_hole_quad_quadratic.msh");
      const mesh = await importGmshMesh(meshFile);
      model.setMeshConfig({ parsedMesh: mesh });

      // 3. Apply the boundary conditions (key = Gmsh physical group tag - 1)
      model.addBoundaryCondition("0", ["constantTemperature", 200]); // Bottom
      model.addBoundaryCondition("1", ["symmetry"]);                 // Left
      model.addBoundaryCondition("2", ["convection", 1, 20]);        // Top
      model.addBoundaryCondition("3", ["constantTemperature", 200]); // Right
      model.addBoundaryCondition("4", ["convection", 1, 20]);        // Hole

      // 4. Solve
      model.setSolverMethod("lusolve");
      const result = model.solve();

      // 5. Plot the results
      plotInterpolatedSolution(model, result, "contour", "resultsCanvas");
    });
  </script>
</body>
</html>
Result, solved in your browser

The simulation runs when this part of the page comes into view.

Features

What it solves.

FEAScript currently solves 1D and 2D problems with linear and quadratic elements.

Physical modeling

  • Creeping (Stokes) flow
  • Euler–Bernoulli beam bending
  • Front propagation
  • Heat conduction
  • General-form PDE (linear and nonlinear)

Geometry and meshing

  • Simple mesh generation (1D and 2D domains)
  • Unstructured mesh import from Gmsh (.msh file format) with quadrilateral and triangular elements (linear and quadratic)

Numerical methods

  • Linear system solvers:
    • Frontal
    • Jacobi (CPU and WebGPU versions)
    • LU (via math.js)
  • Newton–Raphson method for nonlinear systems

Performance and parallelization

  • Web worker support for multi-threaded computation

Visualization and post-processing

In development FEAScript is in development, and each release adds features. See what's new for the latest release and the roadmap. To contribute code, read the contribution guidelines.

Verification

Checked against known answers.

FEAScript is checked in three ways: against values published for standard problems, against exact solutions, and against other finite element software on the same meshes. Each result links to the test or run that produced it, so you can check it and run it yourself.

Published benchmark

18.26 °C

NAFEMS T4 target: 18.3 °C

The temperature at the target point of NAFEMS T4, a standard heat conduction benchmark with convection, on a 12 × 20 mesh of quadratic elements. The test runs on every change to FEAScript and fails if the value drifts by more than 0.1 °C. Read the NAFEMS T4 test.

Closed-form solutions

Exact

Up to rounding in double precision

Couette flow, a cantilever beam under a tip load and special cases of heat conduction with spatially varying conductivity are set up so that the finite element solution equals the exact solution at the nodes. FEAScript matches it to about 15 significant digits. See the verification tests.

Other finite element software

11 digits

Agreement with scikit-fem, node by node

For heat conduction in a 2D fin, on meshes up to 51,681 nodes, FEAScript 0.3.1 matches scikit-fem to 11 significant digits, a largest difference of 1.8e-10 °C. It also matches Elmer to within 5e-6 °C, the rounding of Elmer's output files. See the benchmark results.

NAFEMS T4 is reproduced independently. FEAScript is not affiliated with NAFEMS.

Tutorials

Learn by running.

Step-by-step tutorials, each with the full code to run in a web page, on CodePen or in Scribbler. Four to start with, one for each kind of physics:

New to finite elements? Start with Tri's Lab by FEAScript, where you learn the finite element method through games and block-based missions, with no code to write.

Heat conduction in a 2D fin results

Heat conduction

Heat conduction in a 2D fin

2D steady-state heat conduction in a cooling fin with mixed boundary conditions including constant temperature, symmetry, and convective cooling

Creeping flow on a lid-driven 2D cavity results

Creeping flow

Creeping flow in a 2D lid-driven cavity

Stokes flow in a square 2D cavity driven by a moving lid, with velocity and pressure fields resolved

Cantilever beam under a tip load results

Structural mechanics

Cantilever beam under a tip load

1D Euler–Bernoulli cantilever beam bending under a concentrated tip load, with the finite element solution verified against the classical analytical solution

Solidification front propagation results

Front propagation

Solidification front propagation in a 2D domain

Transient simulation of a solidification front advancing through a 2D domain using the eikonal equation

All tutorials

Powered by FEAScript

Built with FEAScript.

Case study

Heat Transfer Simulator

Better Building integrated FEAScript to power their online Heat Transfer Simulator for architects and engineers. Users draw a building detail from material layers, set its boundary conditions, and FEAScript solves the 2D heat conduction in the browser.

Better Building's Heat Transfer Simulator: a wall corner drawn from material layers, with the temperature field and isotherms computed by FEAScript
Screenshot courtesy of Better Building.

FEAScript Studio

Turn models into web applications.

In development

Build an app from a FEAScript model

FEAScript Studio builds a model from connected blocks, then turns it into a focused application: you choose which inputs users can change and which results they see. The apps run in the browser and can be shared by link or embedded in another website. Any model can be exported as plain FEAScript code.

Cooling fin calculator app built in FEAScript Studio, with sliders for the inputs, the coldest temperature and a temperature plot
Development version. The interface may change.

Resources

Open, documented, and growing.

What's new

The latest release, 0.3.0 with its fix 0.3.1 (October 2026), added triangular elements, the Euler–Bernoulli beam, the frontal solver for every model, vtk.js plots and VTK export, and the NAFEMS T4 test. Every change is in the changelog.

Next, 0.4.0 brings faster solvers and clearer error messages, and 0.5.0 multi-threading, units and multi-block meshes. Follow the plans in the 0.4.0 roadmap and the 0.5.0 roadmap.

Help FEAScript grow

If you find FEAScript useful, please consider supporting its development with a donation. Your support helps fund new features, performance improvements, documentation and tutorials. Companies can sponsor too, with their logo on the home page. See who already supports FEAScript on the sponsors page.

GitHub Sponsors Donate on Liberapay

Stay in the loop

Join the mailing list.

Receive project updates and news.