walberla::pe_coupling::BodyAndVolumeFractionMapping Class Reference

Detailed Description

Mapping class that can be used inside the timeloop to update the volume fractions and body mappings.

Upon construction, it uses the free mapping function to initialize the fraction and body mapping field.

Whether or not a body is considered by this mapping depends on the return value of 'mappingBodySelectorFct'.

Successive calls try to update this field instead of completely recalculating all volume fractions which is expensive. To do so, the update functionality determines whether bodies have very small velocities, both translational and rotational, (limited with velocityUpdatingEpsilon) or have not traveled very far (limited by positionUpdatingEpsilon) since the last volume fraction recalculation. If both criteria are fulfilled, the volume fraction information is simply copied from the old data field. If not, the recalculation and remapping is carried out. This functionality is a pure performance optimization and might affect the accuracy of the simulation if the limits are too large.

Similarly, the argument superSamplingDepth can be used to limit the default depth (=4) of the super sampling approach which is applied to approximate the volume fraction in each cell when no analytical formula exists. If the depth is smaller, the approximation will be less accurate but faster.

WARNING: Use these functionalities with care! Extensive use might result in wrong results or crashing simulations.

#include <BodyAndVolumeFractionMapping.h>

Public Types

using BodyAndVolumeFraction_T = std::pair< pe::BodyID, real_t >
 
using BodyAndVolumeFractionField_T = GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 >
 

Public Member Functions

 BodyAndVolumeFractionMapping (const shared_ptr< StructuredBlockStorage > &blockStorage, const shared_ptr< pe::BodyStorage > &globalBodyStorage, const BlockDataID &bodyStorageID, const BlockDataID &bodyAndVolumeFractionFieldID, const std::function< bool(pe::BodyID)> &mappingBodySelectorFct=selectRegularBodies, const real_t velocityUpdatingEpsilon=real_t(0), const real_t positionUpdatingEpsilon=real_t(0), const uint_t superSamplingDepth=uint_t(4))
 
void operator() ()
 
void initialize ()
 
void update ()
 

Private Member Functions

void updatePSMBodyAndVolumeFraction (pe::BodyID body, IBlock &block, BodyAndVolumeFractionField_T *oldBodyAndVolumeFractionField, std::map< walberla::id_t, Vector3< real_t > > &tempLastUpdatedPositionMap)
 

Private Attributes

shared_ptr< StructuredBlockStorageblockStorage_
 
shared_ptr< pe::BodyStorageglobalBodyStorage_
 
const BlockDataID bodyStorageID_
 
const BlockDataID bodyAndVolumeFractionFieldID_
 
std::function< bool(pe::BodyID)> mappingBodySelectorFct_
 
shared_ptr< BodyAndVolumeFractionField_TupdatedBodyAndVolumeFractionField_
 
std::map< walberla::id_t, Vector3< real_t > > lastUpdatedPositionMap_
 
const real_t velocityUpdatingEpsilonSquared_
 
const real_t positionUpdatingEpsilonSquared_
 
const uint_t superSamplingDepth_
 

Member Typedef Documentation

◆ BodyAndVolumeFraction_T

◆ BodyAndVolumeFractionField_T

Constructor & Destructor Documentation

◆ BodyAndVolumeFractionMapping()

walberla::pe_coupling::BodyAndVolumeFractionMapping::BodyAndVolumeFractionMapping ( const shared_ptr< StructuredBlockStorage > &  blockStorage,
const shared_ptr< pe::BodyStorage > &  globalBodyStorage,
const BlockDataID bodyStorageID,
const BlockDataID bodyAndVolumeFractionFieldID,
const std::function< bool(pe::BodyID)> &  mappingBodySelectorFct = selectRegularBodies,
const real_t  velocityUpdatingEpsilon = real_t(0),
const real_t  positionUpdatingEpsilon = real_t(0),
const uint_t  superSamplingDepth = uint_t(4) 
)
inline

Member Function Documentation

◆ initialize()

void walberla::pe_coupling::BodyAndVolumeFractionMapping::initialize ( )

◆ operator()()

void walberla::pe_coupling::BodyAndVolumeFractionMapping::operator() ( )
inline

◆ update()

void walberla::pe_coupling::BodyAndVolumeFractionMapping::update ( )

◆ updatePSMBodyAndVolumeFraction()

void walberla::pe_coupling::BodyAndVolumeFractionMapping::updatePSMBodyAndVolumeFraction ( pe::BodyID  body,
IBlock block,
BodyAndVolumeFractionField_T oldBodyAndVolumeFractionField,
std::map< walberla::id_t, Vector3< real_t > > &  tempLastUpdatedPositionMap 
)
private

Member Data Documentation

◆ blockStorage_

shared_ptr<StructuredBlockStorage> walberla::pe_coupling::BodyAndVolumeFractionMapping::blockStorage_
private

◆ bodyAndVolumeFractionFieldID_

const BlockDataID walberla::pe_coupling::BodyAndVolumeFractionMapping::bodyAndVolumeFractionFieldID_
private

◆ bodyStorageID_

const BlockDataID walberla::pe_coupling::BodyAndVolumeFractionMapping::bodyStorageID_
private

◆ globalBodyStorage_

shared_ptr<pe::BodyStorage> walberla::pe_coupling::BodyAndVolumeFractionMapping::globalBodyStorage_
private

◆ lastUpdatedPositionMap_

std::map< walberla::id_t, Vector3< real_t > > walberla::pe_coupling::BodyAndVolumeFractionMapping::lastUpdatedPositionMap_
private

◆ mappingBodySelectorFct_

std::function<bool(pe::BodyID)> walberla::pe_coupling::BodyAndVolumeFractionMapping::mappingBodySelectorFct_
private

◆ positionUpdatingEpsilonSquared_

const real_t walberla::pe_coupling::BodyAndVolumeFractionMapping::positionUpdatingEpsilonSquared_
private

◆ superSamplingDepth_

const uint_t walberla::pe_coupling::BodyAndVolumeFractionMapping::superSamplingDepth_
private

◆ updatedBodyAndVolumeFractionField_

shared_ptr<BodyAndVolumeFractionField_T> walberla::pe_coupling::BodyAndVolumeFractionMapping::updatedBodyAndVolumeFractionField_
private

◆ velocityUpdatingEpsilonSquared_

const real_t walberla::pe_coupling::BodyAndVolumeFractionMapping::velocityUpdatingEpsilonSquared_
private

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