[Gmsh] Writing Script to refine

Aman Saxena amansaxena.iitg at gmail.com
Thu May 30 05:29:54 CEST 2019


I am trying to write a python script to refine the fourth order mesh to a
linear mesh preserving all the nodes. I have used API functions only to
read the mesh file and haven't used any of it to write the linear mesh.

I started with a cube with only one volume element (4th order) and figured
out that among the given 125 nodes, nodes on which location forms a linear
hexahedra. The same thing can be repeated for any number of hexahedrons.
Thus a mesh made up only of 4th order hexahedrons can be converted to a
linear mesh (similar things can also be done for the boundary faces).

When I try this for simple cube geometry with several number of cube
elements it works fine(cube.msh is the input quartic mesh while refine.msh
is the refined linear mesh) but with the 3dbody.msh geometry there seems to
be an issue in the connectivity as one can see the incompatible nodes being
connected to form a cell(3dRefined.msh is the resultant mesh).

I suppose that if this works for one quartic mesh with only hexahedrons it
should work for the other, since the way a quartic hexahedron element is
numbered should remain the same.

What could be the problem in the script? Is there any functionality in gmsh
API(so that I don't have to write the connectivity myself) to make this
work?

I have also attached the script for your reference.

Thanks
 cube.msh
<https://drive.google.com/file/d/151Xg5dE8LYMOlgLuv0w_zwuxv2a3o-Fs/view?usp=drive_web>
 refine.msh
<https://drive.google.com/file/d/17pKCg5pFCyrlcX37jFME4eNVf7yRGR1_/view?usp=drive_web>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190530/4117fb90/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3dbody.msh
Type: application/octet-stream
Size: 3851320 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190530/4117fb90/attachment-0002.msh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3dRefined.msh
Type: application/octet-stream
Size: 6273807 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190530/4117fb90/attachment-0003.msh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testapi.py
Type: text/x-python
Size: 6094 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190530/4117fb90/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3dbody.pdf
Type: application/pdf
Size: 81309 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190530/4117fb90/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3dRefined.pdf
Type: application/pdf
Size: 3634688 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20190530/4117fb90/attachment-0003.pdf>


More information about the gmsh mailing list