followNeighPath Function

public function followNeighPath(neighPath, startPos, neigh, nElems_fluid, zeroDir) result(endPos)

followNeighPath can be used to determine the position of a neighboring lattice site in the total list. For this we follow one or more entries of the levelDesc%neigh array. Since this array is only defined for local fluid elements, startPos must point to a local fluid element.

Arguments

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

Array containing the sequence of indices of directions that must be followed to get to the direction described by neighDir. This depends on the stencil being used for the simulation. For example in the d3q19 stencil, to reach the neighbor located with displacement (1,1,1) from the element at startPos, we follow first (1,0,0) and then (0,1,1). For d3q27 neighPath will only be one entry (with value 26) corresponding to the index (1,1,1).

integer, intent(in) :: startPos

Position of the starting element in the total list This element must be a local fluid!

type(tem_levelNeighbor_type), intent(in) :: neigh

Neighbor list

integer, intent(in) :: nElems_fluid

Number of local fluid elements on this process We need this to check if intermediate values of endPos are still local fluids

integer, intent(in) :: zeroDir

Index of the "zero direction" of the stencil i.e. stencil%cxdir(1:3,zeroDir) = [0,0,0]

Return Value integer

consecutively neighPath(1), neighPath(2) etc.