Skip to content

Mesh

The mesh structure sources can be found in Tolosa-lib/src/m_mesh.f90 and Tolosa-lib/src/submodule/m_mesh_tools.f90.

Elements of a mesh

The mesh is defined by a mesh structure msh, and contains geometrical primal objects.

Cells

The mesh's cells are contained in an cell(:) table. Each cell is defined by :

  • node( order_max ) : Suited list of Nodes connecting the Cell
  • cell( order_max ) : Neighboring Cells Index (referenced to upper Nodes list)
  • edge( order_max ) : Edges Indexes
  • glob : Global Cell Index when MPI Partitionned Mesh
  • order : Number of Neighboring Cells/Edges
  • lim : Boundary Cell Index
  • surf : Cell surface
  • invsurf : Inverse of Cell surface
  • peri : Cell perimeter
  • grav : Cell gravity center
  • subdomain : True boolean if Ghost Cell is in SubDomain Boundary
  • boundary : True boolean if Ghost Cell is in Physical Boundary

Mesh connectivities

type(msh) :: mesh

mesh%cell(2)%node(1) = 2
mesh%cell(2)%node(2) = 1
mesh%cell(2)%node(3) = 4

mesh%cell(2)%cell(1) = 1
mesh%cell(2)%cell(2) = 3
mesh%cell(2)%cell(3) = 4

mesh%cell(2)%edge(1) = 2
mesh%cell(2)%edge(2) = 4
mesh%cell(2)%edge(3) = 5

mesh%cell(2)%boundary = .false.
mesh%cell(4)%boundary = .true.

[...]

Boundaries

The cells located at physical boundaries are stored in a cellb(:) table. Each boundary cell is defined by :

  • ind : Global Cell Index
  • cell : Interior Cell Index
  • group : Group Number in case of Multi Boundary Conditions
  • perio : True boolean if Cell is at Periodic Boundary !todo: to delete
  • typlim : Type of the Boundary Condition

Mesh connectivities Mesh connectivities

EXAMPLE : which cell ? 4 & 3 or 8 & 9 ? ghost cells ?

Nodes

  • node(:) : The mesh's nodes are contained in a node(:) table. Each node is defined by :

  • cell(:) : Connected Cells Indexes

  • edge(:) : Connected Edges Indexes
  • lim : Boundary Node Index
  • glob : Global Node Index when MPI Partitionned Mesh
  • boundary : True boolean if Node is at Mesh Boundary
  • subdomain : True boolean if Node is at SubDomain Boundary
  • perio : True boolean if Node belong to a Periodic Boundary
  • coord : Node coordinates

Mesh connectivities

type(msh) :: mesh

mesh%node(1)%cell(1) = 3
mesh%node(1)%cell(2) = 1

mesh%node(1)%edge(1) = 1
mesh%node(1)%edge(2) = 2
mesh%node(1)%edge(3) = 4
mesh%node(1)%edge(4) = 6

mesh%node(1)%coord%x = 1.2
mesh%node(1)%coord%y = 0.85

mesh%node(1)%boundary = .false.
mesh%node(4)%boundary = .true.

[...]

Boundaries

The nodes located at physical boundaries are stored in a nodeb(:) table. Each boundary node is defined by :

  • cell(:) : Connected Cells Indexes
  • ind(:) : Nodes Indexes
  • perio : True boolean if Node belong to a Periodic Boundary

Mesh connectivities Mesh connectivities

mesh%nodeb(1)%cell(1)=3
mesh%nodeb(1)%cell(2)=9

[...]

Edges

The mesh's edges ar contained in a edge(:) table. Each edge is defined by :

  • cell(2) : Connected Cells Indexes
  • node(2) : Connected Nodes Indexes
  • lim : Boundary Edge Index
  • boundary : True boolean if Edge is at Physical Mesh Boundary
  • subdomain : True boolean if Edge is at SubDomain Boundary
  • perio : True boolean if Edge is at Periodic Boundary
  • length : Edge length
  • center : Edge center
  • normal : Edge normal oriented from the connected cell 1 to the connected cell 2 (or from the cell inside to the cell outside of the domain)
  • tangent : Edge tangent (oriented from 1 to 2 linked nodes)
  • vcell : Cells(1&2) gravity center vector (oriented from 1 to 2)
  • v_edge_cell(2) : Vector going from the edge center to the cell(1&2) gravity center

Mesh connectivities

type(msh) :: mesh

mesh%edge(5)%cell(1) = 2 ! In this order (from the furthest cell from
mesh%edge(5)%cell(2) = 4 ! the physical boundary to the closest one)

mesh%edge(5)%node(1) = 4 
mesh%edge(5)%node(2) = 2

[...]

Mesh connectivities

Boundaries

The edges located at physical boundaries are stored in an edgeb(:) table. The mesh's boundary edges are defined by :

  • cell(2) : Connected Cells Indexes
  • node(2) : Connected Nodes Indexes
  • ind : Global Edge Index
  • perio : True boolean if Boundary Edge is at Periodic Boundary
  • group : Group Number in case of Multi Boundary Conditions
  • length : Edge length
  • normal : Edge normal (oriented from 1 to 2 linked cells)
  • typlim : Type of the Boundary condition

The global numerotation of a boundary edge is stored in the ind variable to be able to access the boundary type.

