Create 2D Mesh Connectivity
This will overview the process of how to create 2D mesh connectivity for some of our more custom meshes. This is particularly useful for utilizing the barfiletools tools in VTKpytools.
Hex Mesh Using makeHexConnectivity.py
If you're dealing with a tensor-product (ie. fully structured) hexahedral grid, you can use the makeHexConnectivity.py
script to create a connectivity array from it. makeHexConnectivity.py
can be found in the examples directory of the VTKpytools git repository. Simply copy the script to whatever directory you like and change the nx
and ny
variables to match the number of x and y nodes for your grid, add the name of your desired output file, and run via python makeHexConnectivity.py
.
The resulting file will have each cell in it's own line. The first number is the cell number, while the proceeding 4 are the index of the each point that makes up the cell. Note that the node index starts at 0.
As an example, for ny=2
and nx=3
, the following is output:
1 0 1 3 2 2 2 3 5 4
Tet Mesh Using Custom MGEN Code
If your base 3D mesh uses MGEN to create its full connectivity file, the a custom version of MGEN to write the equivalent mesh in 2D should be used. Currently, it can be found at /projects/tools/MGEN/tm3BumpJC_write2Dcnn
.
- Go to directory with the
geom.{lay,crd}
files (they must be that name) - Run
/projects/tools/MGEN/tm3BumpJC_write2Dcnn
- Enter in the number of layers in the mesh
- For most of the meshes that can use this method, this is simply the number of "points" in the wall-normal direction.
- The resulting
geom.cnn
file is the 2D connectivity file