Skip to content

0.4.0

Latest

Choose a tag to compare

@nikoscham nikoscham released this 13 Nov 08:44
· 1 commit to main since this release

FEAScript 0.4.0

This release adds a built-in triangle mesh generator and one way to set up a domain, whatever its mesh, so a 2D case can be set up and solved entirely in JavaScript. It also makes the solvers faster on larger problems, reports every input mistake with a clear error, and starts moving the API towards a stable 1.0, with named boundary conditions, solver options and TypeScript declarations.

New Features

Geometry and Meshing

  • Added setGeometry() to describe the domain (a line, a rectangle, or a polygon with holes whose boundaries are named) and setMeshConfig() to say how to mesh it, with quadrilaterals or triangles, linear or quadratic, by element size or number. Boundary conditions are keyed by the boundary names, e.g. "top", also for Gmsh meshes, where they are the names of the physical groups (#135) - Contributed by @nikoscham
  • Added generateTriangleMesh(), a mesh generator for polygons with holes based on Delaunay refinement (Ruppert's algorithm), with a smallest angle set by the user and an element size that can vary with position (#135) - Contributed by @nikoscham
  • Added generateQuadrilateralMesh(), the structured mesher extended to any convex four-sided shape, and setMesh(), which takes a generated or an imported mesh - Contributed by @nikoscham

Physical Modeling

  • Creeping flow: no-slip conditions now take precedence at corners shared with a moving wall, so the lid-driven cavity is mirror-symmetric (#131) - Contributed by @nikoscham

Numerical Methods

  • The system matrix is assembled directly into typed-array CSR storage, which cuts memory use (#120) - Contributed by @nikoscham
  • The frontal solver no longer runs out of memory on medium-sized problems: its front is sized from its actual width and kept narrow by reordering the elements. A 160×80 linear mesh solves in 1.1 s instead of 31 s on an Intel N100 (#121) - Contributed by @nikoscham
  • The frontal solver now runs the nonlinear general form PDE inside Newton–Raphson (#101) - Contributed by @nikoscham
  • The sparse LU solver uses a fill-reducing ordering suited to each model. The lid-driven cavity on a 64×64 mesh solves in 10 s instead of 145 s (#132) - Contributed by @nikoscham
  • Repeated sparse LU solves, including every Newton–Raphson iteration, now run at the speed of the first one, and sparse LU in Firefox is 3 to 12 times faster (#136) - Contributed by @nikoscham
  • Dirichlet conditions are applied symmetrically, so a symmetric system matrix stays symmetric (#117) - Contributed by @nikoscham
  • The Jacobi solvers, on the CPU and on the GPU, stop on the residual relative to the right-hand side, so their tolerance means the same for both (#113) - Contributed by @nikoscham
  • solve() returns a run report, result.info: the solver method, iterations, residual, Newton–Raphson iterations and solve time (#127) - Contributed by @nikoscham

API

  • Boundary conditions are objects with named parameters, e.g. { type: "convection", h: 1, ambientTemperature: 20 } (#123) - Contributed by @nikoscham
  • The linear solver is set with setModelConfig(model, { solver: { method, maxIterations, tolerance } }) (#122) - Contributed by @nikoscham
  • Model names lose the Script suffix, e.g. "heatConduction" (#124) - Contributed by @nikoscham
  • Invalid input throws a FEAScriptError with an error code, listing every problem at once, instead of logging an error and going on (#125) - Contributed by @nikoscham
  • Added a version export (#128) - Contributed by @nikoscham

Visualization & Post-Processing

  • Contour plots show the correct values in quadratic elements with curved edges (#134) - Contributed by @nikoscham

Parallelization

  • FEAScriptWorker supports setGeometry() and setMesh(), and starts its first call as soon as the worker is ready - Contributed by @nikoscham
  • FEAScript can be loaded with a classic <script> tag, from a CDN too, with working web workers - Contributed by @nikoscham
  • The WebGPU solver ("jacobi-gpu") stops with a clear error where WebGPU is missing, and gives correct results when its compute engine is reused for systems of different sizes - Contributed by @nikoscham

Testing & Package Distribution

  • The npm package ships TypeScript declarations, so TypeScript projects are type-checked and editors complete the API as you type, in JavaScript too (#126) - Contributed by @nikoscham
  • Added the Code_Aster TPLP302 and TPLP01 benchmark tests for 2D heat conduction (#130), and browser tests of the script-tag build - Contributed by @nikoscham
  • The bundles are about 60% smaller, as only the math.js functions in use are included - Contributed by @nikoscham
  • Performance benchmarks against Elmer and scikit-fem: https://github.com/FEAScript/FEAScript-benchmark (#52) - Contributed by @nikoscham

Breaking Changes

  • A solve that cannot succeed, and invalid input, now throw a FEAScriptError instead of logging an error and returning a result. Code that read a partial result after a failure must catch the error
  • The "constantTemp" boundary condition is removed; use { type: "constantTemperature", temperature } (#129)
  • The Jacobi solver stops on the relative residual with a default tolerance of 1e-8, so its iteration counts and results differ slightly from 0.3
  • The example folders are named after the models, e.g. examples/heatConduction/
  • Results change slightly for creeping flow with a moving wall (#131) and for contour plots on curved quadratic elements (#134)

Deprecated

These keep working with a warning: the mesh settings of 0.3 (numElementsX, maxX, ... and parsedMesh), the numeric boundary keys "0" to "3", model names with the Script suffix, the array form of boundary conditions, setSolverMethod() and printVersion.

See the changelog for the full list of changes.

Code Statistics

Files Code Lines Comment Lines Blank Lines Total Lines
162 25,525 9,339 2,413 37,277

Contributors