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.
S u b r o u t i n e
t o
c h e c k
i f
t h e
c u r r e n t
r a n k
w i l l
r e c e i v e
i n f o r m a t i o n
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.
S u b r o u t i n e
t o
c h e c k
i f
t h e
c u r r e n t
r a n k
w i l l
s e n d
i n f o r m a t i o n
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.
F u n c t i o n
t o
d e c i d e
i f
a
c e r t a i n
f a c e
i s
c o n s t r u c t e d
f r o m
f i n e r
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)
R e t u r n s
t h e
p r o p e r t y
o f
a
g i v e n
e l e m e n t
i n
t h e
l e v e l
d e s c r i p t o r
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.
R o u t i n e
t o
g e t
f a c e
i n f o r m a t i o n
f o r
y o u r
w h o l e
m e s h .
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 |
S u b r o u t i n e
t o
b u i l d
c o m m u n i c a t i o n
b u f f e r s
f o r
t h e
f a c e s .
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 |
S u b r o u t i n e
t o
b u i l d
c o m m u n i c a t i o n
b u f f e r s
f o r
t h e
f a c e s
t h e
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. |
S u b r o u t i n e
t o
b u i l d
c o m m u n i c a t i o n
b u f f e r s
f o r
t h e
f a c e s
t h e
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. |
C r e a t e s
t h e
d i m e n s i o n - b y - d i m e n s i o n
s t e n c i l s
f o r
a
g i v e n
s p a t i a l
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 |
R o u t i n e
t o
g e n e r a t e
t h e
s e p a r a t e d
l i s t s
o f
f a c e s
f o r
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 |
B u i l d s
a l l
t h e
v e r t i c a l
d e p e n d e n c i e s
i n
t h e
f a c e
d e s c r i p t i o n .
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 |
S u b r o u t i n e
t o
i n i t i a l i z e
t h e
c o n t a i n e r
f o r
t h e
v e r t i c a l
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 |
B u i l d s
d o w n w a r d
f a c e
d e p n d e n c i e s
( c o a r s e
f a c e
-
f i n e r
f a c e s ) .
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 |
B u i l d s
u p w a r d
f a c e
d e p n d e n c i e s
( f i n e
f a c e
-
c o a r s e
f a c e s ) .
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. |
A d d s
a n
d o w n w a r d
f a c e
d e p e n d e n c y
( c o a r s e -
f i n e )
t o
t h e
c o a r s e
f a c e
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 |
A d d s
a n
u p w a r d
f a c e
d e p e n d e n c y
( f i n e -
c o a r s e )
t o
t h e
f i n e
f a c e
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. |
C o l l e c t s
a l l
t h e
f a c e s
w h i c h
h a v e
a t
l e a s t
o n e
n e i g h b o r i n g
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. |
C o l l e c t s
a l l
t h e
f a c e s
o n
a
g i v e n
l e v e l
o f
t h e
m e s h
i n
a
g i v e n
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. |
E x t e n d s
t h e
p r o p e r t i e s
o f
t h e
f a c e s
w h i c h
a r e
m a r k e d
a s
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. |
E x t e n d
c o m m u n i c a t i o n
p r o p e r t y
f o r
f a c e s
b y
t h e
f i n e r
p r o p e r t y
i f
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. |
E x t e n d
c o m m u n i c a t i o n
p r o p e r t y
f o r
f a c e s
b y
t h e
c o a r s e r
p r o p e r t y
i f
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. |