# Importing Mesh Created in Gmsh

**URL:** <https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583>\
**Category:** General Questions\
**Created:** [December 3, 2022, 2:01pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583 "2022-12-03T14:01:34Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![arnie](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@arnie](https://prepomax.discourse.group/u/arnie)\
**Post date:** [December 3, 2022, 2:01pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/1 "2022-12-03T14:01:34Z")

</div>

@FEAnalyst , I must be doing something wrong because I get the following result:

You can find the cad file at Grabcad at [https://grabcad.com/library/battery-holding-bracket-1](https://grabcad.com/library/battery-holding-bracket-1)

 ![image](https://global.discourse-cdn.com/free1/uploads/prepomax/original/1X/41a0e175bca7875a8a73e00b6cfcba1c6c31d6f9.jpeg)

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [December 3, 2022, 2:14pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/2 "2022-12-03T14:14:01Z")

</div>

This geometry is quite complex for hex meshing, you may have to partition it first. I don’t have much experience with Gmsh but you can also try changing meshing algorithm settings. It will be best to ask in their GitLab issues section since Gmsh doesn’t have a forum.

---

<div class="post-metadata">

**Author:** ![SergioP1975](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/sergiop1975/32/37_2.png) [@SergioP1975](https://prepomax.discourse.group/u/SergioP1975)\
**Post date:** [December 4, 2022, 11:10am UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/3 "2022-12-04T11:10:01Z")

</div>

Looks likes you have meshed the part with some option to create first a 2d quad mesh and then the solid elements (tets), so in the interface between those quads and tets the mesher has put piramids. Now I don´t remember if piramid elements are allowed in Prepomax.

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [December 4, 2022, 12:19pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/4 "2022-12-04T12:19:16Z")

</div>

> [@SergioP1975](#):
>
> Now I don´t remember if piramid elements are allowed in Prepomax.

PrePoMax and CalculiX support wedge, not pyramid elements.

---

<div class="post-metadata">

**Author:** ![arnie](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@arnie](https://prepomax.discourse.group/u/arnie)\
**Post date:** [December 5, 2022, 7:25pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/5 "2022-12-05T19:25:45Z")

</div>

I have tried with all different settings in Gmsh (see below), but keep getting the same mesh result as above.

Can someone who uses Gmsh please try the Grabcad model in the link above and export a hex mesh ?

 ![image](https://global.discourse-cdn.com/free1/uploads/prepomax/original/1X/6d23da35fba1dbb24d7073b46464a228d2ce9ec9.png)

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [December 5, 2022, 7:40pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/6 "2022-12-05T19:40:58Z")

</div>

Can you share the .geo file (script generated by Gmsh) ?

---

<div class="post-metadata">

**Author:** ![arnie](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@arnie](https://prepomax.discourse.group/u/arnie)\
**Post date:** [December 5, 2022, 7:51pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/7 "2022-12-05T19:51:02Z")

</div>

@FEAnalyst Do you mean this ?..

Merge “holding\_bracket.stp”;  
//+  
SetFactory(“OpenCASCADE”);  
//+  
Physical Volume(“e”, 214) = {1};

![image](https://global.discourse-cdn.com/free1/uploads/prepomax/original/1X/bcfde01f0eade3c612425d08861c9f7611d16828.png)

---

<div class="post-metadata">

**Author:** ![ANYS](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/anys/32/7737_2.png) [@ANYS](https://prepomax.discourse.group/u/ANYS)\
**Post date:** [December 5, 2022, 11:09pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/8 "2022-12-05T23:09:20Z")

</div>

Hi Arnie,

Your Subdivision algorithm is not appropriate (You don’t want quads).  
You should get a beautiful 2D mesh before going to 3D.  
Be sure Gmsh is showing you the real mesh you have generated.  
\*.inp should work fine as common format.

If you need something more structured, you may have to partition it first as FEAnalyst suggested.

 ![screenshot.77](https://global.discourse-cdn.com/free1/uploads/prepomax/original/1X/dc592b383768b2c1bfdd77ef6963ea034fed719d.jpeg)

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [December 6, 2022, 7:41am UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/9 "2022-12-06T07:41:51Z")

</div>

> [@ANYS](#):
>
> You don’t want quads

It seems that the OP wants quad surface mesh and hex elements inside.

---

<div class="post-metadata">

**Author:** ![arnie](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@arnie](https://prepomax.discourse.group/u/arnie)\
**Post date:** [December 6, 2022, 8:04am UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/10 "2022-12-06T08:04:07Z")

</div>

> [@FEAnalyst](#):
>
> It seems that the OP wants quad surface mesh and hex elements inside.

Yes, I would like a hex dominant mesh. I don’t need a surface mesh per se.  
Since PrePoMax cannot yet produce a hex mesh, I was trying to achieve this in Gmsh and then import into PrePoMax.

---

<div class="post-metadata">

**Author:** ![ANYS](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/anys/32/7737_2.png) [@ANYS](https://prepomax.discourse.group/u/ANYS)\
**Post date:** [December 6, 2022, 11:06am UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/11 "2022-12-06T11:06:39Z")

</div>

Gmsh can build Hex dominated meshes automatically but unstructured (If possible, I don’t know how to do it).  
What I have seen is that it can build beautiful Quad meshes on the surface, then meshes the volume with Tet elements and later you can request to subdivide to convert to hexahedral. That’s what is done in my image. It is a full hex mesh, but the original quad structure on the surface is partially lost.(You can keep its flavor up to a certain level where it can be recognized with some algorithms like in the image)

 ![screenshot.81](https://global.discourse-cdn.com/free1/uploads/prepomax/original/1X/7df4b012b50885f6e149dc5b8497713c8b7d11c0.jpeg)

You can give a try to the mesh to see if it can fit your expectations and it is worth to lose some esthetics to have a fully hex mesh.

[holding\_bracket.inp](https://prepomax.discourse.group/uploads/short-url/dJRaSwicLpdfowNQaREUc8cXULT.inp) (4.3 MB)

---

<div class="post-metadata">

**Author:** ![arnie](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@arnie](https://prepomax.discourse.group/u/arnie)\
**Post date:** [December 6, 2022, 12:05pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/12 "2022-12-06T12:05:59Z")

</div>

@ANYS Could you kindly post your Gmsh mesh settings that produced this mesh ?

---

<div class="post-metadata">

**Author:** ![ANYS](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/anys/32/7737_2.png) [@ANYS](https://prepomax.discourse.group/u/ANYS)\
**Post date:** [December 6, 2022, 5:42pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/13 "2022-12-06T17:42:43Z")

</div>

> [@ANYS](#):
>
> Your Subdivision algorithm is not appropriate (You don’t want quads).

Manual gmsh.pdf pag 279.

Mesh.SubdivisionAlgorithm

---

<div class="post-metadata">

**Author:** ![synt](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/synt/32/4658_2.png) [@synt](https://prepomax.discourse.group/u/synt)\
**Post date:** [March 1, 2023, 7:41pm UTC](https://prepomax.discourse.group/t/importing-mesh-created-in-gmsh/583/14 "2023-03-01T19:41:03Z")

</div>

> [@arnie](#):
>
> Yes, I would like a hex dominant mesh. I don’t need a surface mesh per se.

hi, the models seems too large it make GMSH like freeze, i reduced at mesh size.

 ![2023-03-02 02_27_15-Gmsh - C__Users_user_Documents_hexdom.geo](https://global.discourse-cdn.com/free1/uploads/prepomax/original/1X/29125d2b41835a87450fcdbdf5fff5a94f87722b.png)

\*edited  
sorry, previously i miss to reset in mesh option menus, below result after correcting.

 ![2023-03-02 14_33_20-Gmsh - C__Users_user_Documents_hexdom.geo](https://global.discourse-cdn.com/free1/uploads/prepomax/original/1X/3194794ba2b1e4e553cd33288df0a6848da97e4d.png)
