Parallel Grid Generation Example
The code for this example is located in examples/GridGen
Brief
This example creates simple cubic or prismatic mesh
Description
This example may run in both serial and parallel modes with NP
processes.
The virtual IJK-structure with user defined sizes is used to cover the unit cube [0,1]^3
.
In parallel mode this structure is split into NP
rectangular superblocks.
Local IJK-structures are created in each superblock separately.
Depending on user defined choice in each IJK block either one cubical cell, or two triangular prismatic cells are created.
In the latter case the direction of diagonal plane is changed in staggered order.
Two images below show cuts through the generated volume meshes with prismatic and cubic cells.
Arguments
Usage: ./GridGen ng nx ny nz [output.[p]vtk]
- First parameter
ng=3
stands for Prismatic generator andng=4
for Cubic one. - Parameters
nx
,ny
andnz
are the IJK-structure sizes. - Last optional parameter – output file name, default:
grid.vtk
for serial runs andgrid.pvtk
for parallel runs.
Running example
If you compiled INMOST with USE_MPI=ON
you can generate and save mesh in parallel. The following line will create 32x32x32 cubic grid using 4 processes:
$ cd Examples/GridGen
$ mpirun -np 4 ./GridGen 4 32 32 32 /tmp/grid-32-32-32.pvtk
Cubic Grid: 32 x 32 x 32
Processors: 4
Mesh generator time: 0.14828
Save to file "/tmp/grid-32-32-32.pvtk" time: 0.060786
If you have ParaView installed, you can open pvtk file:
$ paraview --data=/tmp/grid-32-32-32.pvtk
You can view the following tags:
-
P_OWNER_PROCESSOR
– partitioning to processors -
GLOBAL_ID
– global cell ID number