@@ -12,13 +12,11 @@ import { FEAScriptModel, printVersion } from "feascript";
1212
1313console . log ( "FEAScript Version:" , printVersion ) ;
1414
15- // Create a new FEAScript model
15+ // 1. Create the model and select the physics
1616const model = new FEAScriptModel ( ) ;
17-
18- // Select physics/PDE
1917model . setModelConfig ( "creepingFlowScript" ) ;
2018
21- // Define mesh configuration
19+ // 2. Define the mesh
2220model . setMeshConfig ( {
2321 meshDimension : "2D" ,
2422 elementOrder : "quadratic" ,
@@ -28,19 +26,17 @@ model.setMeshConfig({
2826 maxY : 2 ,
2927} ) ;
3028
31- // Define boundary conditions
32- model . addBoundaryCondition ( "0" , [ "constantVelocity" , 0 , 0 ] ) ; // Bottom boundary
33- model . addBoundaryCondition ( "1" , [ "constantVelocity" , 0 , 0 ] ) ; // Left boundary
34- model . addBoundaryCondition ( "2" , [ "constantVelocity" , 1 , 0 ] ) ; // Top boundary
35- model . addBoundaryCondition ( "3" , [ "constantVelocity" , 0 , 0 ] ) ; // Right boundary
29+ // 3. Apply the boundary conditions
30+ model . addBoundaryCondition ( "0" , [ "constantVelocity" , 0 , 0 ] ) ; // Bottom
31+ model . addBoundaryCondition ( "1" , [ "constantVelocity" , 0 , 0 ] ) ; // Left
32+ model . addBoundaryCondition ( "2" , [ "constantVelocity" , 1 , 0 ] ) ; // Top
33+ model . addBoundaryCondition ( "3" , [ "constantVelocity" , 0 , 0 ] ) ; // Right
3634
37- // Set solver method (optional)
35+ // 4. Solve
3836model . setSolverMethod ( "lusolve" ) ;
39-
40- // Solve the problem
4137const { solutionVector, nodesCoordinates } = model . solve ( ) ;
4238
43- // Print results
39+ // 5. Print the results
4440console . log ( `Number of nodes in mesh: ${ nodesCoordinates . nodesXCoordinates . length } ` ) ;
4541console . log ( "Node coordinates:" , nodesCoordinates ) ;
4642console . log ( "Solution vector:" , solutionVector ) ;
0 commit comments