Skip to content

Commit 58383d1

Browse files
committed
Refactor code structure for improved readability and maintainability
1 parent f6dfa0f commit 58383d1

13 files changed

+334
-466
lines changed

FEAScript-website.css

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,11 @@ mjx-container {
213213
background-color: #f7e7b7;
214214
color: #333;
215215
font-size: 90%;
216-
padding: 0.2em 0.8em;
216+
padding: 0.1em 0.8em;
217217
border-radius: 8px;
218218
margin-right: 0.5em;
219-
margin-top: 0;
219+
margin-top: 0.1em;
220+
margin-bottom: 0.1em;
220221
vertical-align: middle;
221222
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
222223
font-weight: 500;
@@ -267,8 +268,22 @@ mjx-container {
267268
padding-bottom: 0.5em;
268269
}
269270

271+
/* Remove bullets for tutorials list */
270272
.tutorials-list {
271-
list-style: none; /* Remove bullets */
273+
list-style: none;
274+
margin: 0;
275+
padding-left: 0;
276+
}
277+
278+
/* Remove bullets from top-level features-list */
279+
.features-list {
280+
list-style: none;
281+
margin: 0;
282+
padding-left: 0;
283+
}
284+
285+
.features-list > li {
286+
margin-bottom: 1em;
272287
}
273288

274289
/* Footer styles */
25.2 KB
Loading
24.7 KB
Loading
-11.5 KB
Binary file not shown.

index.html

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,37 @@ <h1 class="top">
5656
</h1>
5757

5858
<div id="banner">
59+
<img
60+
src="./assets/HeatConduction1DWallResults.png"
61+
alt="Results of heat conduction through a wall tutorial"
62+
/>
63+
<p class="image-caption">
64+
Heat conduction through a wall
65+
<a href="https://feascript.com/tutorials/HeatConduction1DWall.html">tutorial</a>
66+
</p>
5967
<img
6068
src="./assets/HeatConduction2DFinResults.png"
6169
alt="Results of heat conduction in a 2D fin tutorial"
6270
/>
6371
<p class="image-caption">
64-
<a href="https://feascript.com/tutorials/HeatConduction2DFin.html">Solid heat conduction</a>
65-
solver
72+
Heat conduction in a 2D fin
73+
<a href="https://feascript.com/tutorials/HeatConduction2DFin.html">tutorial</a>
6674
</p>
6775
<img
6876
src="./assets/SolidificationFront2DResults.png"
6977
alt="Results of solidification front propagation in a 2D domain tutorial"
7078
/>
7179
<p class="image-caption">
72-
<a href="https://feascript.com/tutorials/SolidificationFront2D.html"
73-
>Solidification front propagation</a
74-
>
75-
solver
80+
Solidification front propagation in a 2D domain
81+
<a href="https://feascript.com/tutorials/SolidificationFront2D.html">tutorial</a>
7682
</p>
7783
<img
78-
src="./assets/Screenshot_20250520_084241.png"
79-
alt="Screenshot of the FEAScript Platform interface"
84+
src="./assets/AdvectionDiffusion1DResults.png"
85+
alt="Results of advection-diffusion with Gaussian source tutorial"
8086
/>
8187
<p class="image-caption">
82-
<a href="https://platform.feascript.com/">FEAScript Platform</a>
83-
interface
88+
Advection–diffusion with Gaussian source
89+
<a href="https://feascript.com/tutorials/AdvectionDiffusion1D.html">tutorial</a>
8490
</p>
8591
</div>
8692

@@ -320,13 +326,12 @@ <h2 id="gettingstarted"><a name="Getting Started"></a>Getting Started</h2>
320326
<h2 id="features"><a name="Features"></a>Features</h2>
321327

322328
<p>The following list highlights key FEAScript features:</p>
323-
<ul>
329+
<ul class="features-list">
324330
<li>
325331
🧠 <strong>Physical Modeling</strong>
326332
<ul>
327-
<li>Heat conduction solver</li>
328333
<li>Front propagation solver</li>
329-
<li>General form PDE solver</li>
334+
<li>Heat conduction solver</li>
330335
</ul>
331336
</li>
332337
<li>
@@ -335,8 +340,8 @@ <h2 id="features"><a name="Features"></a>Features</h2>
335340
<li>Simple mesh generation (1D and rectangular 2D domains)</li>
336341
<li>
337342
Unstructured mesh import from
338-
<a href="https://gmsh.info/">
339-
Gmsh
343+
<a href="https://gmsh.info/"
344+
>Gmsh
340345
<img
341346
src="https://upload.wikimedia.org/wikipedia/commons/4/44/Icon_External_Link.svg"
342347
alt="External Link Icon"
@@ -347,40 +352,37 @@ <h2 id="features"><a name="Features"></a>Features</h2>
347352
margin-left: 2px;
348353
margin-bottom: 4px;
349354
"
350-
/>
351-
</a>
355+
/></a>
352356
(<code>.msh</code> file format)
353357
</li>
354358
</ul>
355359
</li>
356360
<li>
357361
⚙️ <strong>Numerical Methods</strong>
358362
<ul>
359-
<!--
360-
<li>
361-
General form differential equations solver
362-
<i
363-
><a href="https://github.com/FEAScript/FEAScript-core/issues/3" target="_blank"
364-
>(under development)</a
365-
></i
366-
>
367-
</li>
368-
-->
363+
<li>General form PDE solver</li>
369364
<li>
370-
Linear system solvers (LU decomposition via
371-
<a href="https://mathjs.org/">
372-
math.js
373-
<img
374-
src="https://upload.wikimedia.org/wikipedia/commons/4/44/Icon_External_Link.svg"
375-
alt="External Link Icon"
376-
style="
377-
width: 16px;
378-
height: 16px;
379-
vertical-align: middle;
380-
margin-left: 2px;
381-
margin-bottom: 4px;
382-
" /></a
383-
>, Jacobi method)
365+
Linear system solvers:
366+
<ul>
367+
<li>Frontal</li>
368+
<li>Jacobi</li>
369+
<li>
370+
LU (via
371+
<a href="https://mathjs.org/"
372+
>math.js
373+
<img
374+
src="https://upload.wikimedia.org/wikipedia/commons/4/44/Icon_External_Link.svg"
375+
alt="External Link Icon"
376+
style="
377+
width: 16px;
378+
height: 16px;
379+
vertical-align: middle;
380+
margin-left: 2px;
381+
margin-bottom: 4px;
382+
" /></a
383+
>)
384+
</li>
385+
</ul>
384386
</li>
385387
<li>Newton-Raphson method for nonlinear systems</li>
386388
</ul>
@@ -417,6 +419,11 @@ <h2 id="features"><a name="Features"></a>Features</h2>
417419
🚀 <strong>Platform & Deployment</strong>
418420
<ul>
419421
<li>Browser runtime (ES modules)</li>
422+
<li>
423+
No-code interface with
424+
<a href="https://platform.feascript.com">FEAScript Platform</a>
425+
visual editor
426+
</li>
420427
<li>
421428
Node.js runtime (<a href="https://www.npmjs.com/package/feascript"
422429
>npm
@@ -448,11 +455,6 @@ <h2 id="features"><a name="Features"></a>Features</h2>
448455
" /></a
449456
>)
450457
</li>
451-
<li>
452-
No-code interface with
453-
<a href="https://platform.feascript.com">FEAScript Platform</a>
454-
visual editor
455-
</li>
456458
</ul>
457459
</li>
458460
</ul>

tutorials/AdvectionDiffusion1D.html

Lines changed: 47 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<html>
1414
<head>
15-
<title>FEAScript: Advection-Diffusion with a Gaussian Source Term</title>
15+
<title>FEAScript: Advection-Diffusion with a Gaussian Source Term Tutorial</title>
1616
<link rel="icon" type="image/x-icon" href="../assets/favicon.ico" />
1717
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
1818
<meta
@@ -65,7 +65,7 @@ <h1 class="top">
6565
/>
6666
</a>
6767
</h1>
68-
<h1>Advection-Diffusion with a Gaussian Source Term</h1>
68+
<h1>Advection-Diffusion with a Gaussian Source Term Tutorial</h1>
6969

7070
<ul id="menu">
7171
<li><a href="#mathematicalformulation">Mathematical Formulation</a></li>
@@ -199,6 +199,7 @@ <h2 id="solvingwithfeascript"><a name="Solving with FEAScript"></a>Solving with
199199
as an argument to the <code>plotSolution</code> function to specify the target div for the plot.
200200
</p>
201201

202+
<!-- Container element where the solution plot will be rendered -->
202203
<h2 id="results"><a name="Results"></a>Results</h2>
203204

204205
<p>
@@ -210,11 +211,6 @@ <h2 id="results"><a name="Results"></a>Results</h2>
210211
>.
211212
</p>
212213

213-
<!-- Container element where the solution plot will be rendered -->
214-
<div id="orientation-message">
215-
Cannot draw the results. Please rotate your phone to landscape orientation and refresh the page to see
216-
the results.
217-
</div>
218214
<div id="resultsCanvas"></div>
219215

220216
<p>
@@ -238,68 +234,50 @@ <h2 id="results"><a name="Results"></a>Results</h2>
238234
// import { FEAScriptModel, plotSolution, printVersion } from "../../FEAScript-core/src/index.js";
239235

240236
window.addEventListener("DOMContentLoaded", () => {
241-
if (window.innerHeight > window.innerWidth) {
242-
document.getElementById("orientation-message").style.display = "block";
243-
document.getElementById("resultsCanvas").style.display = "none";
244-
} else {
245-
document.getElementById("orientation-message").style.display = "none";
246-
document.getElementById("resultsCanvas").style.display = "block";
247-
248-
// Print FEAScript version
249-
console.log("FEAScript Version:", printVersion);
250-
251-
// Create a new FEAScript model
252-
const model = new FEAScriptModel();
253-
254-
// Set solver configuration with coefficient functions
255-
model.setSolverConfig("generalFormPDEScript", {
256-
coefficientFunctions: {
257-
// Equation d²u/dx² - 10 du/dx = 10 * exp(-200 * (x - 0.5)²)
258-
A: (x) => 1, // Diffusion coefficient
259-
B: (x) => -10, // Advection coefficient
260-
C: (x) => 0, // Reaction coefficient
261-
D: (x) => 10 * Math.exp(-200 * Math.pow(x - 0.5, 2)), // Source term
262-
},
263-
});
264-
265-
// Define mesh configuration
266-
model.setMeshConfig({
267-
meshDimension: "1D",
268-
elementOrder: "quadratic",
269-
numElementsX: 20,
270-
maxX: 1.0,
271-
});
272-
273-
// Define boundary conditions
274-
model.addBoundaryCondition("0", ["constantValue", 1]); // Left boundary, u(0) = 1
275-
model.addBoundaryCondition("1", "zeroGradient"); // Right boundary, zero gradient (du/dx = 0)
276-
277-
// Set solver method
278-
model.setSolverMethod("lusolve");
279-
280-
// Solve the problem and get the solution
281-
const { solutionVector, nodesCoordinates } = model.solve();
282-
283-
// Plot the solution as a 1D line plot
284-
plotSolution(
285-
solutionVector,
286-
nodesCoordinates,
287-
model.solverConfig,
288-
model.meshConfig.meshDimension,
289-
"line",
290-
"resultsCanvas"
291-
);
292-
}
293-
});
294-
295-
window.addEventListener("resize", () => {
296-
if (window.innerHeight > window.innerWidth) {
297-
document.getElementById("orientation-message").style.display = "block";
298-
document.getElementById("resultsCanvas").style.display = "none";
299-
} else {
300-
document.getElementById("orientation-message").style.display = "none";
301-
document.getElementById("resultsCanvas").style.display = "block";
302-
}
237+
// Print FEAScript version
238+
console.log("FEAScript Version:", printVersion);
239+
240+
// Create a new FEAScript model
241+
const model = new FEAScriptModel();
242+
243+
// Set solver configuration with coefficient functions
244+
model.setSolverConfig("generalFormPDEScript", {
245+
coefficientFunctions: {
246+
// Equation d²u/dx² - 10 du/dx = 10 * exp(-200 * (x - 0.5)²)
247+
A: (x) => 1, // Diffusion coefficient
248+
B: (x) => -10, // Advection coefficient
249+
C: (x) => 0, // Reaction coefficient
250+
D: (x) => 10 * Math.exp(-200 * Math.pow(x - 0.5, 2)), // Source term
251+
},
252+
});
253+
254+
// Define mesh configuration
255+
model.setMeshConfig({
256+
meshDimension: "1D",
257+
elementOrder: "quadratic",
258+
numElementsX: 20,
259+
maxX: 1.0,
260+
});
261+
262+
// Define boundary conditions
263+
model.addBoundaryCondition("0", ["constantValue", 1]); // Left boundary, u(0) = 1
264+
model.addBoundaryCondition("1", "zeroGradient"); // Right boundary, zero gradient (du/dx = 0)
265+
266+
// Set solver method
267+
model.setSolverMethod("lusolve");
268+
269+
// Solve the problem and get the solution
270+
const { solutionVector, nodesCoordinates } = model.solve();
271+
272+
// Plot the solution as a 1D line plot
273+
plotSolution(
274+
solutionVector,
275+
nodesCoordinates,
276+
model.solverConfig,
277+
model.meshConfig.meshDimension,
278+
"line",
279+
"resultsCanvas"
280+
);
303281
});
304282
</script>
305283

0 commit comments

Comments
 (0)