Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
30d5a96
Remove logging and call for frontal solver method in FEAScriptModel
nikoscham Sep 15, 2025
7c07be5
Refactor frontal solver to accept mesh data and streamline node coord…
nikoscham Sep 16, 2025
c59e1f0
Clarify contribution guidelines by removing redundancy in import inst…
nikoscham Sep 16, 2025
9eb7780
Refactor runFrontalSolver to use meshData for solution vector and nod…
nikoscham Sep 16, 2025
84ef508
Enhance frontal solver by implementing thermal boundary condition han…
nikoscham Sep 17, 2025
602a508
Add convection boundary condition handling to thermal solver; refacto…
nikoscham Sep 17, 2025
3471906
Refactor thermal boundary condition methods for consistency; rename m…
nikoscham Sep 17, 2025
e34856b
Transform the frontal solver arrays to dynamic. Update variable naming.
nikoscham Sep 18, 2025
b710088
Reorganize object template definitions in frontal solver script for c…
nikoscham Sep 18, 2025
1720518
Enhance logging for constant temperature boundary conditions in front…
nikoscham Sep 18, 2025
556770f
Refactor frontStorage initialization comment for clarity in frontal s…
nikoscham Sep 18, 2025
247deb0
Rename executeFrontalAlgorithm to runFrontalAlgorithm for consistency…
nikoscham Sep 18, 2025
ce3afeb
Refactor logging messages for boundary conditions in frontal solver; …
nikoscham Sep 18, 2025
6de34e8
Refactor estimateFrontSize function for improved front size calculati…
nikoscham Sep 18, 2025
258e555
Enhance output logging in runFrontalSolverMain for 1D and 2D cases; i…
nikoscham Sep 18, 2025
6daee26
Refactor boundary condition comments in frontal solver; clarify termi…
nikoscham Sep 18, 2025
33ac532
Update logging in solveLinearSystem; Add imposeConstantValueBoundaryC…
nikoscham Sep 22, 2025
59926f9
Refactor local-to-global mapping in solid heat transfer assembly; str…
nikoscham Sep 22, 2025
20a05be
Refactor plotSolution function parameters and improve code formatting…
nikoscham Sep 23, 2025
babfa3b
Refactor frontal solver to accept matrix assembler as parameter; enha…
nikoscham Sep 26, 2025
b9673d4
Refactor residual vector naming and initialization across multiple sc…
nikoscham Sep 26, 2025
ca27e94
Refactor FEAScript imports and logging functions; update version to 0…
nikoscham Sep 27, 2025
c91324a
Update contribution guidelines for clarity and structure; enhance nav…
nikoscham Sep 28, 2025
077053a
Update contributing guidelines and README for clarity; enhance naviga…
nikoscham Sep 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 109 additions & 102 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,105 +2,112 @@

Thank you for your interest in contributing! FEAScript is in early development, with continuous additions of new features and improvements. To ensure a smooth and collaborative development process, please review and follow the guidelines below.

## Contribution Guidelines

