sdr_boundary_module Module

This module contains routines for boundary identification and qVal computation

Todo

HK: This module is utterly confusing, I do not really understand what all this code is actually doing, and it is hard to parse it. The module needs to be redesigned and cleaned up!


Uses

Used by

  • module~~sdr_boundary_module~~UsedByGraph module~sdr_boundary_module sdr_boundary_module module~sdr_flooding_module sdr_flooding_module module~sdr_flooding_module->module~sdr_boundary_module module~sdr_proto2treelm_module sdr_proto2treelm_module module~sdr_proto2treelm_module->module~sdr_boundary_module program~seeder seeder program~seeder->module~sdr_flooding_module program~seeder->module~sdr_proto2treelm_module

Variables

Type Visibility Attributes Name Initial
real(kind=rk), public, parameter :: sdr_qVal_no_intersection = -1._rk

default qVal when no intersection


Functions

public function needCalcQValByBCID(attribute, bcid) result(calc_qVal)

This routine checks if a boundary need calc qVal for a given BCID It is used in identify_boundary routine

Arguments

Type IntentOptional Attributes Name
type(sdr_attrList_type), intent(in) :: attribute
integer, intent(in) :: bcid

Return Value logical

public function needFldDglByBCID(attribute, bcid) result(flood_diagonal)

This routine checks if a boundary need flood periphery for diagonal directions for a given BCID. It is used in identify_boundary routine

Arguments

Type IntentOptional Attributes Name
type(sdr_attrList_type), intent(in) :: attribute
integer, intent(in) :: bcid

Return Value logical

private function getTreeIDPosOfCoord(coordReal, mesh, minLevel, maxLevel, leafLevel, leafTreeID, proto) result(pos)

This function returns the position of treeID of given coordReal in the the given mesh Start from minLevel which is the level of neighbor and find the treeID which is a leaf in protoTree

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: coordReal(3)
type(treelmesh_type), intent(in) :: mesh

Mesh contain geometry universe (bounding cube) info

integer, intent(in) :: minLevel

minlevel

integer, intent(in) :: maxLevel

maxlevel

integer, intent(out) :: leafLevel

level in which leaf node is found

integer(kind=long_k), intent(inout) :: leafTreeID
type(sdr_protoTree_type), intent(in) :: proto

preliminary tree

Return Value integer

position of treeID in proto tree

private function projectVecOnPlane(vecU, plane) result(res)

This function project given vector on an given plane

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: vecU(3)

vector to project

type(tem_plane_type), intent(in) :: plane

plane on which vecU will be projected

Return Value real(kind=rk), (3)

output projected value

private function getNormal(geometry, elemBary, node, node_pos, bcid) result(normal)

Obtain the surface normal of the chosen boundary if the boundary has store_normal set. Otherwise a null vector is returned.

Arguments

Type IntentOptional Attributes Name
type(sdr_geometry_type), intent(in) :: geometry
real(kind=rk), intent(in) :: elemBary(3)
type(sdr_node_type), intent(in) :: node
integer, intent(in) :: node_pos
integer, intent(in) :: bcid

Return Value real(kind=rk), (3)


Subroutines

public subroutine sdr_identify_boundary(node_pos, treeID, coord, leVal, proto, geometry, BC_ID, qVal, bc_normal, meshUniverse)

This routine checks for boundary neighbors and level of the boundary node

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: node_pos

Position of leaf in the preliminary tree

integer(kind=long_k), intent(in) :: treeID

treeID of parent node

integer, intent(in) :: coord(4)

Coordinate of treeID

type(levelValues_type), intent(in) :: leVal

level value of parent node

type(sdr_protoTree_type), intent(in) :: proto

preliminary tree

type(sdr_geometry_type), intent(in) :: geometry

contains all geometrical objects

integer(kind=long_k), intent(out) :: BC_ID(qQQQ)

Boundary ID for all 26 neighbor directions

real(kind=rk), intent(out) :: qVal(qQQQ)

distance from boundary for all 26 neighbor directions

real(kind=rk), intent(out) :: bc_normal(3)

Wall normal pointing from the surface to the barycenter of the boundary element

type(treelmesh_type), intent(in) :: meshUniverse

contains bounding cube information

