Commit 50412516 authored by Christoph Rettinger's avatar Christoph Rettinger

[API]: changed pe coupling mapping functions interfaces, added new mapping...

[API]: changed pe coupling mapping functions interfaces, added new mapping functions, adapted test cases and benchmarks
parent 26b7f120
......@@ -900,9 +900,9 @@ int main( int argc, char **argv )
//initialization of the PDFs inside the particles, important for PSM M3
if( psmVariant == PSMVariant::SC1W1 || psmVariant == PSMVariant::SC2W1 || psmVariant == PSMVariant::SC3W1 )
pe_coupling::initializeDomainForPSM< LatticeModel_T, 1 >( blocks, pdfFieldID, bodyAndVolumeFractionFieldID );
pe_coupling::initializeDomainForPSM< LatticeModel_T, 1 >( *blocks, pdfFieldID, bodyAndVolumeFractionFieldID );
else
pe_coupling::initializeDomainForPSM< LatticeModel_T, 2 >( blocks, pdfFieldID, bodyAndVolumeFractionFieldID );
pe_coupling::initializeDomainForPSM< LatticeModel_T, 2 >( *blocks, pdfFieldID, bodyAndVolumeFractionFieldID );
}
else
......@@ -912,11 +912,11 @@ int main( int argc, char **argv )
if( memVariant == MEMVariant::CLI )
{
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MEM_CLI_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MEM_CLI_Flag );
}else if ( memVariant == MEMVariant::MR ){
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MEM_MR_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MEM_MR_Flag );
}else{
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MEM_BB_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MEM_BB_Flag );
}
}
......
......@@ -28,7 +28,7 @@
namespace walberla {
namespace pe_coupling {
CellInterval getCellBB( const pe::ConstBodyID body, const IBlock & block, const shared_ptr<StructuredBlockStorage> & blockStorage,
CellInterval getCellBB( const pe::ConstBodyID body, const IBlock & block, StructuredBlockStorage & blockStorage,
const uint_t numberOfGhostLayersToInclude )
{
......@@ -38,16 +38,16 @@ CellInterval getCellBB( const pe::ConstBodyID body, const IBlock & block, const
if( body->isFinite() )
{
blockStorage->getCellBBFromAABB( cellBB, body->getAABB(), blockStorage->getLevel(block) );
blockStorage.getCellBBFromAABB( cellBB, body->getAABB(), blockStorage.getLevel(block) );
} else
{
blockStorage->getCellBBFromAABB( cellBB, body->getAABB().getIntersection( blockStorage->getDomain() ), blockStorage->getLevel(block) );
blockStorage.getCellBBFromAABB( cellBB, body->getAABB().getIntersection( blockStorage.getDomain() ), blockStorage.getLevel(block) );
}
cellBB.xMin() -= cell_idx_t(1); cellBB.yMin() -= cell_idx_t(1); cellBB.zMin() -= cell_idx_t(1);
cellBB.xMax() += cell_idx_t(1); cellBB.yMax() += cell_idx_t(1); cellBB.zMax() += cell_idx_t(1);
CellInterval blockBB = blockStorage->getBlockCellBB( block );
CellInterval blockBB = blockStorage.getBlockCellBB( block );
cell_idx_t layers = cell_idx_c( numberOfGhostLayersToInclude );
......@@ -56,7 +56,7 @@ CellInterval getCellBB( const pe::ConstBodyID body, const IBlock & block, const
cellBB.intersect( blockBB );
blockStorage->transformGlobalToBlockLocalCellInterval( cellBB, block );
blockStorage.transformGlobalToBlockLocalCellInterval( cellBB, block );
return cellBB;
}
......
......@@ -32,7 +32,7 @@ namespace walberla {
namespace pe_coupling {
CellInterval getCellBB( const pe::ConstBodyID body, const IBlock & block, const shared_ptr<StructuredBlockStorage> & blockStorage,
CellInterval getCellBB( const pe::ConstBodyID body, const IBlock & block, StructuredBlockStorage & blockStorage,
const uint_t numberOfGhostLayersToInclude );
......
......@@ -37,24 +37,16 @@
namespace walberla {
namespace pe_coupling {
// general mapping functions for a given single body on a given single block
template< typename BoundaryHandling_T >
void mapBody( const pe::BodyID & body, IBlock & block, const shared_ptr<StructuredBlockStorage> & blockStorage,
const BlockDataID & boundaryHandlingID, const FlagUID & obstacle,
const bool fixedBodiesOnly = true, const bool moBodiesOnly = true )
void mapBody( const pe::BodyID & body, IBlock & block, StructuredBlockStorage & blockStorage,
BoundaryHandling_T * boundaryHandlingPtr, const FlagUID & obstacle )
{
WALBERLA_ASSERT_EQUAL( &block.getBlockStorage(), &(blockStorage->getBlockStorage()) );
WALBERLA_UNUSED(moBodiesOnly); // undo when other coupling algorithms are available
WALBERLA_ASSERT_EQUAL( &block.getBlockStorage(), &(blockStorage.getBlockStorage()) );
WALBERLA_ASSERT_NOT_NULLPTR( boundaryHandlingPtr );
if( ( fixedBodiesOnly && !body->isFixed() ) /*|| ( moBodiesOnly && !isMOBody( body ) )*/ )
return;
BoundaryHandling_T * boundaryHandling = block.getData< BoundaryHandling_T >( boundaryHandlingID );
auto * flagField = boundaryHandling->getFlagField();
auto * flagField = boundaryHandlingPtr->getFlagField();
WALBERLA_ASSERT_NOT_NULLPTR( boundaryHandling );
WALBERLA_ASSERT_NOT_NULLPTR( flagField );
WALBERLA_ASSERT( flagField->flagExists( obstacle ) );
......@@ -62,10 +54,10 @@ void mapBody( const pe::BodyID & body, IBlock & block, const shared_ptr<Structur
CellInterval cellBB = getCellBB( body, block, blockStorage, flagField->nrOfGhostLayers() );
Vector3<real_t> startCellCenter = blockStorage->getBlockLocalCellCenter( block, cellBB.min() );
const real_t dx = blockStorage->dx( blockStorage->getLevel(block) );
const real_t dy = blockStorage->dy( blockStorage->getLevel(block) );
const real_t dz = blockStorage->dz( blockStorage->getLevel(block) );
Vector3<real_t> startCellCenter = blockStorage.getBlockLocalCellCenter( block, cellBB.min() );
const real_t dx = blockStorage.dx( blockStorage.getLevel(block) );
const real_t dy = blockStorage.dy( blockStorage.getLevel(block) );
const real_t dz = blockStorage.dz( blockStorage.getLevel(block) );
real_t cz = startCellCenter[2];
for( cell_idx_t z = cellBB.zMin(); z <= cellBB.zMax(); ++z )
......@@ -77,58 +69,119 @@ void mapBody( const pe::BodyID & body, IBlock & block, const shared_ptr<Structur
for( cell_idx_t x = cellBB.xMin(); x <= cellBB.xMax(); ++x )
{
if( body->containsPoint(cx,cy,cz) )
boundaryHandling->forceBoundary( obstacleFlag, x, y, z );
boundaryHandlingPtr->forceBoundary( obstacleFlag, x, y, z );
cx += dx;
}
cy += dy;
}
cz += dz;
}
}
template< typename BoundaryHandling_T >
void mapBody( const pe::BodyID & body, IBlock & block, StructuredBlockStorage & blockStorage,
const BlockDataID & boundaryHandlingID, const FlagUID & obstacle )
{
WALBERLA_ASSERT_EQUAL( &block.getBlockStorage(), &(blockStorage.getBlockStorage()) );
BoundaryHandling_T * boundaryHandling = block.getData< BoundaryHandling_T >( boundaryHandlingID );
mapBody(body, block, blockStorage, boundaryHandling, obstacle );
}
// mapping function to map all bodies from the body storage - with certain properties - onto all blocks
template< typename BoundaryHandling_T >
void mapBodies( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & boundaryHandlingID, const BlockDataID & bodyStorageID, const FlagUID & obstacle,
void mapBodies( StructuredBlockStorage & blockStorage, const BlockDataID & boundaryHandlingID,
const BlockDataID & bodyStorageID, const FlagUID & obstacle,
const bool fixedBodiesOnly = true, const bool moBodiesOnly = true )
{
for( auto blockIt = blockStorage->begin(); blockIt != blockStorage->end(); ++blockIt )
for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt )
{
for( auto bodyIt = pe::BodyIterator::begin(*blockIt, bodyStorageID); bodyIt != pe::BodyIterator::end(); ++bodyIt )
mapBody< BoundaryHandling_T >( *bodyIt, *blockIt, blockStorage, boundaryHandlingID, obstacle, fixedBodiesOnly, moBodiesOnly );
{
WALBERLA_UNUSED(moBodiesOnly); // undo when other coupling algorithms are available
if( fixedBodiesOnly && bodyIt->isFixed() )
continue;
mapBody<BoundaryHandling_T>( *bodyIt, *blockIt, blockStorage, boundaryHandlingID, obstacle );
}
}
}
// mapping function to map all global bodies - with certain properties - onto all blocks
template< typename BoundaryHandling_T >
void mapGlobalBodies( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & boundaryHandlingID, pe::BodyStorage & globalBodyStorage, const FlagUID & obstacle,
void mapGlobalBodies( StructuredBlockStorage & blockStorage, const BlockDataID & boundaryHandlingID,
pe::BodyStorage & globalBodyStorage, const FlagUID & obstacle,
const bool fixedBodiesOnly = true, const bool moBodiesOnly = true )
{
for( auto blockIt = blockStorage->begin(); blockIt != blockStorage->end(); ++blockIt )
for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt )
{
for( auto bodyIt = globalBodyStorage.begin(); bodyIt != globalBodyStorage.end(); ++bodyIt)
for( auto bodyIt = globalBodyStorage.begin(); bodyIt != globalBodyStorage.end(); ++bodyIt )
{
mapBody< BoundaryHandling_T >( *bodyIt, *blockIt, blockStorage, boundaryHandlingID, obstacle, fixedBodiesOnly, moBodiesOnly );
WALBERLA_UNUSED(moBodiesOnly); // undo when other coupling algorithms are available
if( fixedBodiesOnly && bodyIt->isFixed() )
continue;
mapBody< BoundaryHandling_T >( *bodyIt, *blockIt, blockStorage, boundaryHandlingID, obstacle );
}
}
}
// mapping function to map a given single global body onto all blocks
template< typename BoundaryHandling_T >
void mapGlobalBody( const id_t globalBodySystemID,
const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & boundaryHandlingID, pe::BodyStorage & globalBodyStorage, const FlagUID & obstacle,
const bool fixedBodiesOnly = true, const bool moBodiesOnly = true )
StructuredBlockStorage & blockStorage, const BlockDataID & boundaryHandlingID,
pe::BodyStorage & globalBodyStorage, const FlagUID & obstacle )
{
for( auto blockIt = blockStorage->begin(); blockIt != blockStorage->end(); ++blockIt )
for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt )
{
auto bodyIt = globalBodyStorage.find( globalBodySystemID );
if( bodyIt != globalBodyStorage.end() )
{
mapBody< BoundaryHandling_T >( *bodyIt, *blockIt, blockStorage, boundaryHandlingID, obstacle, fixedBodiesOnly, moBodiesOnly );
mapBody< BoundaryHandling_T >( *bodyIt, *blockIt, blockStorage, boundaryHandlingID, obstacle );
}
}
}
// mapping function to map all global bodies - with certain properties - onto a given single block
template< typename BoundaryHandling_T >
void mapGlobalBodiesOnBlock( IBlock & block,
StructuredBlockStorage & blockStorage, BoundaryHandling_T * boundaryHandlingPtr,
pe::BodyStorage & globalBodyStorage, const FlagUID & obstacle,
const bool fixedBodiesOnly = true, const bool moBodiesOnly = true )
{
for( auto bodyIt = globalBodyStorage.begin(); bodyIt != globalBodyStorage.end(); ++bodyIt)
{
WALBERLA_UNUSED(moBodiesOnly); // undo when other coupling algorithms are available
if( fixedBodiesOnly && bodyIt->isFixed() )
continue;
mapBody< BoundaryHandling_T >( *bodyIt, block, blockStorage, boundaryHandlingPtr, obstacle );
}
}
// mapping function to map a given single global body onto a given single block
template< typename BoundaryHandling_T >
void mapGlobalBodyOnBlock( const id_t globalBodySystemID, IBlock & block,
StructuredBlockStorage & blockStorage, BoundaryHandling_T * boundaryHandlingPtr,
pe::BodyStorage & globalBodyStorage, const FlagUID & obstacle )
{
auto bodyIt = globalBodyStorage.find( globalBodySystemID );
if( bodyIt != globalBodyStorage.end() )
{
mapBody< BoundaryHandling_T >( *bodyIt, block, blockStorage, boundaryHandlingPtr, obstacle );
}
}
} // namespace pe_coupling
} // namespace walberla
......@@ -108,7 +108,7 @@ void BodyMapping< BoundaryHandling_T >::operator()( IBlock * const block ) const
// policy: every body manages only its own flags
CellInterval cellBB = getCellBB( *bodyIt, *block, blockStorage_, flagField->nrOfGhostLayers() );
CellInterval cellBB = getCellBB( *bodyIt, *block, *blockStorage_, flagField->nrOfGhostLayers() );
Vector3<real_t> startCellCenter = blockStorage_->getBlockLocalCellCenter( *block, cellBB.min() );
const real_t dx = blockStorage_->dx( blockStorage_->getLevel(*block) );
......@@ -174,12 +174,12 @@ void BodyMapping< BoundaryHandling_T >::operator()( IBlock * const block ) const
////////////////////////////
template< typename BoundaryHandling_T >
void mapMovingBody( const pe::BodyID body, IBlock & block, const shared_ptr<StructuredBlockStorage> & blockStorage,
void mapMovingBody( const pe::BodyID body, IBlock & block, StructuredBlockStorage & blockStorage,
const BlockDataID & boundaryHandlingID, const BlockDataID & bodyFieldID, const FlagUID & obstacle )
{
typedef Field< pe::BodyID, 1 > BodyField_T;
WALBERLA_ASSERT_EQUAL( &block.getBlockStorage(), &(blockStorage->getBlockStorage()) );
WALBERLA_ASSERT_EQUAL( &block.getBlockStorage(), &(blockStorage.getBlockStorage()) );
if( body->isFixed() /*|| !body->isFinite()*/ )
return;
......@@ -198,10 +198,10 @@ void mapMovingBody( const pe::BodyID body, IBlock & block, const shared_ptr<Stru
CellInterval cellBB = getCellBB( body, block, blockStorage, flagField->nrOfGhostLayers() );
Vector3<real_t> startCellCenter = blockStorage->getBlockLocalCellCenter( block, cellBB.min() );
const real_t dx = blockStorage->dx( blockStorage->getLevel(block) );
const real_t dy = blockStorage->dy( blockStorage->getLevel(block) );
const real_t dz = blockStorage->dz( blockStorage->getLevel(block) );
Vector3<real_t> startCellCenter = blockStorage.getBlockLocalCellCenter( block, cellBB.min() );
const real_t dx = blockStorage.dx( blockStorage.getLevel(block) );
const real_t dy = blockStorage.dy( blockStorage.getLevel(block) );
const real_t dz = blockStorage.dz( blockStorage.getLevel(block) );
real_t cz = startCellCenter[2];
for( cell_idx_t z = cellBB.zMin(); z <= cellBB.zMax(); ++z )
......@@ -230,10 +230,10 @@ void mapMovingBody( const pe::BodyID body, IBlock & block, const shared_ptr<Stru
template< typename BoundaryHandling_T >
void mapMovingBodies( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & boundaryHandlingID, const BlockDataID & bodyStorageID,
void mapMovingBodies( StructuredBlockStorage & blockStorage, const BlockDataID & boundaryHandlingID, const BlockDataID & bodyStorageID,
const BlockDataID & bodyFieldID, const FlagUID & obstacle )
{
for( auto blockIt = blockStorage->begin(); blockIt != blockStorage->end(); ++blockIt )
for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt )
{
for (auto bodyIt = pe::BodyIterator::begin(*blockIt, bodyStorageID); bodyIt != pe::BodyIterator::end(); ++bodyIt)
mapMovingBody< BoundaryHandling_T >( *bodyIt, *blockIt, blockStorage, boundaryHandlingID, bodyFieldID, obstacle );
......@@ -241,10 +241,10 @@ void mapMovingBodies( const shared_ptr<StructuredBlockStorage> & blockStorage, c
}
template< typename BoundaryHandling_T >
void mapMovingGlobalBodies( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & boundaryHandlingID, pe::BodyStorage & globalBodyStorage,
const BlockDataID & bodyFieldID, const FlagUID & obstacle )
void mapMovingGlobalBodies( StructuredBlockStorage & blockStorage, const BlockDataID & boundaryHandlingID,
pe::BodyStorage & globalBodyStorage, const BlockDataID & bodyFieldID, const FlagUID & obstacle )
{
for( auto blockIt = blockStorage->begin(); blockIt != blockStorage->end(); ++blockIt )
for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt )
{
for( auto bodyIt = globalBodyStorage.begin(); bodyIt != globalBodyStorage.end(); ++bodyIt)
{
......@@ -255,13 +255,13 @@ void mapMovingGlobalBodies( const shared_ptr<StructuredBlockStorage> & blockStor
template< typename BoundaryHandling_T >
void mapMovingGlobalBody( const id_t globalBodySystemID,
const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & boundaryHandlingID, pe::BodyStorage & globalBodyStorage,
const BlockDataID & bodyFieldID, const FlagUID & obstacle )
StructuredBlockStorage & blockStorage, const BlockDataID & boundaryHandlingID,
pe::BodyStorage & globalBodyStorage, const BlockDataID & bodyFieldID, const FlagUID & obstacle )
{
for( auto blockIt = blockStorage->begin(); blockIt != blockStorage->end(); ++blockIt )
for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt )
{
auto bodyIt = globalBodyStorage.find( globalBodySystemID );
if( bodyIt != globalBodyStorage.end() )
if( bodyIt != globalBodyStorage.end() )
{
mapMovingBody< BoundaryHandling_T >( *bodyIt, *blockIt, blockStorage, boundaryHandlingID, bodyFieldID, obstacle );
}
......
......@@ -125,7 +125,7 @@ void PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructer_T >
if( bodyIt->isFixed() )
continue;
CellInterval cellBB = getCellBB( *bodyIt, *block, blockStorage_, numberOfGhostLayersToInclude );
CellInterval cellBB = getCellBB( *bodyIt, *block, *blockStorage_, numberOfGhostLayersToInclude );
for( auto cellIt = cellBB.begin(); cellIt != cellBB.end(); ++cellIt )
{
......@@ -160,7 +160,7 @@ void PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructer_T >
if( bodyIt->isFixed() )
continue;
CellInterval cellBB = getCellBB( *bodyIt, *block, blockStorage_, numberOfGhostLayersToInclude );
CellInterval cellBB = getCellBB( *bodyIt, *block, *blockStorage_, numberOfGhostLayersToInclude );
for( cell_idx_t z = cellBB.zMin(); z <= cellBB.zMax(); ++z )
{
......
......@@ -263,7 +263,7 @@ public:
typedef lbm::PdfField< LatticeModel_T > PdfField_T;
typedef Field< pe::BodyID, 1 > BodyField_T;
ExtrapolationReconstructor( const shared_ptr<StructuredBlockStorage> blockStorage, const BlockDataID & boundaryHandlingID,
ExtrapolationReconstructor( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & boundaryHandlingID,
const BlockDataID & pdfFieldID, const BlockDataID & bodyFieldID,
const ExtrapolationDirectionFinder_T & extrapolationDirectionFinder,
const bool & enforceNoSlipConstraintAfterExtrapolation = false )
......
......@@ -45,7 +45,7 @@ namespace pe_coupling {
* As several bodies could intersect with one cell, the pairs are stored in a vector with the size of the amount of intersecting bodies.
*
*/
void mapPSMBodyAndVolumeFraction( const pe::BodyID body, IBlock & block, const shared_ptr<StructuredBlockStorage> & blockStorage,
void mapPSMBodyAndVolumeFraction( const pe::BodyID body, IBlock & block, StructuredBlockStorage & blockStorage,
const BlockDataID bodyAndVolumeFractionFieldID )
{
typedef std::pair< pe::BodyID, real_t > BodyAndVolumeFraction_T;
......@@ -63,9 +63,9 @@ void mapPSMBodyAndVolumeFraction( const pe::BodyID body, IBlock & block, const s
// get the cell's center
Vector3<real_t> cellCenter;
cellCenter = blockStorage->getBlockLocalCellCenter( block, cell );
cellCenter = blockStorage.getBlockLocalCellCenter( block, cell );
const real_t fraction = overlapFractionPe( *body, cellCenter, blockStorage->dx( blockStorage->getLevel( block ) ) );
const real_t fraction = overlapFractionPe( *body, cellCenter, blockStorage.dx( blockStorage.getLevel( block ) ) );
// if the cell intersected with the body, store a pointer to that body and the corresponding volume fraction in the field
if( fraction > real_t(0) )
......@@ -100,7 +100,7 @@ public:
typedef GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 > BodyAndVolumeFractionField_T;
BodyAndVolumeFractionMapping( const shared_ptr<StructuredBlockStorage> & blockStorage,
const shared_ptr<pe::BodyStorage> globalBodyStorage,
const shared_ptr<pe::BodyStorage> & globalBodyStorage,
const BlockDataID & bodyStorageID,
const BlockDataID & bodyAndVolumeFractionFieldID,
const bool mapFixedBodies = false,
......@@ -180,7 +180,7 @@ void BodyAndVolumeFractionMapping::initialize()
// only PSM and finite bodies (no planes, etc.) are mapped
if( /*!isPSMBody( *bodyIt ) ||*/ ( bodyIt->isFixed() && !mapFixed_ ) )
continue;
mapPSMBodyAndVolumeFraction( *bodyIt, *blockIt, blockStorage_, bodyAndVolumeFractionFieldID_ );
mapPSMBodyAndVolumeFraction( *bodyIt, *blockIt, *blockStorage_, bodyAndVolumeFractionFieldID_ );
lastUpdatedPositionMap_.insert( std::pair< walberla::id_t, Vector3< real_t > >( bodyIt->getSystemID(), bodyIt->getPosition() ) );
}
......@@ -188,7 +188,7 @@ void BodyAndVolumeFractionMapping::initialize()
{
for( auto globalBodyIt = globalBodyStorage_->begin(); globalBodyIt != globalBodyStorage_->end(); ++globalBodyIt )
{
mapPSMBodyAndVolumeFraction( *globalBodyIt, *blockIt, blockStorage_, bodyAndVolumeFractionFieldID_ );
mapPSMBodyAndVolumeFraction( *globalBodyIt, *blockIt, *blockStorage_, bodyAndVolumeFractionFieldID_ );
}
}
}
......@@ -252,7 +252,7 @@ void BodyAndVolumeFractionMapping::updatePSMBodyAndVolumeFraction( const pe::Bod
}
// get bounding box of body
CellInterval cellBB = getCellBB( body, block, blockStorage_, oldBodyAndVolumeFractionField->nrOfGhostLayers() );
CellInterval cellBB = getCellBB( body, block, *blockStorage_, oldBodyAndVolumeFractionField->nrOfGhostLayers() );
// if body has not moved (specified by some epsilon), just reuse old fraction values
if( body->getLinearVel().sqrLength() < velocityUpdatingEpsilonSquared_ &&
......@@ -315,7 +315,7 @@ void BodyAndVolumeFractionMapping::updateGlobalPSMBodyAndVolumeFraction( const p
WALBERLA_ASSERT_NOT_NULLPTR( oldBodyAndVolumeFractionField );
// get bounding box of body
CellInterval cellBB = getCellBB( body, block, blockStorage_, oldBodyAndVolumeFractionField->nrOfGhostLayers() );
CellInterval cellBB = getCellBB( body, block, *blockStorage_, oldBodyAndVolumeFractionField->nrOfGhostLayers() );
// copy values of global body to new field
for( auto cellIt = cellBB.begin(); cellIt != cellBB.end(); ++cellIt )
......
......@@ -46,7 +46,7 @@ template < typename LatticeModel_T, int Weighting_T >
Vector3<real_t> getPSMMacroscopicVelocity( const IBlock & block,
lbm::PdfField< LatticeModel_T > * pdfField,
GhostLayerField< std::vector< std::pair< pe::BodyID, real_t > >, 1 > * bodyAndVolumeFractionField,
const shared_ptr<StructuredBlockStorage> & blockStorage,
StructuredBlockStorage & blockStorage,
const Cell & cell )
{
static_assert( LatticeModel_T::compressible == false, "Only works with incompressible models!" );
......@@ -60,7 +60,7 @@ Vector3<real_t> getPSMMacroscopicVelocity( const IBlock & block,
for( auto bodyFracIt = bodyAndVolumeFractionField->get( cell ).begin(); bodyFracIt != bodyAndVolumeFractionField->get( cell ).end(); ++bodyFracIt )
{
const Vector3< real_t > coordsCellCenter = blockStorage->getBlockLocalCellCenter( block, cell );
const Vector3< real_t > coordsCellCenter = blockStorage.getBlockLocalCellCenter( block, cell );
const real_t eps = (*bodyFracIt).second;
......@@ -89,7 +89,7 @@ Vector3<real_t> getPSMMacroscopicVelocity( const IBlock & block,
* Only the velocity of cells intersecting with bodies is set, pure fluid cells remain unchanged.
*/
template < typename LatticeModel_T, int Weighting_T >
void initializeDomainForPSM( const shared_ptr<StructuredBlockStorage> & blockStorage,
void initializeDomainForPSM( StructuredBlockStorage & blockStorage,
const BlockDataID & pdfFieldID, const BlockDataID & bodyAndVolumeFractionFieldID )
{
typedef lbm::PdfField< LatticeModel_T > PdfField_T;
......@@ -97,7 +97,7 @@ void initializeDomainForPSM( const shared_ptr<StructuredBlockStorage> & blockSto
typedef GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 > BodyAndVolumeFractionField_T;
// iterate all blocks with an iterator 'block'
for( auto blockIt = blockStorage->begin(); blockIt != blockStorage->end(); ++blockIt )
for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt )
{
// get the field data out of the block
PdfField_T* pdfField = blockIt->getData< PdfField_T > ( pdfFieldID );
......@@ -115,7 +115,7 @@ void initializeDomainForPSM( const shared_ptr<StructuredBlockStorage> & blockSto
for( auto bodyFracIt = bodyAndVolumeFractionField->get(cell).begin(); bodyFracIt != bodyAndVolumeFractionField->get(cell).end(); ++bodyFracIt )
{
const Vector3< real_t > coordsCellCenter = blockStorage->getBlockLocalCellCenter( *blockIt, cell );
const Vector3< real_t > coordsCellCenter = blockStorage.getBlockLocalCellCenter( *blockIt, cell );
const real_t eps = (*bodyFracIt).second;
......
......@@ -42,8 +42,8 @@ class LubricationCorrection
public:
// constructor
LubricationCorrection ( const shared_ptr<StructuredBlockStorage> & blockStorage, shared_ptr<pe::BodyStorage> globalBodyStorage, const BlockDataID & bodyStorageID,
real_t dynamicViscosity, real_t cutOffDistance = real_t(2) / real_t(3) )
LubricationCorrection ( const shared_ptr<StructuredBlockStorage> & blockStorage, const shared_ptr<pe::BodyStorage> & globalBodyStorage,
const BlockDataID & bodyStorageID, real_t dynamicViscosity, real_t cutOffDistance = real_t(2) / real_t(3) )
: blockStorage_ ( blockStorage )
, globalBodyStorage_( globalBodyStorage )
, bodyStorageID_( bodyStorageID )
......
......@@ -354,7 +354,7 @@ int main( int argc, char **argv )
MyBoundaryHandling( flagFieldID, pdfFieldID, bodyFieldID ), "boundary handling" );
// initially map pe bodies into the LBM simulation
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_Flag );
///////////////
// TIME LOOP //
......
......@@ -13,7 +13,7 @@
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file DragForceSphereMEMPe.cpp
//! \file DragForceSphereMEM.cpp
//! \ingroup pe_coupling
//! \author Christoph Rettinger <christoph.rettinger@fau.de>
//
......@@ -64,7 +64,7 @@
#include <iomanip>
#include <iostream>
namespace drag_force_sphere_mem_pe
namespace drag_force_sphere_mem
{
///////////
......@@ -527,13 +527,13 @@ int main( int argc, char **argv )
if( method == MEMVariant::CLI )
{
// uses a higher order boundary condition (CLI)
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_CLI_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_CLI_Flag );
}else if ( method == MEMVariant::MR ){
// uses a higher order boundary condition (MR)
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_MR_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_MR_Flag );
}else{
// uses standard bounce back boundary conditions
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_BB_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_BB_Flag );
}
// since external forcing is applied, the evaluation of the velocity has to be carried out directly after the streaming step
......@@ -608,8 +608,8 @@ int main( int argc, char **argv )
}
} //namespace drag_force_sphere_mem_pe
} //namespace drag_force_sphere_mem
int main( int argc, char **argv ){
drag_force_sphere_mem_pe::main(argc, argv);
drag_force_sphere_mem::main(argc, argv);
}
......@@ -13,7 +13,7 @@
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file DragForceSphereMEMPeRefinement.cpp
//! \file DragForceSphereMEMRefinement.cpp
//! \ingroup pe_coupling
//! \author Christoph Rettinger <christoph.rettinger@fau.de>
//
......@@ -71,7 +71,7 @@
#include <iomanip>
#include <iostream>
namespace drag_force_sphere_mem_pe_refinement
namespace drag_force_sphere_mem_refinement
{
///////////
......@@ -549,10 +549,10 @@ int main( int argc, char **argv )
if( MO_CLI )
{
// uses a higher order boundary condition (CLI)
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_CLI_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_CLI_Flag );
}else{
// uses standard bounce back boundary conditions
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_BB_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_BB_Flag );
}
......@@ -647,8 +647,8 @@ int main( int argc, char **argv )
}
} //namespace drag_force_sphere_mem_pe_refinement
} //namespace drag_force_sphere_mem_refinement
int main( int argc, char **argv ){
drag_force_sphere_mem_pe_refinement::main(argc, argv);
drag_force_sphere_mem_refinement::main(argc, argv);
}
......@@ -13,7 +13,7 @@
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file LubricationCorrectionMEMPe.cpp
//! \file LubricationCorrectionMEM.cpp
//! \ingroup pe_coupling
//! \author Kristina Pickl <kristina.pickl@fau.de>
//! \author Dominik Bartuschat
......@@ -58,7 +58,7 @@
#include "pe_coupling/utility/all.h"
namespace lubrication_correction_mem_pe
namespace lubrication_correction_mem
{
///////////
......@@ -127,7 +127,7 @@ class EvaluateLubricationForce
public:
EvaluateLubricationForce( const shared_ptr< StructuredBlockStorage > & blocks,
const BlockDataID & bodyStorageID,
pe::BodyStorage & globalBodyStorage,
const shared_ptr<pe::BodyStorage> & globalBodyStorage,
uint_t id1, uint_t id2, pe::Vec3 vel, real_t nu_L, real_t radius,
SweepTimeloop* timeloop, bool print, bool sphSphTest, bool sphWallTest )
: blocks_( blocks ), bodyStorageID_( bodyStorageID ), globalBodyStorage_( globalBodyStorage ),
......@@ -286,7 +286,7 @@ private:
pe::SphereID sphereI = ( *curSphereIt );
if ( sphereI->getID() == id1_ )
{
for( auto globalBodyIt = globalBodyStorage_.begin(); globalBodyIt != globalBodyStorage_.end(); ++globalBodyIt)
for( auto globalBodyIt = globalBodyStorage_->begin(); globalBodyIt != globalBodyStorage_->end(); ++globalBodyIt)
{
if( globalBodyIt->getID() == id2_ )
{
......@@ -368,7 +368,7 @@ private:
shared_ptr< StructuredBlockStorage > blocks_;
const BlockDataID bodyStorageID_;
pe::BodyStorage & globalBodyStorage_;
shared_ptr<pe::BodyStorage> globalBodyStorage_;
uint_t id1_;
uint_t id2_;
......@@ -922,7 +922,7 @@ int main( int argc, char **argv )
}
// map pe bodies into the LBM simulation
pe_coupling::mapMovingBodies< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_Flag );
pe_coupling::mapMovingBodies< BoundaryHandling_T >( *blocks, boundaryHandlingID, bodyStorageID, bodyFieldID, MO_Flag );
///////////////
// TIME LOOP //
......@@ -970,7 +970,7 @@ int main( int argc, char **argv )
timeloop.addFuncAfterTimeStep( pe_coupling::LubricationCorrection( blocks, globalBodyStorage, bodyStorageID, nu_L ), "Lubrication Force" );
// perform lubrication evaluation
timeloop.addFuncAfterTimeStep( EvaluateLubricationForce( blocks, bodyStorageID, *globalBodyStorage, id1, id2, velocity,
timeloop.addFuncAfterTimeStep( EvaluateLubricationForce( blocks, bodyStorageID, globalBodyStorage, id1, id2, velocity,
nu_L, radius, &timeloop, fileIO, sphSphTest, sphWallTest ), "Evaluate Lubrication Force" );
// reset the forces and apply a constant velocity
......@@ -992,10 +992,10 @@ int main( int argc, char **argv )
return 0;
}
} //namespace lubrication_correction_mem_pe
} //namespace lubrication_correction_mem
int main( int argc, char **argv ){
lubrication_correction_mem_pe::main(argc, argv);
lubrication_correction_mem::main(argc, argv);
}
......@@ -502,10 +502,11 @@ int main( int argc, char **argv )
// special care has to be taken here that only the global spheres (not the planes) are mapped since the planes would overwrite the already set boundary flags
for( auto globalBodyIt = globalBodiesToBeMapped.begin(); globalBodyIt != globalBodiesToBeMapped.end(); ++globalBodyIt )
{
pe_coupling::mapGlobalBody< BoundaryHandling_T >( *globalBodyIt, blocks, boundaryHandlingID, *globalBodyStorage, NoSlip_Flag, false );
pe_coupling::mapGlobalBody< BoundaryHandling_T >( *globalBodyIt, *blocks, boundaryHandlingID, *globalBodyStorage, NoSlip_Flag );