1390 GridGen Example

Kirill Terekhov edited this page Aug 30, 2018 · 7 revisions

Parallel Grid Generation Example

The code for this example is located in examples/GridGen


This example creates simple cubic or prismatic mesh


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.

pic1 pic2


Usage: ./GridGen ng nx ny nz [output.[p]vtk]
  • First parameter ng=3 stands for Prismatic generator and ng=4 for Cubic one.
  • Parameters nx, ny and nz are the IJK-structure sizes.
  • Last optional parameter – output file name, default: grid.vtk for serial runs and grid.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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.