public subroutine sdr_find_periodic_neighbor(elemBary, iDir, bc_ID, qVal, unKnownBnd, neighbor_pos, neighbor_level, leVal, proto, geometry, meshUniverse)

This routine find the treeID on the opposite side neighbor of the periodic plane for current leaf node

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: elemBary(3)

current element barycenter

integer, intent(in) :: iDir

Current boundary neighbor direction

integer(kind=long_k), intent(inout) :: bc_ID

treeiD of opposite neighbor with periodic plane

real(kind=rk), intent(out) :: qVal

distance from boundary for direction iDir

Read more…
logical, intent(inout) :: unKnownBnd

Set to true if a neighbor with no property is encountered

integer, intent(in) :: neighbor_pos

position of neighbor treeID in the proto%node list

integer, intent(in) :: neighbor_level

level of the periodic boundary neighbor node

type(levelValues_type), intent(in) :: leVal

level value of parent node

type(sdr_protoTree_type), intent(in) :: proto

preliminary tree

type(sdr_geometry_type), intent(in) :: geometry

contains all geometrical objects

type(treelmesh_type), intent(in) :: meshUniverse

contains bounding cube information

public subroutine sdr_qValByNode(proto, geometry, dx, iDir, origin, node_pos, qVal)

This routine computes the minimum distance of a given link and all the geometries in a given node:\n the link is given by a vector and a origin point.\n the node is given by the node position in the protoTree.\n If there is no intersection, qVal returns -1.0

Arguments

Type IntentOptional Attributes Name
type(sdr_protoTree_type), intent(in) :: proto

preliminary tree

type(sdr_geometry_type), intent(in) :: geometry

contains all geometrical objects

real(kind=rk), intent(in) :: dx

dx of current level

integer, intent(in) :: iDir

Direction

real(kind=rk), intent(in) :: origin(3)

current element barycenter

integer :: node_pos

position of node to find the geometries

real(kind=rk), intent(out) :: qVal

distance from boundary for all 26 neighbor directions

private subroutine getBCID_and_calcQval(proto, geometry, elemBary, iDir, bndnode_pos, level, leVal, meshUniverse, BC_ID, minBCID, qVal, unKnownBnd)

This routine gets minBCID of the given node position in the protoTree. If the minBcid is periodic then it bcID is set to treeID of fluid node on the opposite side of periodic plane. It also computes the qVal if calc_dist = true. If qVal = -1 then there is no intersection and if qVal > 1 then the geometry is intersected after the link distance.

Read more…

Arguments

Type IntentOptional Attributes Name
type(sdr_protoTree_type), intent(in) :: proto

preliminary tree

type(sdr_geometry_type), intent(in) :: geometry

contains all geometrical objects

real(kind=rk), intent(in) :: elemBary(3)

current element barycenter

integer, intent(in) :: iDir

Current boundary neighbor direction

integer, intent(in) :: bndnode_pos

position of node treeID in the proto%node list

integer, intent(in) :: level

level of the node

type(levelValues_type), intent(in) :: leVal

level value of parent node

type(treelmesh_type), intent(in) :: meshUniverse

contains bounding cube information

integer(kind=long_k), intent(out) :: BC_ID

Boundary ID for direction iDir

integer(kind=long_k), intent(inout) :: minBCID

minimum boundary id of current node before truncation

real(kind=rk), intent(out) :: qVal

distance from boundary for direction iDir

logical, intent(inout) :: unKnownBnd

Is true if a neighbor with no property is encountered

private subroutine sdr_truncate_qVal(proto, qVal, BCID, neighPos, treeID_periodic)

This routine gives special treatment when qVal > 1.0 or qVal == -1.0 for flooded neighbor, treat it as normal fluid: clean BCID, set qVal to -1 (no itersection). for non-flooded neighbor, treat it as high order wall: set qVal to 1

Arguments

Type IntentOptional Attributes Name
type(sdr_protoTree_type), intent(in) :: proto

preliminary tree

real(kind=rk), intent(inout) :: qVal

qValue

integer(kind=long_k), intent(inout) :: BCID

boundary id

integer, intent(in) :: neighPos

neighbor position in proto tree

integer(kind=long_k), intent(in), optional :: treeID_periodic

negative treeID of periodic domain