Mesh connectivities Mesh connectivities

mesh%edgeb(1)%cell(1) = 3
mesh%edgeb(1)%cell(2) = 9

mesh%edgeb(1)%node(1) = 5
mesh%edgeb(1)%node(1) = 4

mesh%edgeb(1)%ind = 7

[...]

Other variables defining a mesh

This structure also encapsulates the numbers of geometrical elements and other usefull ones :

  • surf : Mesh surface
  • name : Name of the mesh file if existing
  • nc : Number of Local (MPI use) Primal Cells
  • ncd : Number of Local (MPI use) Primal Cells in SubDomain Boundary
  • ncb : Number of Local (MPI use) Primal Cells in Physical Boundary
  • ncp : Number of Local (MPI use) Primal Cells in Periodic Boundary
  • ncdb : Number of Local (MPI use) Primal Cells in SubDomain+Physical Boundary
  • ncdbp : Number of Local (MPI use) Primal Cells in SubDomain+Physical+Perodic Boundary
  • ncg : Number of Global (MPI use) Primal Cells
  • nn : Number of Local (MPI use) Primal Nodes
  • nnb : Number of Local (MPI use) Primal Nodes at Physical Boundary
  • nne : Number of Local (MPI use) Primal Nodes in SubDomain Boundary
  • nneb : Number of Local (MPI use) Primal Nodes in SubDomain Boundary at Physical Boundary
  • nng : Number of Global (MPI use) Primal Nodes
  • ne : Number of Local (MPI use) Primal Edges
  • neb : Number of Local (MPI use) Primal Edges at Physical Boundary
  • nee : Number of Extra (MPI use) Primal Edges in SubDomain Boundary
  • neeb : Number of Extra (MPI use) Primal Edges in SubDomain Boundary at Physical Boundary
  • neg : Number of Global (MPI use) Primal Edges

Info

  • A subdomain boundary is a boundary between two MPI subdomains (the domain is partitionned to use MPI for parallel computation).
  • A physical boundary represents the physical domain boundary defined by a boundary condition.
  • A periodic boundary is a boundary where the boundary condition is periodic.

For example, here is a mesh partitionned between three MPI processes. We consider the physical boundary to be not periodic. As mentionned before, the global mesh has been partitionned in three local meshes each associated to an MPI process. Therefore, the geometrical components and their numbers will differ from process to process.

Note

This example considers a part of a greater mesh. Therefore, the only physical boundary is on the right of the figure. The partitions for each process are also bigger, therefore the other boundaries (left, top, bottom) on the figure are not physical nor subdomain boundaries. The variables values only consider the components in this figure.

A detail of some msh variables per process is given :

type(msh) :: mesh

!=====================================================================!
!  Global for all MPI processes
!=====================================================================!
mesh%ncg = 24
mesh%nng = 17
mesh%neg = 43

!=====================================================================!
!  Local for process 0
!=====================================================================!
mesh%nc    = 6
mesh%ncd   = 4
mesh%ncb   = 0
mesh%ncp   = 0
mesh%ncdb  = 0
mesh%ncdbp = 0
mesh%nn    = 8
mesh%nnb   = 0
mesh%nne   = 6
mesh%nneb  = 0
mesh%ne    = 13
mesh%neb   = 0
mesh%nee   = 5
mesh%neeb  = 0
type(msh) :: mesh

!=====================================================================!
!  Global for all MPI processes
!=====================================================================!
mesh%ncg = 24
mesh%nng = 17
mesh%neg = 43

!=====================================================================!
!  Local for process 1
!=====================================================================!
mesh%nc    = 8
mesh%ncd   = 5
mesh%ncb   = 2
mesh%ncp   = 0
mesh%ncdb  = 1
mesh%ncdbp = 0
mesh%nn    = 9
mesh%nnb   = 2
mesh%nne   = 6
mesh%nneb  = 1
mesh%ne    = 16
mesh%neb   = 1
mesh%nee   = 6
mesh%neeb  = 0
type(msh) :: mesh

!=====================================================================!
!  Global for all MPI processes
!=====================================================================!
mesh%ncg = 24
mesh%nng = 17
mesh%neg = 43

!=====================================================================!
!  Local for process 2
!=====================================================================!
mesh%nc    = 10
mesh%ncd   = 5
mesh%ncb   = 4
mesh%ncp   = 0
mesh%ncdb  = 3
mesh%ncdbp = 0
mesh%nn    = 11
mesh%nnb   = 3
mesh%nne   = 7
mesh%nneb  = 2
mesh%ne    = 19
mesh%neb   = 2
mesh%nee   = 7
mesh%neeb  = 0

Boundary conditions

The mesh structure also contains the boundary conditions informations:

  • nbc is the number of boundary conditions defined for this model (the boundary conditions are at the domain's edges).
  • bc(:) is an array of dimension nbc and contains, per boundary condition :
    • typlim : name of the BC.
    • group : physical group attached to this BC (defined in Gmsh generated .msh file).
    • ne : number of edges involved in this BC.
    • edgeb(:) : list of edges' indexes involved in this BC.

MPI communicators

The structure also contains MPI communicators (see Features : MPI) :

  • comm (type(mpi_pool)) :
  • mpi(4) (type(mpi_grph)) :
  • mpid (type(mpi_grph)) :
Back to top