Skip to content

Commit 5f06ebd

Browse files
committed
Add unstructured and structured mesh files fort the Gmsh rectangular quadrilateral tutorial
1 parent b1435be commit 5f06ebd

File tree

8 files changed

+689
-181
lines changed

8 files changed

+689
-181
lines changed

assets/gmsh_rect_quad.png

-14.4 KB
Binary file not shown.

assets/gmsh_rect_quad_struct.png

3.79 KB
Loading

assets/gmsh_rect_quad_unstruct.png

11.2 KB
Loading

tutorials/HeatConduction2DFinGmsh.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ <h2 id="gmshfileimport"><a name="gmshfileimport"></a>Gmsh File Import</h2>
123123
printVersion();
124124

125125
// Fetch the mesh file
126-
const response = await fetch("./rect_quad.msh"); // .msh version 4.1 is currently supported
126+
const response = await fetch("./rect_quad_unstruct.msh"); // .msh version 4.1 is currently supported
127127
if (!response.ok) {
128128
throw new Error(`Failed to load mesh file: ${response.status} ${response.statusText}`);
129129
}
130130
const meshContent = await response.text();
131131

132132
// Create a File object with the actual content
133-
const meshFile = new File([meshContent], "rect_quad.msh");
133+
const meshFile = new File([meshContent], "rect_quad_unstruct.msh");
134134

135135
// Create a new FEAScript model
136136
const model = new FEAScriptModel();
@@ -281,9 +281,9 @@ <h2 id="generatedmesh"><a name="generatedmesh"></a>Generated Mesh</h2>
281281

282282
<div class="center-image">
283283
<img
284-
src="../assets/gmsh_rect_quad.png"
284+
src="../assets/gmsh_rect_quad_unstruct.png"
285285
alt="Quadrilateral mesh generated by Gmsh"
286-
style="max-width: 80%; height: auto"
286+
style="max-width: 40%; height: auto"
287287
/>
288288
<p><em>Figure: Quadrilateral mesh generated using the rect.geo script with Gmsh</em></p>
289289
</div>
@@ -334,14 +334,14 @@ <h2 id="results"><a name="results"></a>Results</h2>
334334
printVersion();
335335

336336
// Fetch the mesh file
337-
const response = await fetch("./rect_quad.msh");
337+
const response = await fetch("./rect_quad_unstruct.msh"); // .msh version 4.1 is currently supported
338338
if (!response.ok) {
339339
throw new Error(`Failed to load mesh file: ${response.status} ${response.statusText}`);
340340
}
341341
const meshContent = await response.text();
342342

343343
// Create a File object with the actual content
344-
const meshFile = new File([meshContent], "rect_quad.msh");
344+
const meshFile = new File([meshContent], "rect_quad_unstruct.msh");
345345

346346
// Create a new FEAScript model
347347
const gmshModel = new FEAScriptModel();
@@ -395,5 +395,8 @@ <h2 id="results"><a name="results"></a>Results</h2>
395395
</script>
396396

397397
<p>&#169; 2023-<span id="currentYear"></span> FEAScript</p>
398+
<script>
399+
document.getElementById("currentYear").innerHTML = new Date().getFullYear();
400+
</script>
398401
</body>
399402
</html>

tutorials/rect.geo

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Use the command "gmsh rect.geo -2" to generate the mesh
44

55
lc = 0.2; // Characteristic length (mesh density)
6+
// Note: In the structured case, the lc = 0.2 no longer directly determines the mesh size,
7+
// as the Transfinite Curve commands explicitly set the number of elements along each boundary
68

79
// Points (x, y, z, mesh size)
810
Point(1) = {0, 0, 0, lc}; // Bottom left
@@ -29,7 +31,15 @@ Physical Line("left") = {4};
2931
// Physical Surface (optional, for FEM domains)
3032
Physical Surface("domain") = {1};
3133

34+
// Create structured mesh
35+
//Transfinite Curve{1} = 20;
36+
//Transfinite Curve{2} = 10;
37+
//Transfinite Curve{3} = 20;
38+
//Transfinite Curve{4} = 10;
39+
//Transfinite Surface{1};
40+
3241
// Generate 2D mesh
3342
Recombine Surface{1}; // Turns triangle mesh into quads
43+
Mesh.ElementOrder = 2; // Set quadratic elements
3444
Mesh 2;
3545

tutorials/rect_quad_coarse.msh

Lines changed: 0 additions & 175 deletions
This file was deleted.

0 commit comments

Comments
 (0)