|
[Sponsors] |
Issues with Structured Mesh and Field Box in Gmsh |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Ivan Urdiales
Join Date: Mar 2025
Posts: 1
Rep Power: 0 ![]() |
Hello everyone!
This is my first post on the forum, so I apologize in advance if I’m posting in the wrong section. I’m trying to create a structured mesh for a geometry in Gmsh, but I’ve been running into some issues. The only way I managed to get a structured mesh was by dividing the geometry into three rectangles. Although this worked, I’m not entirely sure if it could cause problems later on during my OpenFOAM simulation. Additionally, I wanted to add a field box to refine the mesh near the walls, but I couldn't make it work when using a finite surface. I’m not sure what I might be doing wrong or if there’s a better way to approach this. Here’s my geometry and script: SetFactory("OpenCASCADE"); //+ Point(1) = {0, 0, 0, 1.0}; //+ Point(2) = {0, -0.008, 0, 1.0}; //+ Point(3) = {0.00606, -0.008, 0, 1.0}; //+ Point(4) = {0.00606, -0.016, 0, 1.0}; //+ Point(5) = {0.008, -0.016, 0, 1.0}; Point(6) = {0.008, 0, 0, 1.0}; Point(7) = {0.00606, 0, 0, 1.0}; Point(8) = {0.008, -0.008, 0, 1.0}; //+ Line(1) = {1, 2}; //+ Line(2) = {2, 3}; //+ Line(3) = {3, 7}; //+ Line(4) = {7, 1}; //+ Line(5) = {7, 6}; //+ Line(6) = {6, 8}; //+ Line(7) = {8, 3}; //+ Line(8) = {3, 4}; //+ Line(9) = {4, 5}; //+ Line(10) = {5, 8}; //+ Curve Loop(1) = {1, 2, 3, 4}; //+ Plane Surface(1) = {1}; //+ Curve Loop(2) = {3, 5, 6, 7}; //+ Plane Surface(2) = {2}; //+ Curve Loop(3) = {8, 9, 10, 7}; //+ Plane Surface(3) = {3}; //+ Transfinite Curve {1, 3, 6, 8, 10} = 30 Using Progression 1; //+ Transfinite Curve {4, 2} = 15 Using Progression 1; //+ Transfinite Curve {5, 7, 9} = 5 Using Progression 1; //+ Transfinite Surface {1}; //+ Transfinite Surface {2}; //+ Transfinite Surface {3}; //+ Recombine Surface {1, 2, 3}; //+ Extrude {0, 0, 0.00194} { Surface{1}; Surface{2}; Surface{3}; Layers {1}; Recombine; } //+ Physical Surface("Walls", 29) = {4, 5, 13, 15, 10}; //+ Physical Surface("frontAndBack", 30) = {8, 12, 16, 1, 2}; //+ Physical Surface("Inlet", 31) = {8, 9}; //+ Physical Surface("Outlet", 32) = {14}; //+ Field[1] = Box; Field[1].XMin = 0.00606; Field[1].XMax = 0.008; Field[1].YMin = -0.016; Field[1].YMax = -0.008; Field[1].ZMin = 0; Field[1].ZMax = 0.00194; Field[1].Thickness = 0.0001; Field[1].VIn = 5e-04; Field[1].VOut = 0.00004; Background Field = 1; //+ Mesh.FieldsStructured = 1; I’d really appreciate any guidance or suggestions! Thanks in advance for your help. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
José Messias
Join Date: May 2018
Location: Viana do Castelo, Portugal
Posts: 5
Rep Power: 8 ![]() |
Hello, you can divide your geometry into three (or more) volumes without any problem, as long as you are correctly defining the boundary surfaces.
For refining your mesh next to the walls you could use the Bump progression, it applies double Progression function in your transfinite curves. I have slightly changed your code to demonstrate it: Code:
SetFactory("OpenCASCADE"); // Variables L = 0.008; H = 0.00194; dim1 = 30; dim2 = 15; dim3 = 5; bump = 0.25; Point(1) = {0 , 0 , 0, 1.0}; Point(2) = {0 , -L , 0, 1.0}; Point(3) = {(L-H), -L , 0, 1.0}; Point(4) = {(L-H), -(2*L), 0, 1.0}; Point(5) = {L , -(2*L), 0, 1.0}; Point(6) = {L , 0 , 0, 1.0}; Point(7) = {(L-H), 0 , 0, 1.0}; Point(8) = {L , -L , 0, 1.0}; Line(1) = {1, 2}; Line(2) = {2, 3}; Line(3) = {3, 7}; Line(4) = {7, 1}; Line(5) = {7, 6}; Line(6) = {6, 8}; Line(7) = {8, 3}; Line(8) = {3, 4}; Line(9) = {4, 5}; Line(10) = {5, 8}; Transfinite Line {1, 3, 6, 8, 10} = dim1 Using Bump bump; Transfinite Line {4, 2} = dim2 Using Bump bump; Transfinite Line {5, 7, 9} = dim3 Using Bump bump; Line Loop(1) = {1, 2, 3, 4}; Plane Surface(1) = {1}; Line Loop(2) = {3, 5, 6, 7}; Plane Surface(2) = {2}; Line Loop(3) = {8, 9, 10, 7}; Plane Surface(3) = {3}; Transfinite Surface {1:3}; Recombine Surface {1:3}; Extrude {0, 0, H} { Surface{1}; Surface{2}; Surface{3}; Layers{1}; Recombine; } Physical Surface("Walls", 29) = {4, 5, 13, 15, 10}; Physical Surface("frontAndBack", 30) = {8, 12, 16, 1, 2}; Physical Surface("Inlet", 31) = {7, 9}; // replaced surface: 8 -> 7 Physical Surface("Outlet", 32) = {14}; Field[1] = Box; Field[1].XMin = (L-H); Field[1].XMax = L; Field[1].YMin = -(2*L); Field[1].YMax = -L; Field[1].ZMin = 0; Field[1].ZMax = H; Field[1].Thickness = 0.0001; Field[1].VIn = 5e-04; Field[1].VOut = 0.00004; |
|
![]() |
![]() |
![]() |
Tags |
gmsh |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swakExpression not writing to log | alexfells | OpenFOAM Community Contributions | 3 | March 16, 2020 18:19 |
[Other] dynamicTopoFVMesh and pointDisplacement | RandomUser | OpenFOAM Meshing & Mesh Conversion | 6 | April 26, 2018 07:30 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 18:57 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 09:38 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |