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< StructuredBlockStorage > | blockStorage_ |
shared_ptr< pe::BodyStorage > | globalBodyStorage_ |
const BlockDataID | bodyStorageID_ |
const BlockDataID | bodyAndVolumeFractionFieldID_ |
std::function< bool(pe::BodyID)> | mappingBodySelectorFct_ |
shared_ptr< BodyAndVolumeFractionField_T > | updatedBodyAndVolumeFractionField_ |
std::map< walberla::id_t, Vector3< real_t > > | lastUpdatedPositionMap_ |
const real_t | velocityUpdatingEpsilonSquared_ |
const real_t | positionUpdatingEpsilonSquared_ |
const uint_t | superSamplingDepth_ |
using walberla::pe_coupling::BodyAndVolumeFractionMapping::BodyAndVolumeFraction_T = std::pair<pe::BodyID, real_t> |
using walberla::pe_coupling::BodyAndVolumeFractionMapping::BodyAndVolumeFractionField_T = GhostLayerField<std::vector<BodyAndVolumeFraction_T>, 1> |
|
inline |
void walberla::pe_coupling::BodyAndVolumeFractionMapping::initialize | ( | ) |
|
inline |
void walberla::pe_coupling::BodyAndVolumeFractionMapping::update | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |