This module provides information about the existence and properties of faces in an Octree based mesh. It is able to deliver info about the horizontal (i.e. on the same refinement level) and vertical (i.e. between the different levels) dependencies.
If you want to make use of face descriptions in your code, you just have to
call tem_build_face_info to buid up the face
descriptions in your solver. You have to make use of the created iterators
and face descriptions.
The faces
structure created by tem_build_face_info
is an array of tem_face_type with the face information for each level.
On each level there are three tem_face_descriptor_type for the three
spatial dimensions faces(iLevel)%faces(1:3)
. Each of these descriptors
holds the complete list of faces on that level for this direction in
the faceList
.
In general, the construction of the face description follows the following procedure:
Each face has two neighboring elements. To identify each face uniquely, we use the tree ID of its left element.
---------------------------------------
/ / /
/ / /
/ left elem. / right elem. /
/ / /
/ / /
--------------------------------------
This module provides a basic description of the faces per spatial direction. Building this description is achieved in several steps:
To define a correct list of faces for the solvers, we attach left and right properties to each face (in part 1 of the upper algorithm). We differentiate between a left and right property of each face. The left one is determined by it's left element and the right one by it's right element respectively.
tem_left / / / tem_right
-----------------------------------------------------
/ / / / /
/ / / / /
/ left elem. ---> / / / <--- right elem. /
/ / / / /
/ / / / /
----------------------------------------------------
/ / /
We use one or more of the following properties to the left and right properties of the faces:
a. tem_fluidFace_prp b. tem_fromFinerFace_prp c. tem_fromCoarserFace_prp d. tem_remoteFace_prp
These properties are the basis for building the correct list of faces in step 4 of the above algorithm.
See [[Face Details]] for examples on face configurations.
Subroutine to check if the current rank will receive information
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | facePos |
The position of the face in faces to be checked. |
||
type(tem_face_descriptor_type), | intent(in) | :: | faces |
The description of the faces. |
Returns 0 if no information has to be received from remote ranks before a compute step can be done. In case that information has to be received it will return a non-zero positive value. Furhtermore, it determines whether information for the left face value (left adjacent element) or the right face value (right adjacent element) has to be received. In the first case it will return tem_left and in the second case it will return tem_right. If something went wrong, e.g. an unknown combination occurs, it will return -1.
Subroutine to check if the current rank will send information
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | facePos |
The position of the face in faces to be checked. |
||
type(tem_face_descriptor_type), | intent(in) | :: | faces |
The description of the faces. |
Returns 0 if no information has to be received from remote ranks before a compute step can be done. In case that information has to be received it will return a non-zero positive value. Furhtermore, it determines whether information for the left face value (left adjacent element) or the right face value (right adjacent element) has to be received. In the first case it will return tem_left and in the second case it will return tem_right. If something went wrong, e.g. an unknown combination occurs, it will return -1.
Function to decide if a certain face is constructed from finer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | facePos | |||
type(tem_face_descriptor_type), | intent(in) | :: | faces |
Function to check if a face with given left and right property requires a downward (coarse->fine) dependency.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | leftPrp |
Left property of the face. |
||
integer, | intent(in) | :: | rightPrp |
Right property of the face. |
Does the face requires a vertical dependency.
Function to check if a face with given left and right property requires a upward (fine->coarse) dependency.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | leftPrp |
Left property of the face. |
||
integer, | intent(in) | :: | rightPrp |
Right property of the face. |
Does the face requires a vertical dependency.
Function to melt two properties together. The resulting property holds the union of firstPrp and secondPrp.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | firstPrp |
The first property to be melted. |
||
integer, | intent(in) | :: | secondPrp |
The second property to be melted. |
The resulting property (the union of the first and second property)
Returns the property of a given element in the level descriptor
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc |
The level descriptor that contains the investigated element. |
||
integer, | intent(in) | :: | elemPos |
The position of the element in the total list of the level descriptor. |
The element property of the element.
Routine to get face information for your whole mesh.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(treelmesh_type), | intent(inout) | :: | tree |
Tree representation of the mesh to buid the faces for. |
||
type(tem_BC_prop_type), | intent(in) | :: | boundary |
The boundaries of your simulation domain. |
||
type(tem_commPattern_type), | intent(in) | :: | commPattern |
The communication pattern you use for the buffer. |
||
type(tem_comm_env_type), | intent(in) | :: | proc |
Process description to use. |
||
type(tem_face_type), | intent(out), | allocatable | :: | faces(:) |
The created face descriptors (one for each level). |
|
integer, | intent(in) | :: | nEligibleChildren |
The number of eligible children for the vertical face dependency |
Subroutine to build communication buffers for the faces.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | minLevel |
The minimum refinement level of your mesh. |
||
integer, | intent(in) | :: | maxLevel |
The maximum refinement level of your mesh. |
||
type(tem_face_type), | intent(inout) | :: | faces(minLevel:maxLevel) |
The communication pattern you want use for the buffer. The created face descriptor. |
||
type(tem_levelDesc_type), | intent(in) | :: | levelDesc(1:3,minLevel:maxLevel) |
Dimension-by-dimension level descriptors |
Subroutine to build communication buffers for the faces the
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc |
Dimension-by-dimension level descriptor for the current level and direction. |
||
type(tem_face_descriptor_type), | intent(inout) | :: | faces |
The communication pattern you want use for the buffer. The created face descriptor. |
||
type(tem_communication_type), | intent(out) | :: | buf(2) |
The created receive buffer. Size is two, due to left and right limes of the face values. To access it use tem_left and tem_right. |
Subroutine to build communication buffers for the faces the
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc |
Dimension-by-dimension level descriptor for the current level and direction. |
||
type(tem_face_descriptor_type), | intent(inout) | :: | faces |
The communication pattern you want use for the buffer. The created face descriptor. |
||
type(tem_communication_type), | intent(out) | :: | buf(2) |
The created send buffer. Size is two, due to left and right limes of the face values. To access it use tem_left and tem_right. |
Creates dimension by dimension level descriptors.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(treelmesh_type), | intent(inout) | :: | tree |
Tree representation of the mesh. |
||
type(tem_BC_prop_type), | intent(in) | :: | boundary |
The boundaries of your simulation domain |
||
type(tem_commPattern_type), | intent(in) | :: | commPattern |
The communication pattern you use for the buffer. |
||
type(tem_comm_env_type), | intent(in) | :: | proc |
Process description to use. |
||
type(tem_levelDesc_type), | intent(out), | allocatable | :: | levelDescX(:) |
Level descriptor for each spatial direction and each level of your mesh. The level descriptor have to be constructed with the dimension by dimension stencils (+1, 0, -1) for each spatial direction. |
|
type(tem_levelDesc_type), | intent(out), | allocatable | :: | levelDescY(:) |
Level descriptor for each spatial direction and each level of your mesh. The level descriptor have to be constructed with the dimension by dimension stencils (+1, 0, -1) for each spatial direction. |
|
type(tem_levelDesc_type), | intent(out), | allocatable | :: | levelDescZ(:) |
Level descriptor for each spatial direction and each level of your mesh. The level descriptor have to be constructed with the dimension by dimension stencils (+1, 0, -1) for each spatial direction. |
Create a face level descriptor
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(treelmesh_type), | intent(inout) | :: | tree |
Tree representation of the mesh. |
||
type(tem_stencilHeader_type), | intent(inout) | :: | stencil(1) |
The stencil to create the level descriptor for. |
||
type(tem_BC_prop_type), | intent(in) | :: | boundary |
The boundaries of your simulation domain |
||
type(tem_commPattern_type), | intent(in) | :: | commPattern |
The communication pattern you use for the buffer. |
||
type(tem_levelDesc_type), | intent(out), | allocatable | :: | levelDesc(:) |
The created level descriptor. |
|
type(tem_comm_env_type), | intent(in) | :: | proc |
Process description to use. |
Creates the dimension-by-dimension stencils for a given spatial
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_stencilHeader_type), | intent(inout) | :: | stencil |
The stencil layout to set. |
||
integer, | intent(in) | :: | nElems |
The number of elements which share this stencil |
||
integer, | intent(in) | :: | direction |
The spatial direction: 1 -> x direction 2 -> y direction 3 -> z direction |
Routine to generate the separated lists of faces for
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | minLevel |
Minimum level of your mesh. |
||
integer, | intent(in) | :: | maxLevel |
Maximum level of your mesh. |
||
integer, | intent(in) | :: | nEligibleChildren |
The number of eligible children for the vertical face dependency |
||
type(tem_face_type), | intent(inout) | :: | faces(minLevel:maxLevel) |
The created face descriptor. |
Extracts all the faces which will be computed by current rank.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | minLevel |
The min refinement level of the mesh. |
||
integer, | intent(in) | :: | maxLevel |
The max refinement level of the mesh. |
||
integer, | intent(in) | :: | nEligibleChildren |
The number of eligible children for the vertical face dependency |
||
type(tem_face_type), | intent(inout) | :: | faces(minLevel:maxLevel) |
The created face descriptor. |
Extracts all the faces which will be computed by current rank.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_face_type), | intent(inout) | :: | faces |
The created face descriptor. |
||
integer, | intent(in) | :: | nEligibleChildren |
The number of eligible children for the vertical face dependency |
Builds all the vertical dependencies in the face description.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | minLevel |
Minimum level of your mesh. |
||
integer, | intent(in) | :: | maxLevel |
Maximum level of your mesh. |
||
type(tem_face_type), | intent(inout) | :: | faces(minLevel:maxLevel) |
Face descriptor where the faces will be appended to. |
||
integer, | intent(in) | :: | nEligibleChildren |
The number of eligible children for the vertical face dependency |
Subroutine to initialize the container for the vertical
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_face_descriptor_type), | intent(inout) | :: | faces |
The face description in which you want to initialize the vertical face dependency container. |
||
integer, | intent(in) | :: | nEligibleChildren |
The number of eligible children for the vertical face dependency |
Builds downward face depndencies (coarse face -> finer faces).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_face_descriptor_type), | intent(inout) | :: | coarseFaces |
Face description on the coarse level. The dependencies to the finer level will be appended to this face descriptor. |
||
type(tem_face_descriptor_type), | intent(in) | :: | fineFaces |
Face description on the finer level. |
||
integer, | intent(in) | :: | dir |
The spatial direction of the face to add the downward dependencies for. 1 --> x direction 2 --> y direction 3 --> z direction |
||
integer, | intent(in) | :: | nEligibleChildren |
The number of eligible children for the vertical face dependency |
Builds upward face depndencies (fine face -> coarse faces).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_face_descriptor_type), | intent(inout) | :: | fineFaces |
Face description on the fine level. The dependencies to the coarser level will be appended to this face descriptor. |
||
type(tem_face_descriptor_type), | intent(in) | :: | coarseFaces |
Face description on the coarse level. |
Subroutine returns left and right propery of a face.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_face_descriptor_type), | intent(in) | :: | faces |
The face descriptor the face is located in. |
||
integer, | intent(in) | :: | facePos |
The position of the face in the face descriptor. |
||
integer, | intent(out) | :: | leftPrp |
The left property of the face. |
||
integer, | intent(out) | :: | rightPrp |
The right property of the face. |
Adds an downward face dependency (coarse->fine) to the coarse face
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | coarseFacePos |
The position of the coarse face in coarseFaces you want to add the child dependencies for. |
||
type(tem_face_descriptor_type), | intent(inout) | :: | coarseFaces |
The description of the faces on the coarse level. The dependency will be added to this face descriptor. |
||
type(tem_face_descriptor_type), | intent(in) | :: | fineFaces |
The descriptor of the faces on the fine level. |
||
integer, | intent(in) | :: | dir |
The spatial direction of the face to add the downward dependencies for. 1 --> x direction 2 --> y direction 3 --> z direction |
||
integer, | intent(in) | :: | nEligibleChildren |
The number of eligible children for the vertical face dependency |
Adds an upward face dependency (fine->coarse) to the fine face
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | fineFacePos |
The position of the face in the fineFaces descriptor you want to add. |
||
type(tem_face_descriptor_type), | intent(inout) | :: | fineFaces |
The description of the faces on the fine level. The dependency will be added to this face descriptor. |
||
type(tem_face_descriptor_type), | intent(in) | :: | coarseFaces |
The descriptor of the faces on the coarse level. |
Collects all the faces which have at least one neighboring
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc(1:3,minLevel:maxLevel) |
Level descriptor for each spatial direction and each level of your mesh. |
||
integer, | intent(in) | :: | minLevel |
Minimum level of your mesh. |
||
integer, | intent(in) | :: | maxLevel |
Maximum level of your mesh. |
||
type(tem_face_type), | intent(inout) | :: | faces(minLevel:maxLevel) |
Face descriptor where the faces will be appended to. |
Subroutine to initialize the dyanmic content of a face list.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_faceList_type), | intent(inout) | :: | faceList |
The face list to initialize. |
Collects all the faces on a given level of the mesh in a given
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc |
Level descriptor of the level of the mesh you want to collect the faces for. |
||
integer, | intent(in) | :: | direction |
The spatial direction to collect the faces for: 1 -> x direction 2 -> y direction 3 -> z direction |
||
type(tem_face_descriptor_type), | intent(inout) | :: | faces |
Description of the faces on the current level. |
Function to get the face neighbor of a certain element in the level descriptor. Even non-existing face neighbors can be handled by this routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc |
The level descriptor the element is located in. |
||
integer, | intent(in) | :: | elemPos |
The element position in the level descriptor. |
||
integer, | intent(in) | :: | dir |
The spatial direction of the face. |
||
integer, | intent(in) | :: | leftOrRight |
Find left or right face neighbor of the element. Use \ref tem_face_module::tem_left or \ref tem_face_module::tem_right. |
||
integer(kind=long_k), | intent(out) | :: | neighId |
The treeid of the face neighbor element. |
||
integer, | intent(out) | :: | neighPos |
Position of the neighbor in the total list, or 0 if element does not exist. |
Adds a new face to the face description.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long_k), | intent(in) | :: | leftElemId |
Element id of the left element |
||
integer, | intent(in) | :: | leftElemPos |
Position of the left element in the level descriptor's total list. |
||
integer, | intent(in) | :: | leftElemPrp |
Properties of the left element. |
||
integer(kind=long_k), | intent(in) | :: | rightElemId |
Element id of the right element |
||
integer, | intent(in) | :: | rightElemPos |
Position of the right element in the level desriptor's total list. |
||
integer, | intent(in) | :: | rightElemPrp |
Properties of the right element |
||
type(tem_face_descriptor_type), | intent(inout) | :: | faces |
The face description the new face will be added to. If the face already exists in this face description. The existing face's property will be overwritten by the new ones. |
Extends the properties of the faces which are marked as
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc(1:3,minLevel:maxLevel) |
Level descriptor for each level of your mesh. |
||
integer, | intent(in) | :: | minLevel |
Minimum level of your mesh. |
||
integer, | intent(in) | :: | maxLevel |
Maximum level of your mesh. |
||
type(tem_face_type), | intent(inout) | :: | faces(minLevel:maxLevel) |
The face descriptor to be corrected. |
Extend communication property for faces by the finer property if
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc |
Level descriptor of the level of the mesh you want to collect the faces for. |
||
integer, | intent(in) | :: | direction |
The face direction. |
||
type(tem_face_descriptor_type), | intent(inout) | :: | faces |
Description of the faces on the current level. |
Extend communication property for faces by the coarser property if
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc |
Level descriptor of the level of the mesh you want to collect the faces for. |
||
integer, | intent(in) | :: | direction |
The face direction. |
||
type(tem_face_descriptor_type), | intent(inout) | :: | faces |
Description of the faces on the current level. |
Attaches another property to a given face (from left or right). If the face does not exist this routine will not do anything.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long_k), | intent(in) | :: | faceId |
The face identifier to append the face property to. |
||
integer, | intent(in) | :: | prp |
The property to attach |
||
type(tem_face_descriptor_type), | intent(inout) | :: | faces |
The face desriptor to update. |
||
integer, | intent(in) | :: | prp_dir |
Attach the property to the left or right property of the face. |