Personal tools
You are here: Home Documentation Advanced Chapters Partitioning / renumbering

Partitioning / renumbering


If you want to work with more than one MPI process, you need to partition the mesh and use a partitioning and renumbering method, as the nodes and elements of the mesh will be divided on the processes. Indeed, when you build a mesh with the constructor grid, you need to specify as arguments, the handle on the node renumbering and the handle on the elements renumbering. If those arguments are not provided, the default values will be set to 0 (no renumbering).

While partitioning the mesh, the nodes will be renumbered globally and locally. The elements will need to be renumbered separately.

For this present example, we will use the PT-Scotch algorithm. Partitioning and renumbering the mesh is a six-step process:

  1. Create the object representing the partitioning algorithm with the constructor scotch; the constructor scotch constructs an object and returns the handle on this object.
  2. Partition the mesh with the method part, on the handle on the partitioning. As arguments, we specify the handle on the elements of the mesh and the number of processes.
  3. Generate the renumbering on the nodes, globally and locally, using the method gen_num on the handle on the partitioning.
  4. Create the object representing the frontal algorithm and the elements renumbering, with the constructor nm_front; the constructor nm_front constructs an object and returns the handle on this object.
  5. Renumber the elements of the finite-element mesh, with the method renum; we use the method renum on the handle on the frontal algorithm, specifying as arguments, the handle on the elements and the handle on the node renumbering.
  6. Generate a global renumbering object, with the method gen_num, on the handle on the frontal algorithm.
h_part  = scotch() 
nb_proc = 4 
h_part.part(h_ele, nb_proc) 
h_numc  = h_part.gen_num() 

h_renumel = nm_front() 
h_renumel.renum(h_ele, h_numc) 
h_nume = h_renumel.gen_num()

Nodes and elements can also be renumbered without partitioning the mesh.

h_renumno = scotch() 
h_renumno.renum(h_ele) 
h_numc = h_renumno.gen_num() 

h_renumel = nm_front() 
h_renumel.renum(h_ele, h_numc) 
h_nume = h_renumel.gen_num()

 and we can also have just a node renumbering.

h_renumno = scotch() 
h_renumno.renum(h_ele) 
h_numc = h_renumno.gen_num()

These different cases can be combined in a single command file by using the control flow structure if-elif-else-endif of the command language. In the following example, the variable representing the number of processors (nb_proc) is provided by the MPI configuration.

sys_mpi = sys.mpi
nb_proc = sys_mpi.size

if (nb_proc <= 1)
    h_numc = 0
    h_nume = 0
else
    h_part = scotch()
    h_part.part (h_ele, nb_proc)
    h_numc = h_part.gen_num ()
    h_renumel = nm_front ()
    h_renumel.renum(h_ele, h_numc)
    h_nume = h_renumel.gen_num () 
endif




Chapitre: advanced chapters ( 3 / 23 )


Document Actions