Skip to main content
Version: 0.4.0

Examples overview

FEAScript-core ships with Node.js examples for every model, in the examples folder. Each example is a single script that sets up a model in the five steps of your first simulation, solves it and prints the results.

These pages show, for each example, the geometry and boundary conditions, the mesh, and the results. The results were computed with FEAScript-core 0.4.0, by running the examples unchanged.

Examples​

ModelExampleMesh
Heat conductionWall in 1D10 linear elements
Heat conductionBi-material wall in 1D20 linear elements
Heat conductionFin in 2D8 × 4 quadratic quadrilaterals
Heat conductionFin in 2D, Gmsh mesh30 quadratic quadrilaterals (Gmsh)
Heat conductionRhomboid fin in 2D, Gmsh mesh24 quadratic quadrilaterals (Gmsh)
Heat conductionFin in 2D with spatially varying k and Q8 × 4 quadratic quadrilaterals
General-form PDEAdvection-diffusion in 1D20 quadratic elements
General-form PDENonlinear reaction-diffusion in 1D20 linear elements
Front propagationSolidification front in 2D12 × 8 quadratic quadrilaterals
Creeping flowLid-driven cavity in 2D12 × 6 Q2-Q1 quadrilaterals
Creeping flowCouette flow in 2D4 × 2 Q2-Q1 quadrilaterals
Euler–Bernoulli beamClamped and spring-supported beam2 cubic Hermite elements
Euler–Bernoulli beamCantilever beam4 cubic Hermite elements

Running an example​

The examples import FEAScript from npm. In the folder of a model (for example examples/heatConduction), or in an empty folder with a copy of the example:

  1. Create a package.json with ES module support:

    echo '{"type":"module"}' > package.json
  2. Install FEAScript:

    npm install feascript
  3. Run the example, for example:

    node heatConduction2DFin/heatConduction2DFin.js

The Gmsh examples read their .msh file from the folder of the script, so they can be run from any folder. Every example prints the FEAScript version first, then its results: some print the node coordinates and the solution vector, others a short summary next to the exact or published values. The command to run each example is given in its section.

How the figures were made​

Geometries and meshes are drawn from the same values as the examples: the structured meshes from the mesh generator of FEAScript, the Gmsh meshes from the .msh files of the examples. The result figures show the solution that each example computes. Contour lines follow the finite element solution inside each element: the field is evaluated with the shape functions of the element on a fine grid of points, not interpolated linearly between the nodes. The highest and lowest values quoted on these pages are found the same way, so they can lie between the nodes.