1. **Development Tools:**
We recommend using [Visual Studio Code](https://code.visualstudio.com/) with the [Prettier plugin](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for automatic code formatting. Additionally, use a **110-character line width** to maintain consistent formatting.

2. **Coding Style:**
Observe the code near your intended changes and aim to preserve that style in your modifications.

3. **Variable Naming:**
Use [camelCase](https://en.wikipedia.org/wiki/Camel_case) formatting for variable names throughout the code.

4. **File Naming:**
All JavaScript source files in FEAScript end with the suffix `Script` before the `.js` extension (e.g., `loggingScript.js`, `meshGenerationScript.js`, `newtonRaphsonScript.js`). This is an explicit, project‑level stylistic choice to:

- Visually distinguish internal FEAScript modules from third‑party or external library files.
- Keep historical and stylistic consistency across the codebase.

Exceptions:

- Public entry file: `index.js` (standard entry point convention).
- Core model file: `FEAScript.js` (matches the library name; appending "Script" would be redundant).

5. **File Structure:**
All files in the FEAScript-core codebase should follow this structure:

1. **Banner**: All files start with the FEAScript ASCII art banner.
2. **Imports**:
- External imports (from npm packages) first, alphabetically ordered.
- Internal imports next, grouped by module/folder.
3. **Classes/Functions**: Implementation with proper JSDoc comments.

Example:

```javascript
// ______ ______ _____ _ _ //
// | ____| ____| /\ / ____| (_) | | //
// | |__ | |__ / \ | (___ ___ ____ _ ____ | |_ //
// | __| | __| / /\ \ \___ \ / __| __| | _ \| __| //
// | | | |____ / ____ \ ____) | (__| | | | |_) | | //
// |_| |______/_/ \_\_____/ \___|_| |_| __/| | //
// | | | | //
// |_| | |_ //
// Website: https://feascript.com/ \__| //

// External imports
import { mathLibrary } from "math-package";

// Internal imports
import { relatedFunction } from "../utilities/helperScript.js";

/**
* Class to handle specific functionality
*/
export class MyClass {
/**
* Constructor to initialize the class
* @param {object} options - Configuration options
*/
constructor(options) {
// Implementation
}

/**
* Function to perform a specific action
* @param {number} input - Input value
* @returns {number} Processed result
*/
doSomething(input) {
// Implementation
return input * DEFAULT_VALUE;
}
}
```

6. **Branching & Workflow:**
To contribute a new feature or fix:

- Do not commit directly to `main`.
- Instead, create a short‑lived branch:
- `feature/<topic>` for new functionality
- `fix/<issue>` for bug fixes

External contributors:

1. Fork the repo.
2. Branch from `main` in your fork.
3. Push and open a PR from your fork’s branch into `main`.

7. **Local Testing:**
Before submitting a pull request, test your modifications by running the FEAScript library from a local directory. For example, you can load the library in your HTML file as follows:

```javascript
import { FEAScriptModel, plotSolution, printVersion } from "[USER_DIRECTORY]/FEAScript-core/src/index.js";
```

FEAScript can be run on a local server. To start a local server, you can use [Python HTTP Server](https://docs.python.org/3/library/http.server.html):

```bash
python -m http.server
```

where the server will be available at `http://127.0.0.1:8000/`. Static file server npm packages like [serve](https://github.com/vercel/serve#readme) and [Vite](https://vite.dev/) can also be used.
## Contents

- [Development Environment & Coding Style](#development-environment--coding-style)
- [Variable & File Naming](#variable--file-naming)
- [File Structure](#file-structure)
- [Branching & Workflow](#branching--workflow)
- [Local Testing](#local-testing)

## Development Environment & Coding Style

- Use [Visual Studio Code](https://code.visualstudio.com/) with the [Prettier plugin](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for automatic code formatting
- Use a **110-character line width** to maintain consistent formatting
- Observe the code near your intended changes and aim to preserve that style in your modifications

## Variable & File Naming

- Use [camelCase](https://en.wikipedia.org/wiki/Camel_case) formatting for variable names throughout the code
- All JavaScript source files in FEAScript end with the suffix `Script` before the `.js` extension (e.g., `loggingScript.js`, `meshGenerationScript.js`, `newtonRaphsonScript.js`). This is an explicit, project‑level stylistic choice to:
- Visually distinguish internal FEAScript modules from third‑party or external library files
- Keep historical and stylistic consistency across the codebase

### Exceptions

- Public entry file: `index.js` (standard entry point convention)
- Core model file: `FEAScript.js` (matches the library name; appending "Script" would be redundant)

## File Structure

All files in the FEAScript-core codebase should follow this structure:

1. Banner: All files start with the FEAScript ASCII art banner
2. Imports:
- External imports first, alphabetically ordered
- Internal imports next, grouped by module/folder
3. Classes/Functions: Implementation with proper JSDoc comments

Example:

```javascript
// ______ ______ _____ _ _ //
// | ____| ____| /\ / ____| (_) | | //
// | |__ | |__ / \ | (___ ___ ____ _ ____ | |_ //
// | __| | __| / /\ \ \___ \ / __| __| | _ \| __| //
// | | | |____ / ____ \ ____) | (__| | | | |_) | | //
// |_| |______/_/ \_\_____/ \___|_| |_| __/| | //
// | | | | //
// |_| | |_ //
// Website: https://feascript.com/ \__| //

// External imports
import { mathLibrary } from "math-package";

// Internal imports
import { relatedFunction } from "../utilities/helperScript.js";

/**
* Class to handle specific functionality
*/
export class MyClass {
/**
* Constructor to initialize the class
* @param {object} options - Configuration options
*/
constructor(options) {
// Implementation
}

/**
* Function to perform a specific action
* @param {number} input - Input value
* @returns {number} Processed result
*/
doSomething(input) {
// Implementation
return input * DEFAULT_VALUE;
}
}
```

## Branching & Workflow

To contribute a new feature or fix:

- Do not commit directly to `main`
- Instead, create a short‑lived branch:
- `feature/<topic>` for new functionality
- `fix/<issue>` for bug fixes

External contributors:

1. Fork the repo
2. Branch from `main` in your fork
3. Push and open a PR from your fork’s branch into `main`

## Local Testing

Before submitting a pull request, test your modifications by running the FEAScript library from a local directory. For example, you can load the library in your HTML file as follows:

```javascript
import { FEAScriptModel, plotSolution, printVersion } from "[USER_DIRECTORY]/FEAScript-core/src/index.js";
```

FEAScript can be run on a local server. Ensure you start the server from the workspace root directory, where both `FEAScript-core` and `FEAScript-website` folders are located, to correctly resolve relative paths in the HTML files. To start a local server, you can use [Python HTTP Server](https://docs.python.org/3/library/http.server.html):

```bash
python -m http.server
```

where the server will be available at `http://127.0.0.1:8000/`. Static file server npm packages like [serve](https://github.com/vercel/serve#readme) and [Vite](https://vite.dev/) can also be used.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<!-- [![liberapay](https://img.shields.io/liberapay/receives/FEAScript.svg?logo=liberapay)](https://liberapay.com/FEAScript/) -->

[FEAScript](https://feascript.com/) is a lightweight finite element simulation library built in JavaScript. It empowers users to create and execute simulations for physics and engineering applications in both browser-based and server-side environments. This is the core library of the FEAScript project.
[FEAScript](https://feascript.com/) is a lightweight finite element simulation library written in JavaScript. It empowers users to create and execute simulations for physics and engineering applications in both browser-based and server-side environments. This is the core library of the FEAScript project.

> 🚧 **FEAScript is currently under heavy development.** Its functionality and interfaces may change rapidly as new features and enhancements are introduced.

Expand Down Expand Up @@ -99,9 +99,9 @@ FEAScript also works well in interactive JavaScript notebook environments where

For users who prefer a visual approach to creating simulations, we offer the [FEAScript Platform](https://platform.feascript.com/) - a browser-based visual editor built on the [Blockly](https://developers.google.com/blockly) library. This no-code interface allows you to:

- Build and run finite element simulations directly in your browser by connecting visual blocks together
- Create complex simulations without writing any JavaScript code
- Save and load projects in XML format for easy sharing and reuse
- Build and run finite element simulations directly in your browser by connecting visual blocks together.
- Create complex simulations without writing any JavaScript code.
- Save and load projects in XML format for easy sharing and reuse.

While FEAScript's JavaScript API offers full programmatic control for advanced customization, the FEAScript Platform provides an accessible entry point for users without coding experience.

Expand Down
4 changes: 2 additions & 2 deletions dist/feascript.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/feascript.cjs.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/feascript.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/feascript.esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/feascript.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/feascript.umd.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as math from "mathjs";
global.math = math;

// Import FEAScript library
import { FEAScriptModel, logSystem, VERSION } from "feascript";
import { FEAScriptModel, VERSION } from "feascript";

console.log("FEAScript Version:", VERSION);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as math from "mathjs";
global.math = math;

// Import FEAScript library
import { FEAScriptModel, logSystem, VERSION } from "feascript";
import { FEAScriptModel, VERSION } from "feascript";

console.log("FEAScript Version:", VERSION);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as math from "mathjs";
global.math = math;

// Import FEAScript library
import { FEAScriptModel, logSystem, VERSION } from "feascript";
import { FEAScriptModel, VERSION } from "feascript";

console.log("FEAScript Version:", VERSION);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as math from "mathjs";
global.math = math;

// Import FEAScript library
import { FEAScriptModel, importGmshQuadTri, logSystem, VERSION } from "feascript";
import { FEAScriptModel, importGmshQuadTri, VERSION } from "feascript";

console.log("FEAScript Version:", VERSION);

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions src/FEAScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { newtonRaphson } from "./methods/newtonRaphsonScript.js";
import { solveLinearSystem } from "./methods/linearSystemSolverScript.js";
import { prepareMesh } from "./mesh/meshUtilsScript.js";
import { assembleFrontPropagationMat } from "./solvers/frontPropagationScript.js";
import { assembleSolidHeatTransferMat } from "./solvers/solidHeatTransferScript.js";
import {
assembleSolidHeatTransferMat,
assembleSolidHeatTransferFront,
} from "./solvers/solidHeatTransferScript.js";
import { runFrontalSolver } from "./methods/frontalSolverScript.js";
import { basicLog, debugLog, errorLog } from "./utilities/loggingScript.js";

Expand Down Expand Up @@ -60,6 +63,16 @@ export class FEAScriptModel {
throw new Error(error);
}

/**
* For consistency across both linear and nonlinear formulations,
* this project always refers to the assembled right-hand side vector
* as `residualVector` and the assembled system matrix as `jacobianMatrix`.
*
* In linear problems `jacobianMatrix` is equivalent to the
* classic stiffness/conductivity matrix and `residualVector`
* corresponds to the traditional load (RHS) vector.
*/

let jacobianMatrix = [];
let residualVector = [];
let solutionVector = [];
Expand All @@ -84,9 +97,11 @@ export class FEAScriptModel {

// Check if using frontal solver
if (this.solverMethod === "frontal") {
basicLog(`Using frontal solver method`);
// Call frontal solver
const frontalResult = runFrontalSolver(this.meshConfig, this.boundaryConditions);
const frontalResult = runFrontalSolver(
assembleSolidHeatTransferFront,
meshData,
this.boundaryConditions
);
solutionVector = frontalResult.solutionVector;
} else {
// Use regular linear solver methods
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

export { FEAScriptModel } from "./FEAScript.js";
export { importGmshQuadTri } from "./readers/gmshReaderScript.js";
export { logSystem, printVersion } from "./utilities/loggingScript.js";
export { logSystem } from "./utilities/loggingScript.js";
export { plotSolution } from "./visualization/plotSolutionScript.js";
export { FEAScriptWorker } from "./workers/workerScript.js";
export const VERSION = "0.1.3";
export const printVersion = "0.1.3";
1 change: 0 additions & 1 deletion src/mesh/meshGenerationScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ export class Mesh1D extends Mesh {

generateMesh() {
let nodesXCoordinates = [];
let nodesYCoordinates = [];
const xStart = 0;
let totalNodesX, deltaX;

Expand Down
Loading