Skip to content

Commit c809b55

Browse files
committed
Refactor code structure for improved readability
1 parent 5f06ebd commit c809b55

File tree

8 files changed

+1592
-1008
lines changed

8 files changed

+1592
-1008
lines changed

assets/gmsh_rect_quad_struct.png

0 Bytes
Loading

assets/gmsh_rect_quad_unstruct.png

-3.28 KB
Loading

index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,6 @@ <h2 id="features"><a name="Features"></a>Features</h2>
188188
margin-bottom: 4px;
189189
" /></a
190190
>) files
191-
<i
192-
><a href="https://github.com/FEAScript/FEAScript-core/issues/5" target="_blank"
193-
>(under development)</a
194-
></i
195-
>
196191
</li>
197192
</ul>
198193
</li>
@@ -246,6 +241,10 @@ <h2 id="tutorials"><a name="Tutorials"></a>Tutorials</h2>
246241
>API (web worker)</a
247242
>
248243
|
244+
<a href="https://feascript.com/tutorials/HeatConduction2DFinGmsh.html" target="_blank"
245+
>API (Gmsh mesh)</a
246+
>
247+
|
249248
<a href="https://feascript.com/tutorials/HeatConduction2DFinPlatform.html" target="_blank"
250249
>XML (FEAScript platform)</a
251250
>

sitemap.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@
2020
<loc>https://feascript.com/tutorials/HeatConduction2DFinPlatform.html</loc>
2121
<priority>0.8</priority>
2222
</url>
23+
<url>
24+
<loc>https://feascript.com/tutorials/HeatConduction2DFinGmsh.html</loc>
25+
<priority>0.8</priority>
26+
</url>
2327
</urlset>

tutorials/HeatConduction2DFinGmsh.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ <h2 id="gmshfileimport"><a name="gmshfileimport"></a>Gmsh File Import</h2>
145145
model.setMeshConfig({
146146
parsedMesh: result,
147147
meshDimension: "2D",
148-
elementOrder: "linear",
148+
elementOrder: "quadratic",
149149
});
150150

151151
// Define boundary conditions using Gmsh physical group tags
@@ -213,7 +213,7 @@ <h3 id="gmshgeofile"><a name="gmshgeofile"></a>Example Gmsh .geo File</h3>
213213
// With Physical Lines for boundary labeling
214214
// Use the command "gmsh rect.geo -2" to generate the mesh
215215

216-
lc = 0.2; // Characteristic length (mesh density)
216+
lc = 0.7; // Characteristic length (mesh density)
217217

218218
// Points (x, y, z, mesh size)
219219
Point(1) = {0, 0, 0, lc}; // Bottom left
@@ -297,7 +297,11 @@ <h2 id="generatedmesh"><a name="generatedmesh"></a>Generated Mesh</h2>
297297
<h2 id="results"><a name="results"></a>Results</h2>
298298
<p>
299299
Below is the 2D contour plot of the computed temperature distribution. This plot is generated in real
300-
time using FEAScript.
300+
time using FEAScript. Please note that solutions computed on unstructured meshes like this may exhibit
301+
small numerical differences compared to solutions on structured orthogonal meshes. This occurs because
302+
derivative calculations in non-orthogonal elements are inherently less precise due to the Jacobian
303+
transformation process. These small differences are expected and acceptable for most engineering
304+
applications, but may be noticeable in regions with steep temperature gradients.
301305
</p>
302306

303307
<div id="solutionPlot"></div>
@@ -327,9 +331,13 @@ <h2 id="results"><a name="results"></a>Results</h2>
327331
// importGmshQuadTri,
328332
// plotSolution,
329333
// printVersion,
334+
// logSystem,
330335
//} from "../../FEAScript-core/src/index.js";
331336

332337
window.addEventListener("DOMContentLoaded", async () => {
338+
// Enable debug logging mode
339+
//logSystem("debug");
340+
333341
// Print FEAScript version in the console
334342
printVersion();
335343

@@ -352,15 +360,11 @@ <h2 id="results"><a name="results"></a>Results</h2>
352360
// Parse the mesh file first
353361
const result = await importGmshQuadTri(meshFile);
354362

355-
//console.log("GMSH Nodal Numbering:", result.nodalNumbering);
356-
//console.log("x Coordinates:", result.nodesXCoordinates);
357-
//console.log("y Coordinates:", result.nodesYCoordinates);
358-
359363
// Define mesh configuration with the parsed result
360364
gmshModel.setMeshConfig({
361365
parsedMesh: result,
362366
meshDimension: "2D",
363-
elementOrder: "linear",
367+
elementOrder: "quadratic",
364368
});
365369

366370
// Define boundary conditions using Gmsh physical group tags
@@ -369,8 +373,6 @@ <h2 id="results"><a name="results"></a>Results</h2>
369373
gmshModel.addBoundaryCondition("2", ["convection", 1, 20]); // top boundary
370374
gmshModel.addBoundaryCondition("3", ["symmetry"]); // left boundary
371375

372-
//console.log("GMSH Boundary Conditions:", gmshModel.boundaryConditions);
373-
374376
// Set solver method
375377
//model.setSolverMethod("jacobi");
376378
gmshModel.setSolverMethod("lusolve");
@@ -379,8 +381,6 @@ <h2 id="results"><a name="results"></a>Results</h2>
379381
const { solutionVector: gmshSolutionVector, nodesCoordinates: gmshNodesCoordinates } =
380382
gmshModel.solve();
381383

382-
//console.log("GMSH Solution Vector:", gmshSolutionVector);
383-
384384
// Plot the GMSH solution
385385
plotSolution(
386386
gmshSolutionVector,

tutorials/rect.geo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// With Physical Lines for boundary labeling
33
// Use the command "gmsh rect.geo -2" to generate the mesh
44

5-
lc = 0.2; // Characteristic length (mesh density)
5+
lc = 0.7; // Characteristic length (mesh density)
66
// Note: In the structured case, the lc = 0.2 no longer directly determines the mesh size,
77
// as the Transfinite Curve commands explicitly set the number of elements along each boundary
88

0 commit comments

Comments
 (0)