Hot answers tagged

4

One way to do it might be to create an internal Line Loop in the input file where the crack originates. To do this, you would create 2 points at each end of the crack in your .geo file (say, points 1,2,3,4), and connect them up with lines. Then, create a Plane Surface from the border of that zero-thickness line loop. When you mesh the geometry, elements will ...


4

I'll expand my comment to an answer. Since your surface is fairly smooth, rather than generating a surface mesh, you can generate a 2D mesh of just the $(x, y)$-points that have been sampled, and then create a surface mesh by adding in the $z$-values later. This might suffice or it might not. Triangulation algorithms, like the one Tyler Olsen linked, are ...


4

I cannot visualize your geometry properly using Gmsh, or export it. I generated something similar using FreeCAD. Maybe you can modify this script for your purposes. from __future__ import division, print_function import FreeCAD as FC import Draft from numpy import sin, cos, pi nturns = 1 nslices = 20 length = 10 width = 20 height = 60 dz = height/nslices ...


4

I think you've got slightly the wrong end of the stick from the documentation. As with a lot of other software in the area, GMSH started out with low order, hard coded numberings. These are the ones with the ASCII art representations, which only give first and second order numberings for tetrahedra (hence there aren't any face nodes in the 4 node or 10 node "...


4

To create a coarser mesh, you can set the characteristic length globally to a larger value, e.g., SetFactory("OpenCASCADE"); Mesh.CharacteristicLengthFactor = 2; Circle(1) = {0, 0, 0, 1, 0, 2*Pi}; Line Loop(1) = {1}; Surface(1) = {1}; Increasing the value of Mesh.CharacteristicLengthFactor results in a coarser mesh; decreasing the value results in a finer ...


3

Tools like gmsh often require more information than STL provides -- the connectivity between triangles of the input surface mesh. You might be interested in trying TetWild, which can apparently reconstruct all of this connectivity information and correct for some level of degeneracy in the input data. The paper about it is very interesting too; they tested ...


3

I am not entirely sure what is going wrong in your version of the command-line approach. However, I think it works on my test STL file (with gmsh 4.0.7) with the following line: gmsh -string "Merge 'input.stl'; Surface Loop(2)={1}; Volume(3)={2};" -3 -o output.msh It might be also easier to use the full path of the input file to avoid gmsh "running around"....


3

is there a reason why you are trying to avoid creating two surfaces? The points on lines shared by the two surfaces should not be duplicated. Gmsh GUI enables the user to define physical surfaces (see Geometry->Physical Groups->Add->Surface), but you can only mark existing (elementary) surfaces with a physical tag. You cannot select some cells of existing ...


3

I'm not aware of any way to do this in a .geo file, under the GMSH application, or using the libgmsh interfaces. Somewhat annoyingly, the last operation gmsh does before a write tends to be a renumbering to sweep over 0D, 1D, 2D, and 3D objects sequentially. There has been some work on renumbering options recently, but it's targeted renumbering to make the ...


3

I think you need to know that when you discretize a volume by using tetrahedral meshes, you will get just an approximation of your perfect surfaces because of triangulation. You started with STEP file format, which is NOT a mesh format, but it's a CAD format. The difference between CAD formats and mesh formats is that CAD formats like STEP, IGES, SAT, etc. ...


3

I think you are looking for Kitware VTK, basically, the main library for interaction with VTK files. Examples page will contain a lot of samples, including the one you are looking for: output of an unstructured grid. As an addition, GMSH itself (I am using 3.0.5) is also able to export the mesh into VTK without the need to go through IO procedure. That can ...


3

So, by default and without recombination to quads (comment out Recombine Surface {1}), GMSH creates a mesh like the one in the left part of the picture. And by recombining surfaces into quad-elements you will obtain the mesh in the right part of the picture. Naturally, if your recombination comes from the original triangular mesh, you would expect the "...


3

Meshing algorithms can place the vertices of triangles and tetrahedra in a wide variety of ways, but they are us usually essentially constructive (i.e new vertices are introduced, existing vertices stay where they are). Disappointingly, this can cause the meshes which are generated to be unsuitable for numerical calculation. Mesh smoothing, at least in the ...


2

