From d7939551fb9719af572c5381ec52c8b57708f837 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Sun, 9 Nov 2025 23:22:18 +0200 Subject: [PATCH] feat(examples): Add Gmsh geometry file for unit square mesh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New file: examples/gmsh_heat_equation/unit_square.geo (32 lines) Defines unit square [0,1]×[0,1] with: - 4 corner points with mesh size lc=0.1 - 4 boundary edges (bottom, right, top, left) - Plane surface for 2D heat equation - Physical groups labeled for boundary conditions - Triangular elements (Tri3, ElementOrder=1) - Frontal-Delaunay meshing algorithm Generate mesh with: gmsh -2 unit_square.geo -o unit_square.msh --- examples/gmsh_heat_equation/unit_square.geo | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/gmsh_heat_equation/unit_square.geo diff --git a/examples/gmsh_heat_equation/unit_square.geo b/examples/gmsh_heat_equation/unit_square.geo new file mode 100644 index 0000000..f4c1cf2 --- /dev/null +++ b/examples/gmsh_heat_equation/unit_square.geo @@ -0,0 +1,32 @@ +// Gmsh geometry file: Unit square mesh for heat equation tutorial +// Generate with: gmsh -2 unit_square.geo -o unit_square.msh + +// Mesh element size +lc = 0.1; + +// Corner points +Point(1) = {0, 0, 0, lc}; +Point(2) = {1, 0, 0, lc}; +Point(3) = {1, 1, 0, lc}; +Point(4) = {0, 1, 0, lc}; + +// Edges +Line(1) = {1, 2}; // Bottom +Line(2) = {2, 3}; // Right +Line(3) = {3, 4}; // Top +Line(4) = {4, 1}; // Left + +// Surface +Line Loop(1) = {1, 2, 3, 4}; +Plane Surface(1) = {1}; + +// Physical groups for boundary conditions +Physical Line("bottom") = {1}; +Physical Line("right") = {2}; +Physical Line("top") = {3}; +Physical Line("left") = {4}; +Physical Surface("body") = {1}; + +// Use triangular elements +Mesh.ElementOrder = 1; // Linear elements (Tri3) +Mesh.Algorithm = 6; // Frontal-Delaunay for 2D