Skip to content

Commit fd789e0

Browse files
Add solver input validation and test scripts (#83) (#84)
Co-authored-by: ferrari212 <felipe.ferrari.212@gmail.com>
1 parent 07c1b98 commit fd789e0

11 files changed

Lines changed: 706 additions & 341 deletions

File tree

CONTRIBUTING.md

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Thank you for your interest in contributing! FEAScript is in early development,
1010
- [Branching & Workflow](#branching--workflow)
1111
- [Local Testing](#local-testing)
1212
- [Running the Node.js Examples](#running-the-nodejs-examples)
13+
- [Verifying Your Changes](#verifying-your-changes)
1314

1415
## Development Environment & Coding Style
1516

@@ -120,49 +121,10 @@ http://127.0.0.1:8000/FEAScript-website/tutorials/solidification-front-2d-worker
120121

121122
Static file server npm packages like [serve](https://github.com/vercel/serve#readme) and [Vite](https://vite.dev/) can also be used.
122123

123-
## Running the Node.js Examples
124-
125-
All examples under `examples/` can be run directly with Node.js to verify the library works in a non-browser environment. Run them from the `FEAScript-core/` directory (so that the `feascript` package resolves via `node_modules`):
124+
Testing can be also performed at the Node.js environment. In this case you can also run predefined tests to make sure nothing is broken. This performed as follows:
126125

127126
```bash
128-
cd /path/to/FEAScript-workspace/FEAScript-core
129-
130-
# Heat conduction — 1D wall
131-
node examples/heatConductionScript/heatConduction1DWall/heatConduction1DWall.js
132-
133-
# Heat conduction — 2D fin (structured mesh)
134-
node examples/heatConductionScript/heatConduction2DFin/heatConduction2DFin.js
135-
136-
# Heat conduction — 2D fin (rectangular Gmsh mesh)
137-
node examples/heatConductionScript/heatConduction2DFin/heatConduction2DFinGmsh.js
138-
139-
# Heat conduction — 2D rhomboid fin (Gmsh mesh)
140-
node examples/heatConductionScript/heatConduction2DFin/heatConduction2DRhomFinGmsh.js
141-
142-
# Advection-diffusion — 1D with Gaussian source
143-
node examples/generalFormPDEScript/advectionDiffusion1D/advectionDiffusion1D.js
144-
145-
# Solidification front propagation — 2D
146-
node examples/frontPropagationScript/solidificationFront2D/solidificationFront2D.js
147-
148-
# Lid-driven cavity — 2D creeping flow
149-
node examples/creepingFlowScript/lidDrivenCavity2DCreepingFlow/lidDrivenCavity2DCreepingFlow.js
127+
npm test
150128
```
151129

152-
Each script prints its computed solution array to the console. A successful run exits with code 0 and produces numerical output; any import or runtime error indicates a problem.
153-
154-
To run all examples in one go and check for failures:
155-
156-
```bash
157-
for f in \
158-
examples/heatConductionScript/heatConduction1DWall/heatConduction1DWall.js \
159-
examples/heatConductionScript/heatConduction2DFin/heatConduction2DFin.js \
160-
examples/heatConductionScript/heatConduction2DFin/heatConduction2DFinGmsh.js \
161-
examples/heatConductionScript/heatConduction2DFin/heatConduction2DRhomFinGmsh.js \
162-
examples/generalFormPDEScript/advectionDiffusion1D/advectionDiffusion1D.js \
163-
examples/frontPropagationScript/solidificationFront2D/solidificationFront2D.js \
164-
examples/creepingFlowScript/lidDrivenCavity2DCreepingFlow/lidDrivenCavity2DCreepingFlow.js; do
165-
echo -n " $f ... "
166-
node "$f" > /dev/null 2>&1 && echo "OK" || echo "FAILED"
167-
done
168-
```
130+
These tests compare the numerical results against stored reference solutions at selected points.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ Here is a minimal browser-based example using the FEAScript API. Adapt paths, ph
152152
- "conditionType" should be replaced with an actual boundary condition type such as "constantTemp"
153153
- "boundaryIndex" should be replaced with a string identifying the boundary
154154

155+
Furthermore, the scripts under `examples/` contain Node.js examples. You can run them from the `FEAScript-core/` directory as follows:
156+
157+
```bash
158+
node examples/heatConductionScript/heatConduction1DWall/heatConduction1DWall.js
159+
```
160+
161+
Each script prints its computed solution to the console.
162+
155163
## Support FEAScript
156164

157165
> 💖 **If you find FEAScript useful, please consider supporting its development through a donation:**

0 commit comments

Comments
 (0)