-
Notifications
You must be signed in to change notification settings - Fork 3
Made the initial build for npm #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
26817ff
f50b5c6
669d60c
ba493ef
da614b6
1e3e492
2c04a2d
0ba6056
b76e56c
8a68594
3dff3a8
385b2d3
10729e2
40bf332
5e3b7b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/node_modules | ||
node_modules | ||
node_modules/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
examples/ | ||
test/ | ||
.gitignore | ||
package-lock.json |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,9 +6,60 @@ | |||||
|
||||||
> 🚧 **FEAScript is currently under heavy development.** Functionality and interfaces may change rapidly as new features and enhancements are introduced. 🚧 | ||||||
|
||||||
## Getting Started | ||||||
## Installation | ||||||
|
||||||
FEAScript is entirely implemented in pure JavaScript and requires only a simple HTML page to operate. All simulations are executed locally in your browser, without the need for any cloud services. | ||||||
FEAScript is entirely implemented in pure JavaScript and requires only a simple HTML page to operate. All simulations are executed locally in your browser, without the need for any cloud services. You can use FEAScript in your projects through one of the following methods: | ||||||
|
||||||
### Option 1: NPM Installation | ||||||
|
||||||
```bash | ||||||
# Install FEAScript and its peer dependencies | ||||||
npm install feascript mathjs plotly.js | ||||||
``` | ||||||
|
||||||
Then import it in your JavaScript/TypeScript file: | ||||||
|
||||||
```javascript | ||||||
// ES Modules | ||||||
import { FEAScriptModel, plotSolution } from "feascript"; | ||||||
|
||||||
// CommonJS | ||||||
const { FEAScriptModel, plotSolution } = require("feascript"); | ||||||
``` | ||||||
|
||||||
**Important:** FEAScript is built as an ES module. If you're starting a new project, make sure to configure it to use ES modules by running: | ||||||
|
||||||
```bash | ||||||
# Create package.json with type=module for ES modules support | ||||||
echo '{"type":"module"}' > package.json | ||||||
``` | ||||||
|
||||||
If you already have a package.json file, manually add `"type": "module"` to enable ES modules in your project. | ||||||
|
||||||
### Option 2: Direct Import from CDN | ||||||
|
||||||
Add this line to your HTML or JavaScript module: | ||||||
|
||||||
```javascript | ||||||
import { FEAScriptModel, plotSolution } from "https://core.feascript.com/src/index.js"; | ||||||
``` | ||||||
|
||||||
### Option 3: Download and Use Locally | ||||||
|
||||||
1. Download the latest release from [GitHub Releases](https://github.com/FEAScript/FEAScript-core/releases) | ||||||
2. Include it in your project: | ||||||
|
||||||
```html | ||||||
<script type="module"> | ||||||
// Option A: Import from source directory | ||||||
import { FEAScriptModel, plotSolution } from "./path/to/src/index.js"; | ||||||
|
||||||
// Option B: Import from distribution bundle | ||||||
import { FEAScriptModel, plotSolution } from "./path/to/feascript.esm.js"; | ||||||
|
||||||
// Your code here | ||||||
</script> | ||||||
``` | ||||||
|
||||||
### Example Usage | ||||||
|
||||||
|
@@ -19,7 +70,8 @@ import { FEAScriptModel, plotSolution } from "https://core.feascript.com/src/ind | |||||
// Create and configure model | ||||||
const model = new FEAScriptModel(); | ||||||
model.setSolverConfig("solverType"); // e.g., "solidHeatTransfer" for a stationary solid heat transfer case | ||||||
model.setMeshConfig({ // Define mesh configuration (assuming a rectangular domain for 2D) | ||||||
model.setMeshConfig({ | ||||||
// Define mesh configuration (assuming a rectangular domain for 2D) | ||||||
meshDimension: "1D" | "2D", // Mesh dimension | ||||||
elementOrder: "linear" | "quadratic", // Element order | ||||||
numElementsX: number, // Number of elements in x-direction | ||||||
|
@@ -29,7 +81,7 @@ model.setMeshConfig({ // Define mesh configuration (assuming a rectangular domai | |||||
}); | ||||||
|
||||||
// Apply boundary conditions | ||||||
model.addBoundaryCondition("boundaryIndex", ["conditionType", /* parameters */]); | ||||||
model.addBoundaryCondition("boundaryIndex", ["conditionType" /* parameters */]); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of the comma in the array literal may lead to copying errors if multiple parameters are intended. Please consider reintroducing the comma to clearly indicate that the array should contain more than one element.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
|
||||||
// Solve | ||||||
const { solutionVector, nodesCoordinates } = model.solve(); | ||||||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.