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 Cellcell( order_max )
: Neighboring Cells Index (referenced to upper Nodes list)edge( order_max )
: Edges Indexesglob
: Global Cell Index when MPI Partitionned Meshorder
: Number of Neighboring Cells/Edgeslim
: Boundary Cell Indexsurf
: Cell surfaceinvsurf
: Inverse of Cell surfaceperi
: Cell perimetergrav
: Cell gravity centersubdomain
: True boolean if Ghost Cell is in SubDomain Boundaryboundary
: True boolean if Ghost Cell is in Physical Boundary
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 Indexcell
: Interior Cell Indexgroup
: Group Number in case of Multi Boundary Conditionsperio
: True boolean if Cell is at Periodic Boundary !todo: to deletetyplim
: Type of the Boundary Condition
EXAMPLE : which cell ? 4 & 3 or 8 & 9 ? ghost cells ?
Nodes¶
-
node(:)
: The mesh's nodes are contained in anode(:)
table. Each node is defined by : -
cell(:)
: Connected Cells Indexes edge(:)
: Connected Edges Indexeslim
: Boundary Node Indexglob
: Global Node Index when MPI Partitionned Meshboundary
: True boolean if Node is at Mesh Boundarysubdomain
: True boolean if Node is at SubDomain Boundaryperio
: True boolean if Node belong to a Periodic Boundarycoord
: Node coordinates
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 Indexesind(:)
: Nodes Indexesperio
: True boolean if Node belong to a Periodic Boundary
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 Indexesnode(2)
: Connected Nodes Indexeslim
: Boundary Edge Indexboundary
: True boolean if Edge is at Physical Mesh Boundarysubdomain
: True boolean if Edge is at SubDomain Boundaryperio
: True boolean if Edge is at Periodic Boundarylength
: Edge lengthcenter
: Edge centernormal
: Edge normal oriented from the connected cell1
to the connected cell2
(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
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
[...]
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 Indexesnode(2)
: Connected Nodes Indexesind
: Global Edge Indexperio
: True boolean if Boundary Edge is at Periodic Boundarygroup
: Group Number in case of Multi Boundary Conditionslength
: Edge lengthnormal
: 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%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 surfacename
: Name of the mesh file if existingnc
: Number of Local (MPI use) Primal Cellsncd
: Number of Local (MPI use) Primal Cells in SubDomain Boundaryncb
: Number of Local (MPI use) Primal Cells in Physical Boundaryncp
: Number of Local (MPI use) Primal Cells in Periodic Boundaryncdb
: Number of Local (MPI use) Primal Cells in SubDomain+Physical Boundaryncdbp
: Number of Local (MPI use) Primal Cells in SubDomain+Physical+Perodic Boundaryncg
: Number of Global (MPI use) Primal Cellsnn
: Number of Local (MPI use) Primal Nodesnnb
: Number of Local (MPI use) Primal Nodes at Physical Boundarynne
: Number of Local (MPI use) Primal Nodes in SubDomain Boundarynneb
: Number of Local (MPI use) Primal Nodes in SubDomain Boundary at Physical Boundarynng
: Number of Global (MPI use) Primal Nodesne
: Number of Local (MPI use) Primal Edgesneb
: Number of Local (MPI use) Primal Edges at Physical Boundarynee
: Number of Extra (MPI use) Primal Edges in SubDomain Boundaryneeb
: Number of Extra (MPI use) Primal Edges in SubDomain Boundary at Physical Boundaryneg
: 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 dimensionnbc
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)
) :