@@ -13,10 +13,11 @@ FEAScript is entirely implemented in pure JavaScript and can run in two environm
13
13
1 . ** In the browser** with a simple HTML page, where all simulations are executed locally without any installations or using any cloud services
14
14
2 . ** Via Node.js** with plain JavaScript files, for server-side simulations
15
15
16
- You can use FEAScript in your projects through one of the following methods:
16
+ ### Option 1: In the Browser
17
17
18
- ### Option 1: Direct Import from CDN (Browser)
18
+ You can use FEAScript in browser environments in two ways:
19
19
20
+ ** Direct Import from CDN** :
20
21
Add this to your HTML file:
21
22
22
23
``` html
@@ -25,10 +26,7 @@ Add this to your HTML file:
25
26
</script >
26
27
```
27
28
28
- For browser-based examples and use cases, visit [ our website tutorials] ( https://feascript.com/#tutorials ) .
29
-
30
- ### Option 2: Download and Use Locally (Browser)
31
-
29
+ ** Download and Use Locally** :
32
30
1 . Download the latest release from [ GitHub Releases] ( https://github.com/FEAScript/FEAScript-core/releases )
33
31
2 . Include it in your HTML file:
34
32
@@ -38,7 +36,9 @@ For browser-based examples and use cases, visit [our website tutorials](https://
38
36
</script >
39
37
```
40
38
41
- ### Option 3: NPM Installation (Node.js)
39
+ For browser-based examples and use cases, visit [ our website tutorials] ( https://feascript.com/#tutorials ) .
40
+
41
+ ### Option 2: Via Node.js
42
42
43
43
``` bash
44
44
# Install FEAScript and its peer dependencies
@@ -60,17 +60,24 @@ echo '{"type":"module"}' > package.json
60
60
61
61
Explore various Node.js examples and use cases [ here] ( https://github.com/FEAScript/FEAScript-core/tree/main/examples ) .
62
62
63
- ## Example Usage (Browser)
63
+ ## Example Usage
64
64
65
+ ** Browser Import:**
65
66
``` javascript
66
- // Import FEAScript library
67
- import { FEAScriptModel , plotSolution } from " https://core.feascript.com/dist/feascript.esm.js" ;
67
+ // Import FEAScript library in browser
68
+ import { FEAScriptModel } from " https://core.feascript.com/dist/feascript.esm.js" ;
69
+ ```
68
70
71
+ ** Node.js Import:**
72
+ ``` javascript
73
+ // Import FEAScript library in Node.js
74
+ import { FEAScriptModel } from " feascript" ;
75
+ ```
76
+ ``` javascript
69
77
// Create and configure model
70
78
const model = new FEAScriptModel ();
71
79
model .setSolverConfig (" solverType" ); // e.g., "solidHeatTransfer" for a stationary solid heat transfer case
72
80
model .setMeshConfig ({
73
- // Define mesh configuration (assuming a rectangular domain for 2D)
74
81
meshDimension: " 1D" | " 2D" , // Mesh dimension
75
82
elementOrder: " linear" | " quadratic" , // Element order
76
83
numElementsX: number, // Number of elements in x-direction
@@ -80,20 +87,11 @@ model.setMeshConfig({
80
87
});
81
88
82
89
// Apply boundary conditions
83
- model .addBoundaryCondition (" boundaryIndex" , [" conditionType" /* parameters */ ]);
90
+ model .addBoundaryCondition (" boundaryIndex" , [" conditionType" , /* parameters */ ]);
84
91
85
92
// Solve
93
+ model .setSolverMethod (" linearSolver" ); // lusolve (via mathjs) or jacobi
86
94
const { solutionVector , nodesCoordinates } = model .solve ();
87
-
88
- // Plot results
89
- plotSolution (
90
- solutionVector,
91
- nodesCoordinates,
92
- model .solverConfig ,
93
- model .meshConfig .meshDimension ,
94
- " plotType" , // e.g., "contour"
95
- " targetDivId" // HTML div ID for plot
96
- );
97
95
```
98
96
99
97
## Contribute
0 commit comments