Skip to content

Commit 156adc3

Browse files
authored
Feature/integrate stdlib (#81)
See the issue #78
1 parent ba8c8eb commit 156adc3

27 files changed

Lines changed: 6683 additions & 313 deletions

CONTRIBUTING.md

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Thank you for your interest in contributing! FEAScript is in early development,
99
- [File Structure](#file-structure)
1010
- [Branching & Workflow](#branching--workflow)
1111
- [Local Testing](#local-testing)
12+
- [Running the Node.js Examples](#running-the-nodejs-examples)
1213

1314
## Development Environment & Coding Style
1415

@@ -101,10 +102,67 @@ Before submitting a pull request, test your modifications by running the FEAScri
101102
import { FEAScriptModel, plotSolution, printVersion } from "[USER_DIRECTORY]/FEAScript-core/src/index.js";
102103
```
103104

104-
FEAScript can be run on a local server. Ensure you start the server from the workspace root directory, where both `FEAScript-core` and `FEAScript-website` folders are located, to correctly resolve relative paths in the HTML files. To start a local server, you can use [Python HTTP Server](https://docs.python.org/3/library/http.server.html):
105+
FEAScript can be run on a local server. You **must** start the server from the workspace root directory (the folder that contains both `FEAScript-core/` and `FEAScript-website/`), not from inside either subfolder. The HTML files use relative paths such as `../feascript-website.css` and `../../FEAScript-core/src/index.js` that only resolve correctly from that root.
105106

106107
```bash
107-
python -m http.server
108+
# Navigate to the workspace root first
109+
cd /path/to/FEAScript-workspace
110+
111+
# Then start the server
112+
python3 -m http.server
113+
```
114+
115+
The server will be available at `http://127.0.0.1:8000/`. Open a tutorial at its full path, e.g.:
116+
117+
```
118+
http://127.0.0.1:8000/FEAScript-website/tutorials/solidification-front-2d-worker.html
119+
```
120+
121+
Static file server npm packages like [serve](https://github.com/vercel/serve#readme) and [Vite](https://vite.dev/) can also be used.
122+
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`):
126+
127+
```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
108150
```
109151

110-
where the server will be available at `http://127.0.0.1:8000/`. Static file server npm packages like [serve](https://github.com/vercel/serve#readme) and [Vite](https://vite.dev/) can also be used.
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+
```

NOTICE.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ FEAScript makes use of the following third-party software:
2020
- License: MIT (https://github.com/plotly/plotly.js/blob/master/LICENSE)
2121
- Source: https://github.com/plotly/plotly.js/tree/master
2222

23-
6. **taichi.js**
23+
6. **stdlib-js**
24+
- License: Apache-2.0 (https://github.com/stdlib-js/blas/blob/main/LICENSE)
25+
- Source: https://github.com/stdlib-js/stdlib
26+
27+
7. **taichi.js**
2428
- License: MIT (https://github.com/AmesingFlank/taichi.js/blob/main/LICENSE)
2529
- Source: https://github.com/AmesingFlank/taichi.js
2630

27-
7. **vtk.js**
31+
8. **vtk.js**
2832
- License: BSD 3-Clause (https://github.com/Kitware/vtk-js/blob/master/LICENSE)
2933
- Source: https://github.com/Kitware/vtk-js

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ FEAScript works well in interactive JavaScript playgrounds where you can write c
8484
Install FEAScript and its peer dependencies from npm as follows:
8585

8686
```bash
87-
npm install feascript mathjs
87+
npm install feascript
8888
```
8989

9090
Then, import it in your JavaScript file:

dist/feascript-worker.esm.js

Lines changed: 553 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/feascript-worker.esm.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)