waLBerla 7.2
Loading...
Searching...
No Matches
walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T > Class Template Reference

Detailed Description

template<typename Derived_T, typename Field_T>
class walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >

A periodicity boundary condition that adds a user-defined spatial shift to the field when applied.

This shift can prevent the locking of large-scale turbulent features in the flow direction, see e.g., Munters et al. (https://doi.org/10.1063/1.4941912).

Periodicity defined in the blockforest must be turned off in the normal-direction. Only uniform grids are supported for the moment. Normal direction and shift direction must not coincide. Moreover, this boundary condition is only applied at the minimum and maximum of the domain in a given direction, but cannot be applied in the interior of the domain for now.

This base class handles the logistics of splitting the field and communication.

Template Parameters
Field_TType of the ghost-layer field that is shifted periodically

#include <ShiftedPeriodicity.h>

Classes

struct  second_t
 

Public Types

using FieldType = Field_T
 
using ValueType = typename FieldType::value_type
 
using ShiftType = int
 

Public Member Functions

 ShiftedPeriodicityBase (const std::weak_ptr< StructuredBlockForest > &blockForest, const BlockDataID &fieldID, const uint_t fieldGhostLayers, const uint_t normalDir, const uint_t shiftDir, const ShiftType shiftValue)
 
Vector3< ShiftTypeshift () const
 
uint_t shiftDirection () const
 
uint_t normalDirection () const
 
void operator() ()
 

Protected Attributes

const BlockDataID fieldID_
 
const uint_t fieldGhostLayers_
 
cell_idx_t fSize_
 

Private Member Functions

void processDoubleAABB (const AABB &originalAABB, const std::shared_ptr< StructuredBlockForest > &sbf, const real_t nGL, const BlockID &blockID, const int normalShift)
 Creates send and receive information (source, target rank, source / target blocks, source and destination CI (here in form of an AABB), and unique communication tag) per block if the shift does not coincide with the block size.
 
void processSingleAABB (const AABB &originalAABB, const std::shared_ptr< StructuredBlockForest > &sbf, const real_t nGL, const BlockID &blockID, const int normalShift)
 Does the same things as processDoubleAABB but assuming that the shift is a multiple of the block size, i.e., every field slice is shifted one or several entire blocks.
 
void setupPeriodicity ()
 Determines which blocks are participating in the boundary condition / communication, and calls the appropriate functions to extract and save the communication information.
 
Vector3< cell_idx_ttoCellVector (const Vector3< real_t > &point)
 
CellInterval globalAABBToLocalCI (const AABB &aabb, const std::shared_ptr< StructuredBlockForest > &sbf, IBlock *const block)
 
template<typename tMap >
second_t< typename tMap::value_type > second (const tMap &)
 

Private Attributes

std::weak_ptr< StructuredBlockForestblockForest_
 
uint_t normalDir_
 
uint_t shiftDir_
 
Vector3< ShiftTypeshift_
 
std::map< BlockID, std::vector< std::tuple< mpi::MPIRank, BlockID, CellInterval, int > > > sendAABBs_ {}
 
std::map< BlockID, std::vector< std::tuple< mpi::MPIRank, BlockID, CellInterval, int > > > recvAABBs_ {}
 
bool setupPeriodicity_ {false}
 
uint_t numGlobalBlocks_ {}
 

Member Typedef Documentation

◆ FieldType

template<typename Derived_T , typename Field_T >
using walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::FieldType = Field_T

◆ ShiftType

template<typename Derived_T , typename Field_T >
using walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::ShiftType = int

◆ ValueType

template<typename Derived_T , typename Field_T >
using walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::ValueType = typename FieldType::value_type

Constructor & Destructor Documentation

◆ ShiftedPeriodicityBase()

template<typename Derived_T , typename Field_T >
walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::ShiftedPeriodicityBase ( const std::weak_ptr< StructuredBlockForest > & blockForest,
const BlockDataID & fieldID,
const uint_t fieldGhostLayers,
const uint_t normalDir,
const uint_t shiftDir,
const ShiftType shiftValue )
inline

Member Function Documentation

◆ globalAABBToLocalCI()

template<typename Derived_T , typename Field_T >
CellInterval walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::globalAABBToLocalCI ( const AABB & aabb,
const std::shared_ptr< StructuredBlockForest > & sbf,
IBlock *const block )
inlineprivate

◆ normalDirection()

template<typename Derived_T , typename Field_T >
uint_t walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::normalDirection ( ) const
inline

◆ operator()()

template<typename Derived_T , typename Field_T >
void walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::operator() ( )
inline

packing and schedule sends

schedule receives

unpacking

◆ processDoubleAABB()

template<typename Derived_T , typename Field_T >
void walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::processDoubleAABB ( const AABB & originalAABB,
const std::shared_ptr< StructuredBlockForest > & sbf,
const real_t nGL,
const BlockID & blockID,
const int normalShift )
inlineprivate

Creates send and receive information (source, target rank, source / target blocks, source and destination CI (here in form of an AABB), and unique communication tag) per block if the shift does not coincide with the block size.

If the shift does not coincide with the block size, each block is split into two send sub-blocks and two receive sub-blocks whose source / target block will differ (maybe also the rank). Afterwards, all the information necessary for the communication is determined and saved in the corresponding data structure.

◆ processSingleAABB()

template<typename Derived_T , typename Field_T >
void walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::processSingleAABB ( const AABB & originalAABB,
const std::shared_ptr< StructuredBlockForest > & sbf,
const real_t nGL,
const BlockID & blockID,
const int normalShift )
inlineprivate

Does the same things as processDoubleAABB but assuming that the shift is a multiple of the block size, i.e., every field slice is shifted one or several entire blocks.

In this case, every block only has ONE send and ONE receive block whose information must be stored.

◆ second()

template<typename Derived_T , typename Field_T >
template<typename tMap >
second_t< typename tMap::value_type > walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::second ( const tMap & )
inlineprivate

◆ setupPeriodicity()

template<typename Derived_T , typename Field_T >
void walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::setupPeriodicity ( )
inlineprivate

Determines which blocks are participating in the boundary condition / communication, and calls the appropriate functions to extract and save the communication information.

◆ shift()

template<typename Derived_T , typename Field_T >
Vector3< ShiftType > walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::shift ( ) const
inline

◆ shiftDirection()

template<typename Derived_T , typename Field_T >
uint_t walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::shiftDirection ( ) const
inline

◆ toCellVector()

template<typename Derived_T , typename Field_T >
Vector3< cell_idx_t > walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::toCellVector ( const Vector3< real_t > & point)
inlineprivate

Member Data Documentation

◆ blockForest_

template<typename Derived_T , typename Field_T >
std::weak_ptr<StructuredBlockForest> walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::blockForest_
private

◆ fieldGhostLayers_

template<typename Derived_T , typename Field_T >
const uint_t walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::fieldGhostLayers_
protected

◆ fieldID_

template<typename Derived_T , typename Field_T >
const BlockDataID walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::fieldID_
protected

◆ fSize_

template<typename Derived_T , typename Field_T >
cell_idx_t walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::fSize_
protected

◆ normalDir_

template<typename Derived_T , typename Field_T >
uint_t walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::normalDir_
private

◆ numGlobalBlocks_

template<typename Derived_T , typename Field_T >
uint_t walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::numGlobalBlocks_ {}
private

◆ recvAABBs_

template<typename Derived_T , typename Field_T >
std::map<BlockID, std::vector<std::tuple<mpi::MPIRank, BlockID, CellInterval, int> > > walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::recvAABBs_ {}
private

◆ sendAABBs_

template<typename Derived_T , typename Field_T >
std::map<BlockID, std::vector<std::tuple<mpi::MPIRank, BlockID, CellInterval, int> > > walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::sendAABBs_ {}
private

◆ setupPeriodicity_

template<typename Derived_T , typename Field_T >
bool walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::setupPeriodicity_ {false}
private

◆ shift_

template<typename Derived_T , typename Field_T >
Vector3<ShiftType> walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::shift_
private

◆ shiftDir_

template<typename Derived_T , typename Field_T >
uint_t walberla::boundary::ShiftedPeriodicityBase< Derived_T, Field_T >::shiftDir_
private

The documentation for this class was generated from the following file: