Skip to content

Commit 2906b7a

Browse files
authored
Add new FlowBoundaryConditions and StokesScript models for handling f… (#63)
1 parent ea3d911 commit 2906b7a

34 files changed

+481
-55
lines changed

.github/workflows/scripts-test.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# ______ ______ _____ _ _
2-
# | ____| ____| /\ / ____| (_) | |
3-
# | |__ | |__ / \ | (___ ___ ____ _ ____ | |_
4-
# | __| | __| / /\ \ \___ \ / __| __| | _ \| __|
5-
# | | | |____ / ____ \ ____) | (__| | | | |_) | |
6-
# |_| |______/_/ \_\_____/ \___|_| |_| __/| |
7-
# | | | |
8-
# |_| | |_
9-
# Website: https://feascript.com/ \__|
101
#
2+
# ════════════════════════════════════════════════════════════════
3+
# FEAScript Core Library
4+
# Lightweight Finite Element Simulation in JavaScript
5+
# Version: 0.2.0 (RC) | https://feascript.com
6+
# MIT License © 2023–2026 FEAScript
7+
# ════════════════════════════════════════════════════════════════
8+
#
119

1210
name: Run FEAScript Examples
1311

NOTICE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ FEAScript makes use of the following third-party software:
44
- License: Apache 2.0 (https://github.com/josdejong/mathjs/blob/develop/LICENSE)
55
- Source: https://github.com/josdejong/mathjs
66

7-
87
2. **plotly.js**
98
- License: MIT (https://github.com/plotly/plotly.js/blob/master/LICENSE)
109
- Source: https://github.com/plotly/plotly.js/tree/master

examples/frontPropagationScript/solidificationFront2D/solidificationFront2D.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ════════════════════════════════════════════════════════════════
33
* FEAScript Core Library
44
* Lightweight Finite Element Simulation in JavaScript
5-
* Version: 0.2.0 (RC) | https://feascript.com
5+
* Version: 0.2.0 | https://feascript.com
66
* MIT License © 2023–2026 FEAScript
77
* ════════════════════════════════════════════════════════════════
88
*/

examples/generalFormPDEScript/advectionDiffusion1D/advectionDiffusion1D.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ════════════════════════════════════════════════════════════════
33
* FEAScript Core Library
44
* Lightweight Finite Element Simulation in JavaScript
5-
* Version: 0.2.0 (RC) | https://feascript.com
5+
* Version: 0.2.0 | https://feascript.com
66
* MIT License © 2023–2026 FEAScript
77
* ════════════════════════════════════════════════════════════════
88
*/

examples/heatConductionScript/heatConduction1DWall/heatConduction1DWall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ════════════════════════════════════════════════════════════════
33
* FEAScript Core Library
44
* Lightweight Finite Element Simulation in JavaScript
5-
* Version: 0.2.0 (RC) | https://feascript.com
5+
* Version: 0.2.0 | https://feascript.com
66
* MIT License © 2023–2026 FEAScript
77
* ════════════════════════════════════════════════════════════════
88
*/

examples/heatConductionScript/heatConduction2DFin/heatConduction2DFin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ════════════════════════════════════════════════════════════════
33
* FEAScript Core Library
44
* Lightweight Finite Element Simulation in JavaScript
5-
* Version: 0.2.0 (RC) | https://feascript.com
5+
* Version: 0.2.0 | https://feascript.com
66
* MIT License © 2023–2026 FEAScript
77
* ════════════════════════════════════════════════════════════════
88
*/

examples/heatConductionScript/heatConduction2DFin/heatConduction2DFinGmsh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ════════════════════════════════════════════════════════════════
33
* FEAScript Core Library
44
* Lightweight Finite Element Simulation in JavaScript
5-
* Version: 0.2.0 (RC) | https://feascript.com
5+
* Version: 0.2.0 | https://feascript.com
66
* MIT License © 2023–2026 FEAScript
77
* ════════════════════════════════════════════════════════════════
88
*/

examples/heatConductionScript/heatConduction2DFin/heatConduction2DRhomFinGmsh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ════════════════════════════════════════════════════════════════
33
* FEAScript Core Library
44
* Lightweight Finite Element Simulation in JavaScript
5-
* Version: 0.2.0 (RC) | https://feascript.com
5+
* Version: 0.2.0 | https://feascript.com
66
* MIT License © 2023–2026 FEAScript
77
* ════════════════════════════════════════════════════════════════
88
*/

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "feascript",
3-
"version": "0.2.0 (RC)",
4-
"description": "Lightweight finite element simulation library built in JavaScript for browser-based physics and engineering simulations",
3+
"version": "0.2.0",
4+
"description": "Lightweight finite element simulation library built in JavaScript",
55
"main": "dist/feascript.cjs.js",
66
"module": "dist/feascript.esm.js",
77
"browser": "dist/feascript.umd.js",

src/FEAScript.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* ════════════════════════════════════════════════════════════════
33
* FEAScript Core Library
44
* Lightweight Finite Element Simulation in JavaScript
5-
* Version: 0.2.0 (RC) | https://feascript.com
5+
* Version: 0.2.0 | https://feascript.com
66
* MIT License © 2023–2026 FEAScript
77
* ════════════════════════════════════════════════════════════════
88
*/
@@ -15,6 +15,7 @@ import { prepareMesh } from "./mesh/meshUtilsScript.js";
1515
import { assembleFrontPropagationMat } from "./models/frontPropagationScript.js";
1616
import { assembleGeneralFormPDEMat, assembleGeneralFormPDEFront } from "./models/generalFormPDEScript.js";
1717
import { assembleHeatConductionMat, assembleHeatConductionFront } from "./models/heatConductionScript.js";
18+
import { assembleStokesMatrix } from "./models/stokesScript.js";
1819
import { runFrontalSolver } from "./methods/frontalSolverScript.js";
1920
import { basicLog, debugLog, warnLog, errorLog } from "./utilities/loggingScript.js";
2021

@@ -144,7 +145,7 @@ export class FEAScriptModel {
144145
}
145146
} else if (this.solverConfig === "frontPropagationScript") {
146147
// Initialize eikonalActivationFlag
147-
let eikonalActivationFlag = 0;
148+
let eikonalActivationFlag = 0; // TODO: make activationFlag a generic variable (not only for eikonal)
148149
const eikonalExteralIterations = 5; // Number of incremental steps for the eikonal equation
149150

150151
// Create context object with all necessary properties
@@ -199,6 +200,24 @@ export class FEAScriptModel {
199200
});
200201
solutionVector = linearSystemResult.solutionVector;
201202
}
203+
} else if (this.solverConfig === "stokesScript") {
204+
// Use regular linear solver methods for steady Stokes flow
205+
const stokesResult = assembleStokesMatrix(meshData, this.boundaryConditions);
206+
jacobianMatrix = stokesResult.jacobianMatrix;
207+
residualVector = stokesResult.residualVector;
208+
209+
const linearSystemResult = solveLinearSystem(this.solverMethod, jacobianMatrix, residualVector, {
210+
maxIterations: options.maxIterations ?? this.maxIterations,
211+
tolerance: options.tolerance ?? this.tolerance,
212+
});
213+
solutionVector = linearSystemResult.solutionVector;
214+
215+
// Store Stokes-specific metadata for solution extraction
216+
this._stokesMetadata = {
217+
totalNodesVelocity: stokesResult.totalNodesVelocity,
218+
totalNodesPressure: stokesResult.totalNodesPressure,
219+
pressureNodeIndices: stokesResult.pressureNodeIndices,
220+
};
202221
}
203222
console.timeEnd("totalSolvingTime");
204223
basicLog("Solving process completed");
@@ -249,7 +268,7 @@ export class FEAScriptModel {
249268
);
250269
solutionVector = x;
251270
} else {
252-
// Other async solver
271+
// Any other async solver
253272
}
254273
}
255274
console.timeEnd("totalSolvingTime");

0 commit comments

Comments
 (0)