What you need to do is to analyze the set of input vertices (each triangle contributes three of these) and assign consecutive indices to them so that vertices that appear multiple times (i.e. are shared by different triangles) are assigned the same index every time. This leaves you with a list of (unique) vertices ${\bf x}_i$, and a list of index triples $(i,...


2

It is a tricky thing to do (in pure GMSH) by using only the MSH file. Because, conceptually, the MSH file does not contain information about the underlying geometry that was discretized. However, certain remeshing capabilities are present in GMSH. See tutorial 13 "Remeshing without underlying CAD model" for remeshing of an STL file. For your task, you would ...


2

I solved my problem now. Despite initially not wanting to do that, I now generate .geo-files in my script. I do it with echo "Merge '$cwd/STL/slice$a.$i.stl';\nSurface Loop(1) = {1};\nVolume(1) = {1};" >$cwd/GEO/slice$a.$i.geo # convert .stl to .msh /Volumes/User/Gmsh.app/Contents/MacOS/gmsh $cwd/GEO/slice$a.$i.geo -3 -o $cwd/MSH/slice$a.$...


2

There are a couple of different ways to specify element mesh sizes in GMSH, I will explain the simplest one using the points here but for the others I suggest you check the manual: http://gmsh.info/doc/texinfo/gmsh.html#Specifying-mesh-element-sizes As you have in your example you can define a GMSH point as: Point(point #) = {x, y, z, lc}; where x, y, z ...


2

Why don't you take a look a HEALpix which provides a nice equal area hierarchical triangulation of the surface of the sphere with no distorted triangles: https://healpix.jpl.nasa.gov/ https://en.wikipedia.org/wiki/HEALPix https://healpix.sourceforge.io/ Here's the NASA illustration of the hierarchy: The package has been instrumental in producing maps and ...


2

I found a solution by replacing the points with line segments: #poly = geom.add_polygon(pts, mesh_size = mesh_size) #loop = geom.add_curve(poly) #geom.in_surface(loop, ball_srf.surface_loop) ...


2

For complicated geometries, you probably need some kind of a devoted CAD tool rather than a built-in Matlab functionality. GMSH is a nice open-source tool, and this is my weapon of choice for such problems. Now, there is nothing specific about nested geometries in GMSH that should be reflected in the documentation. You might want to get familiar with basic ...


2

To get the triangles in the last surface Recombined into quadrilaterals, you simply need to add the surface #9 into the last line: Recombine Surface {1, 2, 3, 4, 5, 6, 7, 8, 9}; This will result in: Also, you might be interested in the Mesh.RecombineAll = 1; option. And playing with the 2-D Recombination algorithm via Mesh.RecombinationAlgorithm might ...


1

There is probably an option to do this through Gmsh API, but I am not aware of it. In the graphic interface there is not an option for this. If you are interested of doing this just in Gmsh, you should probably ask in one of the Gmsh sites. Keep in mind that you could create the coordinates of your mesh using a map from a rectangular grid (in parametric ...


1

You should ask this on gmsh list. The gmsh developer answers questions. Searching online suggests an answer http://geuz.org/pipermail/gmsh/2020/013631.html Create a geo file like this Merge "input.msh"; SetOrder 2; Save "output.msh"; and run it in Gmsh.


1

I don't know gmsh, but I have an idea you could check. How are the coordinates interpreted? If the coordinates are $x$ $y$ $z$, shouldn't the second cylinder be straight upwards, length one? 0,35 0,35 0 0,35, 1,35 0 Then the third cylinder would be correct. All angles are absolute to the origin. Seeing only the image, it looks like you are off by the ...


1

You have several options. Option A. Go for the gmsh::model::geo::extrude The API call specification is given, as follows: GMSH_API void extrude(const gmsh::vectorpair & dimTags, const double dx, const double dy, const double dz, gmsh::vectorpair & ...


1

Recombine Surface{1} - recombines only the triangles for the surface #1. To allow recombination of all the surfaces, you need either Mesh.RecombineAll=1 or Recombine Surface {:};. Those commands will perform it on all the surfaces. However, I find it a bit strange that you are using Recombine commands for that purpose. They are usually used to create a ...


1

I was totally able to replicate your problem in GMSH 3.0.2. In GUI, I would get an error about self-intersecting surface mesh and inability to perform a 3-D meshing about 1 out of 3 times. While I don't see anything wrong with your GMSH script, I fixed the normals for the surfaces and surface loop definitions, sometimes that can make a difference (it did ...


1

You have specified the wrong things to be Physical. If you just want to obtain 2-D elements, there is no need to specify the lines to be physical. However, you certainly need to specify your surface to be physical. Also, you may want to specify the #points in the structured mesh for transfinite lines before announcing the Surface to be transfinite. Please, ...


Only top voted, non community-wiki answers of a minimum length are eligible