Difference between revisions of "Create 2D Mesh Connectivity"
(Initial framework) |
(Add info on Hex connectivity creation.) |
||
Line 1: | Line 1: | ||
− | This will overview the process of how to create 2D mesh connectivity for some of our more custom meshes. | + | 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 [[Bar2vtk|bar2vtk]] tools in [[VTKpytools]]. |
== Hex Mesh Using makeHexConnectivity.py == | == Hex Mesh Using makeHexConnectivity.py == | ||
+ | |||
+ | If you're dealing with a tensor-product (ie. fully structured) hexahedral grid, you can use the <code>makeHexConnectivity.py</code> script to create a connectivity array from it. <code>makeHexConnectivity.py</code> can be found in the examples directory of the [[VTKpytools]] [https://github.com/PHASTA/vtkpytools/tree/master/example/bar2vtk git repository]. Simply copy the script to whatever directory you like and change the <code>nx</code> and <code>ny</code> variables to match the number of x and y nodes for your grid, add the name of your desired output file, and run via <code>python makeHexConnectivity.py</code>. | ||
+ | |||
+ | 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 <code>ny=2</code> and <code>nx=3</code>, the following is output: | ||
+ | |||
+ | 1 0 1 3 2 | ||
+ | 2 2 3 5 4 | ||
+ | |||
== Tet Mesh Using Custom MGEN Code == | == Tet Mesh Using Custom MGEN Code == |
Revision as of 09:56, 26 August 2020
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 bar2vtk 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