Skip to content

Commit 6dc5839

Browse files
committed
Update README for improved clarity: reorganize installation options and example usage sections
1 parent 8337e5f commit 6dc5839

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

README.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ FEAScript is entirely implemented in pure JavaScript and can run in two environm
1313
1. **In the browser** with a simple HTML page, where all simulations are executed locally without any installations or using any cloud services
1414
2. **Via Node.js** with plain JavaScript files, for server-side simulations
1515

16-
You can use FEAScript in your projects through one of the following methods:
16+
### Option 1: In the Browser
1717

18-
### Option 1: Direct Import from CDN (Browser)
18+
You can use FEAScript in browser environments in two ways:
1919

20+
**Direct Import from CDN**:
2021
Add this to your HTML file:
2122

2223
```html
@@ -25,10 +26,7 @@ Add this to your HTML file:
2526
</script>
2627
```
2728

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**:
3230
1. Download the latest release from [GitHub Releases](https://github.com/FEAScript/FEAScript-core/releases)
3331
2. Include it in your HTML file:
3432

@@ -38,7 +36,9 @@ For browser-based examples and use cases, visit [our website tutorials](https://
3836
</script>
3937
```
4038

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
4242

4343
```bash
4444
# Install FEAScript and its peer dependencies
@@ -60,17 +60,24 @@ echo '{"type":"module"}' > package.json
6060

6161
Explore various Node.js examples and use cases [here](https://github.com/FEAScript/FEAScript-core/tree/main/examples).
6262

63-
## Example Usage (Browser)
63+
## Example Usage
6464

65+
**Browser Import:**
6566
```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+
```
6870

71+
**Node.js Import:**
72+
```javascript
73+
// Import FEAScript library in Node.js
74+
import { FEAScriptModel } from "feascript";
75+
```
76+
```javascript
6977
// Create and configure model
7078
const model = new FEAScriptModel();
7179
model.setSolverConfig("solverType"); // e.g., "solidHeatTransfer" for a stationary solid heat transfer case
7280
model.setMeshConfig({
73-
// Define mesh configuration (assuming a rectangular domain for 2D)
7481
meshDimension: "1D" | "2D", // Mesh dimension
7582
elementOrder: "linear" | "quadratic", // Element order
7683
numElementsX: number, // Number of elements in x-direction
@@ -80,20 +87,11 @@ model.setMeshConfig({
8087
});
8188

8289
// Apply boundary conditions
83-
model.addBoundaryCondition("boundaryIndex", ["conditionType" /* parameters */]);
90+
model.addBoundaryCondition("boundaryIndex", ["conditionType", /* parameters */]);
8491

8592
// Solve
93+
model.setSolverMethod("linearSolver"); // lusolve (via mathjs) or jacobi
8694
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-
);
9795
```
9896

9997
## Contribute

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy