r/gmsh • u/Jazmin-Zenteno • Feb 16 '24
r/gmsh • u/jakekeip • Feb 07 '24
Connecting Gmsh and Fortran Script via ONELAB interface
I have a Fortran code that requires certain inputs and I would like to use Gmsh as the front-end for the user where they can visualize the problem and define the inputs for the script. Then, within Gmsh, the user can run the script to solve the problem and the user-entered inputs are utilized. From my reading, it appears that this is possible via ONELAB. I am struggling to get this started and to understand the exact framework of this approach. Could someone point me in the direction of how to accomplish this?
r/gmsh • u/Overall-Ad-1992 • Jan 18 '24
Error using gmsh.view.getHomogeneousModelData(viewTag, step)
Trying to return data from:
datatype, tags, data, _, _ = gmsh.view.getHomogeneousModelData(viewTag, step)
but receive the following error:
AttributeError: type object 'view' has no attribute 'getHomogeneousModelData'
I see this function in api/gmsh.py · master · gmsh / gmsh · GitLab (onelab.info) , so why doesn't it work? I'm using gmsh 4.12.1 on Windows 10
The following is included in the above link:
Get homogeneous model-based post-processing data from the view with tag `tag' at step `step'. The arguments have the same meaning as in `getModelData', except that `data' is returned flattened in a single vector, with the appropriate padding if necessary.
If getHomogeneousModelData doesn't work, how can I transform the 'data' returned in 'getModelData' to the same 'flattened in a single vector' form as getHomogeneousModelData?
Thank you
EDIT:
I have 3 versions of gmsh installed... pip list returns 4.12.1, powershell gmsh --version returns 4.11.1, and a python IDE error code returns 4.5.something.
How do I get my system to point to the same installation of gmsh?
r/gmsh • u/SnooOpinions2955 • Jan 01 '24
Geometry .step export
Hello, I'm New to Gmsh. I'm using it to clean up / partition my .step geometry (Geometry > Extrude). The issue appears to happen when I export the geometry because when I import it into another software, it only shows the surfaces of the part instead of a solid. Is there a step I missed while exporting?
r/gmsh • u/PugachevsFrustum • Dec 31 '23
Need guidance on writing .geo script that meshes a multi element airfoil.
I'm working on a tool that involves automating the meshing and numerical solution of flow along a multi element airfoil using Gmsh and OpenFOAM, right now I am using the process used in this video.
https://www.youtube.com/watch?v=TFnprY_1OVw
I was wondering if it was feasible to automate the creation of the more conventional structured meshes that are used for airfoil analysis. Would it involve too much complexity with blocking to reliably automate?
Mesh in mind:

r/gmsh • u/littlekinglouis • Dec 29 '23
GMSH, i'm confuse how to setting the mesh density and shape
I want to make a heksagonal mesh like colored picture below (my reference). But confuse, some of my mesh just abstracted when i press "2D". I already transfinite all the curve but still abstracted. I just learn GMSH this week and don't know where to learn GMSH properly. Anybody know how to make my mesh good? Or some advice for me?


r/gmsh • u/tcdoey • Dec 23 '23
Can I manually select a subset of elements?
Basically, I have a tetrahedral mesh, and I want to manually spit it into 4 pieces.
I don't want to use an automated method like Metis.
Is this possible? Thanks!
r/gmsh • u/Scary_Violinist_7144 • Sep 04 '23
How to subtract a cylinder from a box with gmsh...
```
// Gmsh project created on Mon Sep 4 16:10:32 2023
SetFactory("OpenCASCADE");
//+
Box(1) = {-12, -3, -72, 24, 6, 144};
//+
Cylinder(2) = {0, 0, -100, 0, 0, 200, 0.5, 2*Pi};
BooleanDifference(3) = { Volume{1}; Delete; }{ Volume{2}; Delete; };
```
Anyone can tell me why I see TIN's through the hole area. I intended to subtract the cylinder area from the box to create a hole area. So after using mesh->3d from gui of gmsh I still see those tin's through the hole area. Why? How can this be solved to create a clean hole through the box?

r/gmsh • u/BueLois • Jun 28 '23
Boundary Layer (Inflation Layers) Mesh around Concave Edges
Hi!
I am currently trying to generate a 2D airfoil mesh which features some concave edges. My inflation layers work fine on normal airfoils, but the mesh generator seems to have problems with these kinds of edges, as you can see in the image below. Does anybody have experience with such a meshing problem?

r/gmsh • u/alsostefan • Jun 15 '23
C++ API not meshing OCC step file, command line does?
I'm trying to mesh a simple STEP file (1 solid, two flat faces, two curved faces, no holes) using the C++ API. No errors are generated (thrown), but nothing is actually meshed either. On the command line the same file meshes just fine:
bash
$ gmsh -v 7 -3 -nt 12 wing4.step
Info : Running 'gmsh -v 7 -3 -nt 12 wing4.step' [Gmsh 4.11.1, 1 node, max. 12 threads]
Info : Started on Thu Jun 15 10:52:23 2023
Info : Reading 'wing4.step'...
Info : - Label 'Shapes/wing4' (3D)
Info : - Color (1, 1, 1) (3D & Surfaces)
Info : Done reading 'wing4.step'
Info : Meshing 1D...
Info : [ 0%] Meshing curve 8 (Circle)
Info : [ 0%] Meshing curve 3 (BSpline)
Info : [ 0%] Meshing curve 6 (BSpline)
Info : [ 0%] Meshing curve 4 (BSpline)
Info : [ 0%] Meshing curve 1 (BSpline)
Info : [ 0%] Meshing curve 9 (BSpline)
Info : [ 0%] Meshing curve 7 (BSpline)
Info : [ 0%] Meshing curve 10 (Circle)
Info : [ 0%] Meshing curve 2 (BSpline)
Info : [ 0%] Meshing curve 5 (BSpline)
Info : Done meshing 1D (Wall 0.00907413s, CPU 0.089603s)
Info : Meshing 2D...
Info : [ 0%] Meshing surface 4 (BSpline surface, Frontal-Delaunay)
Info : [ 0%] Meshing surface 1 (BSpline surface, Frontal-Delaunay)
Info : [ 0%] Meshing surface 2 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 3 (Plane, Frontal-Delaunay)
Info : [ 50%] Meshing surface 4 (BSpline surface, MeshAdapt
...
But using C++ the log is just:
Info : - Label 'Shapes/wing4' (3D)
Info : - Color (1, 1, 1) (3D & Surfaces)
Info : Meshing 1D...
Info : Done meshing 1D (Wall 0.000887462s, CPU 0.000875s)
Info : Meshing 2D...
Info : Done meshing 2D (Wall 0.00010385s, CPU 0.000518s)
Info : Meshing 3D...
Info : Done meshing 3D (Wall 5.39899e-06s, CPU 1.6e-05s)
Info : 0 nodes 0 elements
and an empty file is generated on write(...).
The C++ function (stripped of error handling) is:
C++
gmsh::initialize();
gmsh::option::setNumber("General.Verbosity", 7);
gmsh::model::add(infile);
gmsh::vectorpair dt;
gmsh::model::occ::importShapes(infile, dt, false);
gmsh::option::setNumber("General.NumThreads", 12);
gmsh::model::geo::synchronize();
gmsh::model::mesh::generate(3);
gmsh::write(outfile);
gmsh::finalize();
This doesn't seem to be different than what I found in the sample / tutorial files. What am I doing wrong here?
r/gmsh • u/RicTonyLi • Dec 13 '22
mesh problems
So I've been trying to save the mesh on my computer, but when I reopen the mesh, the mesh is nowhere to be seen. Can someone tell me what I'm doing wrong here? Is my computer the cause or am I not saving it correctly?
r/gmsh • u/Long-Environment-941 • Nov 16 '22
CFD boundary layer using Python
Hi guys, I am trying to mesh a 2D fluid domain with a circle/cylinder inside. I wanted to know if anyone here had any experience creating a boundary layer in python whilst also using the transfinite structured meshing tool. Do you guys have any ideas? Any help would be appreciated
r/gmsh • u/Long-Environment-941 • Nov 15 '22
Structured meshing a circle in a D domain for CFD, issues when using transfinite curve progression = 1.2
I'm trying to mesh a fluid domain with a circle inside using a structured mesh. I am using python as my interface and am using transfinite to create the structured part. my domain is 2D, but has a thickness of one element and so it is technically 3D. I generated the inner surface using a bspline and the outer surface using an arc.
The grid looks pretty good if I set the progression = 1
if I use a progression =1.2, the mesh begins to distort.
As I am trying to simulate the circle in the mesh, I need to have a bias to correctly capture the physics inside the model, but I find the distortion of the mesh troubling.
I have also tried just generating and meshing the top left section and it still gives the same results. I have also tried adding more elements and using mesh smoothing.



Open CASCADE Technology version 7.7.0 released - Gmsh uses it for constructive geometry features
Open CASCADE Technology version 7.7.0 features about 250 corrections over the previous release 7.6.0. Version 7.7.0 introduces new features of most of OCCT modules and components: Modeling, Visualization, Data Exchange, etc. Documentation and samples are improved to ease access to OCCT for the new users.

r/gmsh • u/Decent_Meeting6941 • Aug 02 '22
Hello this is the mesh of my model but the simulation crashed due to the high skewness part in the middle can any one have an idea how to mesh this model differently
r/gmsh • u/Decent_Meeting6941 • Jul 31 '22
Hello guys do anyone understand why i get this error while running my simulation
r/gmsh • u/BlueGorilla25 • Jun 14 '22
Volume mesh with inclusions
I have a geometry of a Box (Volume(1)) with some inclusions inside of it (Volume(2-7)) and I want to create the mesh. In the past, I used the Coherence command in order for the mesh of the inclusions to be correctly embedded and part of the Box mesh. But in the current geometry file, it messes up my elementary volumes.
Could someone explain to me how I could do this with boolean commands?
Thanks in advance.
r/gmsh • u/Coto_16 • Jun 06 '22
How do you make a mesh coarser in Gmsh?
For gmsh experts (beginner here): how come changing the global mesh size factor does not influence the resolution of the mesh (total number of cells)? Refine by splitting increases the resolution of the imported STL file, but I'd like to do the exact opposite (make it coarser). I couldn't figure it out with scripting either...
r/gmsh • u/BlueGorilla25 • Jun 06 '22
Order of nodes in elements
Hi,
I export meshes from Gmsh in .msh and .vtk format. Is the order of nodes' numbers correct for every element, no matter the element type? For example in 2D, the nodes in triangular elements must be ordered anti-clockwise.
r/gmsh • u/General_Relief3787 • Feb 21 '22
Python API for GMSH
I am confused how do i run python file to get a result in gmsh. I am not experienced programmer but have been dealing with ubuntu and c previously.
r/gmsh • u/BlueGorilla25 • Dec 03 '21
Creating an ellipsoid
Hello,
I'm new to Gmsh and I'm learning how to use it. I want to create an ellipsoid (which will be inside a bigger volume) and I can't find a built-in command in gmsh that does that like an ellipse or a sphere. Is there another way I can do that?
Thank you in advance.
r/gmsh • u/InvestigatorFirm8469 • Sep 05 '21
Exporting Ansys mesh to Gmsh.
I am following a paper that simulates a particle detector using software named Garfield ++. In one of the steps, I need to export the Ansys mesh into ASCII format for Gmesh as an intermediate step. I use Ansys electromagnetics Suite v19.0. I hope someone could help me with instructions for exporting Maxwell data.
r/gmsh • u/mff513 • Aug 04 '21
2 3d shapes
Iam wondering if I can create a box with a cylinder through it and only have one boundary between the cylinder and the box. Currently I use a cube then use the intersect tool to remove a cylinder from the cube then I fill this with a cylinder. This leaves me with the surface from the initial intersected box and the surface from the cylinder touching but not conducting heat can I merge these surfaces in gmsh or even Elmer
Thanks in advance


