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";
1515import { assembleFrontPropagationMat } from "./models/frontPropagationScript.js" ;
1616import { assembleGeneralFormPDEMat , assembleGeneralFormPDEFront } from "./models/generalFormPDEScript.js" ;
1717import { assembleHeatConductionMat , assembleHeatConductionFront } from "./models/heatConductionScript.js" ;
18+ import { assembleStokesMatrix } from "./models/stokesScript.js" ;
1819import { runFrontalSolver } from "./methods/frontalSolverScript.js" ;
1920import { 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