Skip to content

Commit 71af818

Browse files
committed
Refactor documentation and code for clarity and consistency
- Updated README files to use "2D" instead of "two-dimensional" for consistency across examples. - Modified advectionDiffusion1D.js to change boundary conditions and improve comments for clarity. - Adjusted heatConduction2DFin README to reflect the "2D" terminology. - Enhanced FEAScript.js to store coefficient functions in the model and updated the setSolverConfig method accordingly. - Improved generalFormPDEScript.js to clarify comments on diffusion, advection, and reaction terms, and added error handling for unsupported 2D cases.
1 parent 104b23e commit 71af818

File tree

12 files changed

+66
-43
lines changed

12 files changed

+66
-43
lines changed

.github/workflows/scripts-test.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1+
# ______ ______ _____ _ _
2+
# | ____| ____| /\ / ____| (_) | |
3+
# | |__ | |__ / \ | (___ ___ ____ _ ____ | |_
4+
# | __| | __| / /\ \ \___ \ / __| __| | _ \| __|
5+
# | | | |____ / ____ \ ____) | (__| | | | |_) | |
6+
# |_| |______/_/ \_\_____/ \___|_| |_| __/| |
7+
# | | | |
8+
# |_| | |_
9+
# Website: https://feascript.com/ \__|
10+
#
11+
112
name: Run FEAScript Examples
213

314
on:
415
push:
5-
branches: [ main ]
16+
branches: [main]
617
pull_request:
7-
branches: [ main ]
18+
branches: [main]
819

920
jobs:
1021
run-examples:
@@ -33,17 +44,17 @@ jobs:
3344
echo "=========================================="
3445
echo "Running FEAScript examples with Node.js ${{ matrix.node-version }}"
3546
echo "=========================================="
36-
47+
3748
# Counter for tracking test results
3849
PASSED=0
3950
FAILED=0
4051
TOTAL=0
41-
52+
4253
# Array to store failed examples
4354
FAILED_EXAMPLES=()
44-
45-
# Find all .js files in examples directory, excluding generalFormPDEScript
46-
for file in $(find examples -name "*.js" -type f | grep -v "generalFormPDEScript" | sort); do
55+
56+
# Find all .js files in examples directory
57+
for file in $(find examples -name "*.js" -type f | sort); do
4758
TOTAL=$((TOTAL + 1))
4859
LOG_FILE="${file%.js}.log"
4960
echo ""
@@ -71,7 +82,7 @@ jobs:
7182
fi
7283
echo "----------------------------------------"
7384
done
74-
85+
7586
# Print summary
7687
echo ""
7788
echo "=========================================="
@@ -81,7 +92,7 @@ jobs:
8192
echo "Passed: $PASSED"
8293
echo "Failed: $FAILED"
8394
echo ""
84-
95+
8596
# If there are failures, list them
8697
if [ $FAILED -gt 0 ]; then
8798
echo "Failed examples:"
@@ -103,4 +114,4 @@ jobs:
103114
examples/**/*.log
104115
examples/**/*.out
105116
retention-days: 7
106-
if-no-files-found: ignore
117+
if-no-files-found: ignore

dist/feascript.cjs.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/feascript.cjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/feascript.esm.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/feascript.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/feascript.umd.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/feascript.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/frontPropagationScript/SolidificationFront2D/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<img src="https://feascript.github.io/FEAScript-website/assets/FEAScriptFrontPropagation.png" width="80" alt="FEAScript Front Propagation Logo">
22

3-
## Solidification Front Propagation in a Two-Dimensional Domain
3+
## Solidification Front Propagation in a 2D Domain
44

5-
This example demonstrates solving an eikonal equation in a two-dimensional domain using the FEAScript library. The problem represents a typical solidification front propagation scenario, where the objective is to track the movement of an interface, such as in metal cooling or crystal growth processes.
5+
This example demonstrates solving an eikonal equation in a 2D domain using the FEAScript library. The problem represents a typical solidification front propagation scenario, where the objective is to track the movement of an interface, such as in metal cooling or crystal growth processes.
66

77
### Instructions
88

examples/generalFormPDEScript/advectionDiffusion1D.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ const model = new FEAScriptModel();
2323
// Set solver configuration with coefficient functions
2424
model.setSolverConfig("generalFormPDEScript", {
2525
coefficientFunctions: {
26-
// Define the PDE coefficients:
27-
// For the equation d²u/dx² + 10 du/dx = -10 * exp(-200 * (x - 0.5)²)
26+
// Equation d²u/dx² + 10 du/dx = -10 * exp(-200 * (x - 0.5)²)
2827
A: (x) => 1, // Diffusion coefficient
2928
B: (x) => 10, // Advection coefficient
3029
C: (x) => 0, // Reaction coefficient
@@ -35,14 +34,14 @@ model.setSolverConfig("generalFormPDEScript", {
3534
// Define mesh configuration
3635
model.setMeshConfig({
3736
meshDimension: "1D",
38-
elementOrder: "linear",
37+
elementOrder: "quadratic",
3938
numElementsX: 20,
4039
maxX: 1.0,
4140
});
4241

4342
// Define boundary conditions
44-
model.addBoundaryCondition("0", ["constantValue", 0]); // Left boundary, u(0) = 0
45-
model.addBoundaryCondition("1", ["constantValue", 0]); // Right boundary, u(1) = 0
43+
model.addBoundaryCondition("0", ["constantValue", 1]); // Left boundary, u(0) = 1
44+
model.addBoundaryCondition("1", "zeroGradient"); // Right boundary, zero gradient (du/dx = 0)
4645

4746
// Set solver method
4847
model.setSolverMethod("lusolve");

examples/heatConductionScript/heatConduction2DFin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="https://feascript.github.io/FEAScript-website/assets/FEAScriptHeatTransfer.png" width="80" alt="FEAScript Logo">
22

3-
## Heat Conduction in a Two-Dimensional Fin
3+
## Heat Conduction in a 2D Fin
44

55
This example demonstrates solving a steady-state heat transfer problem in a 2D rectangular domain using the FEAScript library. The problem represents a typical cooling fin scenario, where the objective is to model heat conduction and understand temperature distribution under specific boundary conditions.
66

0 commit comments

Comments
 (0)