Commit 25cc89e0 authored by Michael Kuron's avatar Michael Kuron 🔬 Committed by Christoph Rettinger

[API] Add momentum conservation to the Momentum Exchange Method and hook for PDF destruction

parent 2eeee982
......@@ -1840,13 +1840,13 @@ int main( int argc, char **argv )
"pe Time Step", finestLevel );
// add sweep for updating the pe body mapping into the LBM simulation
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), blocks ),
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), blocks ),
"Body Mapping", finestLevel );
// add sweep for restoring PDFs in cells previously occupied by pe bodies
typedef pe_coupling::EquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID );
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T > ( blocks,
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID );
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T > ( blocks, pdfFieldID,
boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), blocks ),
"PDF Restore", finestLevel );
......
......@@ -751,14 +751,14 @@ int main( int argc, char **argv )
// sweep for updating the pe body mapping into the LBM simulation
timeloop.add()
<< Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_CLI_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
<< Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_CLI_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
// sweep for restoring PDFs in cells previously occupied by pe bodies
typedef pe_coupling::EquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID);
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID);
timeloop.add()
<< Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >
( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag, pe_coupling::selectRegularBodies, optimizeForSmallObstacleFraction ), "PDF Restore" );
( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag, pe_coupling::selectRegularBodies, optimizeForSmallObstacleFraction ), "PDF Restore" );
shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer1 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID);
std::function<void(void)> storeForceTorqueInCont1 = std::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1);
......
......@@ -1195,20 +1195,20 @@ int main( int argc, char **argv )
// sweep for updating the pe body mapping into the LBM simulation
if( memVariant == MEMVariant::CLI )
timeloop.add() << Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MEM_CLI_Flag, FormerMEM_Flag ), "Body Mapping" );
timeloop.add() << Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MEM_CLI_Flag, FormerMEM_Flag ), "Body Mapping" );
else if ( memVariant == MEMVariant::MR )
timeloop.add() << Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MEM_MR_Flag, FormerMEM_Flag ), "Body Mapping" );
timeloop.add() << Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MEM_MR_Flag, FormerMEM_Flag ), "Body Mapping" );
else
timeloop.add() << Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MEM_BB_Flag, FormerMEM_Flag ), "Body Mapping" );
timeloop.add() << Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MEM_BB_Flag, FormerMEM_Flag ), "Body Mapping" );
// reconstruct missing PDFs
using ExtrapolationFinder_T = pe_coupling::SphereNormalExtrapolationDirectionFinder;
ExtrapolationFinder_T extrapolationFinder( blocks, bodyFieldID );
typedef pe_coupling::ExtrapolationReconstructor< LatticeModel_T, BoundaryHandling_T, ExtrapolationFinder_T > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID, extrapolationFinder, true );
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID, extrapolationFinder, true );
timeloop.add() << Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >
( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMEM_Flag, Fluid_Flag ), "PDF Restore" );
( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMEM_Flag, Fluid_Flag ), "PDF Restore" );
for( uint_t lbmcycle = 0; lbmcycle < numLBMSubCycles; ++lbmcycle ){
......
......@@ -55,35 +55,55 @@ namespace pe_coupling {
*
* The 'mappingBodySelectorFct' can be used to decide which bodies should be mapped or not.
*/
template< typename BoundaryHandling_T >
template< typename LatticeModel_T, typename BoundaryHandling_T, typename Destroyer_T = NaNDestroyer<LatticeModel_T>, bool conserveMomentum = false >
class BodyMapping
{
public:
typedef lbm::PdfField< LatticeModel_T > PdfField_T;
typedef typename BoundaryHandling_T::FlagField FlagField_T;
typedef typename BoundaryHandling_T::flag_t flag_t;
typedef Field< pe::BodyID, 1 > BodyField_T;
BodyMapping( const shared_ptr<StructuredBlockStorage> & blockStorage,
const BlockDataID & pdfFieldID,
const BlockDataID & boundaryHandlingID,
const BlockDataID & bodyStorageID,
const shared_ptr<pe::BodyStorage> & globalBodyStorage,
const BlockDataID & bodyFieldID,
const Destroyer_T & destroyer,
const FlagUID & obstacle, const FlagUID & formerObstacle,
const std::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), boundaryHandlingID_( boundaryHandlingID ),
: blockStorage_( blockStorage ), pdfFieldID_( pdfFieldID ), boundaryHandlingID_( boundaryHandlingID ),
bodyStorageID_(bodyStorageID), globalBodyStorage_( globalBodyStorage ), bodyFieldID_( bodyFieldID ),
obstacle_( obstacle ), formerObstacle_( formerObstacle ), mappingBodySelectorFct_( mappingBodySelectorFct )
destroyer_( destroyer ), obstacle_( obstacle ), formerObstacle_( formerObstacle ),
mappingBodySelectorFct_( mappingBodySelectorFct )
{}
BodyMapping( const shared_ptr<StructuredBlockStorage> & blockStorage,
const BlockDataID & pdfFieldID,
const BlockDataID & boundaryHandlingID,
const BlockDataID & bodyStorageID,
const shared_ptr<pe::BodyStorage> & globalBodyStorage,
const BlockDataID & bodyFieldID,
const FlagUID & obstacle, const FlagUID & formerObstacle,
const std::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), pdfFieldID_( pdfFieldID ), boundaryHandlingID_( boundaryHandlingID ),
bodyStorageID_(bodyStorageID), globalBodyStorage_( globalBodyStorage ), bodyFieldID_( bodyFieldID ),
destroyer_( Destroyer_T() ), obstacle_( obstacle ), formerObstacle_( formerObstacle ),
mappingBodySelectorFct_( mappingBodySelectorFct )
{}
void operator()( IBlock * const block )
{
WALBERLA_ASSERT_NOT_NULLPTR( block );
PdfField_T * pdfField = block->getData< PdfField_T >( pdfFieldID_ );
BoundaryHandling_T * boundaryHandling = block->getData< BoundaryHandling_T >( boundaryHandlingID_ );
FlagField_T * flagField = boundaryHandling->getFlagField();
BodyField_T * bodyField = block->getData< BodyField_T >( bodyFieldID_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdfField );
WALBERLA_ASSERT_NOT_NULLPTR( boundaryHandling );
WALBERLA_ASSERT_NOT_NULLPTR( flagField );
WALBERLA_ASSERT_NOT_NULLPTR( bodyField );
......@@ -103,19 +123,19 @@ public:
for( auto bodyIt = pe::BodyIterator::begin(*block, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt )
{
if( mappingBodySelectorFct_(bodyIt.getBodyID()) )
mapBodyAndUpdateMapping(bodyIt.getBodyID(), block, boundaryHandling, flagField , bodyField, obstacle, formerObstacle, dx, dy, dz);
mapBodyAndUpdateMapping(bodyIt.getBodyID(), block, pdfField, boundaryHandling, flagField , bodyField, obstacle, formerObstacle, dx, dy, dz);
}
for( auto bodyIt = globalBodyStorage_->begin(); bodyIt != globalBodyStorage_->end(); ++bodyIt)
{
if( mappingBodySelectorFct_(bodyIt.getBodyID()))
mapBodyAndUpdateMapping(bodyIt.getBodyID(), block, boundaryHandling, flagField , bodyField, obstacle, formerObstacle, dx, dy, dz);
mapBodyAndUpdateMapping(bodyIt.getBodyID(), block, pdfField, boundaryHandling, flagField , bodyField, obstacle, formerObstacle, dx, dy, dz);
}
}
private:
void mapBodyAndUpdateMapping(pe::BodyID body, IBlock * const block,
BoundaryHandling_T * boundaryHandling, FlagField_T * flagField, BodyField_T * bodyField,
PdfField_T * pdfField, BoundaryHandling_T * boundaryHandling, FlagField_T * flagField, BodyField_T * bodyField,
const flag_t & obstacle, const flag_t & formerObstacle,
real_t dx, real_t dy, real_t dz)
{
......@@ -156,6 +176,19 @@ private:
{
// set obstacle flag
boundaryHandling->forceBoundary( obstacle, x, y, z );
if( conserveMomentum && pdfField->isInInnerPart(Cell(x,y,z)) ) {
// this removes the fluid information (PDFs) from the simulation, together with the containing momentum
// to ensure momentum conservation, the momentum of this fluid cell has to be added to the particle
// see Aidun, C. K., Lu, Y., & Ding, E. J. (1998). Direct analysis of particulate suspensions with inertia using the discrete Boltzmann equation. Journal of Fluid Mechanics, 373, 287-311.
// force = momentum / dt, with dt = 1
Vector3<real_t> momentum = pdfField->getMomentumDensity(x, y, z);
body->addForceAtPos(momentum[0], momentum[1], momentum[2], cx, cy, cz);
}
// invalidate PDF values
destroyer_( x, y, z, block, pdfField );
}
}
// let pointer from body field point to this body
......@@ -190,11 +223,14 @@ private:
shared_ptr<StructuredBlockStorage> blockStorage_;
const BlockDataID pdfFieldID_;
const BlockDataID boundaryHandlingID_;
const BlockDataID bodyStorageID_;
shared_ptr<pe::BodyStorage> globalBodyStorage_;
const BlockDataID bodyFieldID_;
Destroyer_T destroyer_;
const FlagUID obstacle_;
const FlagUID formerObstacle_;
......
......@@ -23,5 +23,6 @@
#pragma once
#include "boundary/all.h"
#include "destruction/all.h"
#include "restoration/all.h"
#include "BodyMapping.h"
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// 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 Destroyer.h
//! \ingroup pe_coupling
//! \author Michael Kuron <mkuron@icp.uni-stuttgart.de>
//
//======================================================================================================================
#pragma once
#include <limits>
namespace walberla {
namespace pe_coupling {
template< typename LatticeModel_T >
class NaNDestroyer
{
public:
typedef lbm::PdfField< LatticeModel_T > PdfField_T;
void operator()( const cell_idx_t & x, const cell_idx_t & y, const cell_idx_t & z, IBlock * const /*block*/, PdfField_T * const pdfField ) {
for (auto d = uint_t(0); d < LatticeModel_T::Stencil::Size; ++d)
pdfField->get(x, y, z, d) = std::numeric_limits<typename PdfField_T::value_type>::quiet_NaN();
}
};
} // namespace pe_coupling
} // namespace walberla
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// 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 all.h
//! \ingroup pe_coupling
//! \author Michael Kuron <mkuron@icp.uni-stuttgart.de>
//! \brief Collective header file for module pe_coupling moving obstacle destruction
//
//======================================================================================================================
#pragma once
#include "Destroyer.h"
......@@ -55,16 +55,18 @@ namespace pe_coupling {
*/
//**************************************************************************************************************************************
template< typename LatticeModel_T, typename BoundaryHandling_T, typename Reconstructer_T >
template< typename LatticeModel_T, typename BoundaryHandling_T, typename Reconstructer_T, bool conserveMomentum = false, bool includeGhostLayers = false >
class PDFReconstruction
{
public:
typedef lbm::PdfField< LatticeModel_T > PdfField_T;
typedef typename BoundaryHandling_T::FlagField FlagField_T;
typedef typename BoundaryHandling_T::flag_t flag_t;
typedef Field< pe::BodyID, 1 > BodyField_T;
inline PDFReconstruction( const shared_ptr<StructuredBlockStorage> & blockStorage,
const BlockDataID & pdfFieldID,
const BlockDataID & boundaryHandlingID,
const BlockDataID & bodyStorageID,
const shared_ptr<pe::BodyStorage> & globalBodyStorage,
......@@ -73,7 +75,8 @@ public:
const FlagUID & formerObstacle, const FlagUID & fluid,
const std::function<bool(pe::BodyID)> & movingBodySelectorFct = selectRegularBodies,
const bool optimizeForSmallObstacleFraction = false ) :
blockStorage_( blockStorage ), boundaryHandlingID_( boundaryHandlingID ), bodyStorageID_(bodyStorageID),
blockStorage_( blockStorage ), pdfFieldID_( pdfFieldID ),
boundaryHandlingID_( boundaryHandlingID ), bodyStorageID_(bodyStorageID),
globalBodyStorage_( globalBodyStorage ), bodyFieldID_( bodyFieldID ),
reconstructor_ ( reconstructor ), formerObstacle_( formerObstacle ), fluid_( fluid ),
movingBodySelectorFct_( movingBodySelectorFct ),
......@@ -85,13 +88,23 @@ public:
private:
void reconstructPDFsInCells( const CellInterval & cells, IBlock * const block,
FlagField_T * flagField, const flag_t & formerObstacle )
PdfField_T * pdfField, FlagField_T * flagField, BodyField_T * bodyField,
const flag_t & formerObstacle )
{
for( cell_idx_t z = cells.zMin(); z <= cells.zMax(); ++z ) {
for (cell_idx_t y = cells.yMin(); y <= cells.yMax(); ++y) {
for (cell_idx_t x = cells.xMin(); x <= cells.xMax(); ++x) {
if (isFlagSet(flagField->get(x,y,z), formerObstacle)) {
reconstructor_(x,y,z,block);
reconstructor_(x,y,z,block,pdfField);
if( conserveMomentum && pdfField->isInInnerPart(Cell(x,y,z)) ) {
// the (artificially) added momentum in the restored fluid cell has to be subtracted from the former particle to ensure momentum conservation
Vector3<real_t> momentum = pdfField->getMomentumDensity(x,y,z);
// force = momentum / dt, with dt = 1
Vector3< real_t > cellCenter = blockStorage_->getBlockLocalCellCenter(*block, Cell(x,y,z) );
(*bodyField)(x,y,z)->addForceAtPos(-momentum, cellCenter);
}
}
}
}
......@@ -117,6 +130,7 @@ private:
shared_ptr<StructuredBlockStorage> blockStorage_;
const BlockDataID pdfFieldID_;
const BlockDataID boundaryHandlingID_;
const BlockDataID bodyStorageID_;
shared_ptr<pe::BodyStorage> globalBodyStorage_;
......@@ -134,16 +148,18 @@ private:
};
template< typename LatticeModel_T, typename BoundaryHandling_T, typename Reconstructer_T >
void PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructer_T >
template< typename LatticeModel_T, typename BoundaryHandling_T, typename Reconstructer_T, bool conserveMomentum, bool includeGhostLayers >
void PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructer_T, conserveMomentum, includeGhostLayers >
::operator()( IBlock * const block )
{
WALBERLA_ASSERT_NOT_NULLPTR( block );
PdfField_T * pdfField = block->getData< PdfField_T >( pdfFieldID_ );
BoundaryHandling_T * boundaryHandling = block->getData< BoundaryHandling_T >( boundaryHandlingID_ );
FlagField_T * flagField = boundaryHandling->getFlagField();
BodyField_T * bodyField = block->getData< BodyField_T >( bodyFieldID_ );
WALBERLA_ASSERT_NOT_NULLPTR( pdfField );
WALBERLA_ASSERT_NOT_NULLPTR( boundaryHandling );
WALBERLA_ASSERT_NOT_NULLPTR( flagField );
WALBERLA_ASSERT_NOT_NULLPTR( bodyField );
......@@ -159,7 +175,7 @@ void PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructer_T >
// reconstruct all missing PDFs (only inside the domain, ghost layer values get communicated)
if( optimizeForSmallObstacleFraction_ )
{
const uint_t numberOfGhostLayersToInclude = uint_t(0);
const uint_t numberOfGhostLayersToInclude = includeGhostLayers ? flagField->nrOfGhostLayers() : uint_t(0);
for( auto bodyIt = pe::BodyIterator::begin(*block, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt )
{
......@@ -167,7 +183,7 @@ void PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructer_T >
continue;
CellInterval cellBB = getCellBB( bodyIt.getBodyID(), *block, *blockStorage_, numberOfGhostLayersToInclude );
reconstructPDFsInCells(cellBB, block, flagField, formerObstacle );
reconstructPDFsInCells(cellBB, block, pdfField, flagField, bodyField, formerObstacle );
}
for( auto bodyIt = globalBodyStorage_->begin(); bodyIt != globalBodyStorage_->end(); ++bodyIt )
{
......@@ -175,13 +191,13 @@ void PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructer_T >
continue;
CellInterval cellBB = getCellBB( bodyIt.getBodyID(), *block, *blockStorage_, numberOfGhostLayersToInclude );
reconstructPDFsInCells(cellBB, block, flagField, formerObstacle );
reconstructPDFsInCells(cellBB, block, pdfField, flagField, bodyField, formerObstacle );
}
}
else
{
CellInterval cells = flagField->xyzSize();
reconstructPDFsInCells(cells, block, flagField, formerObstacle );
CellInterval cells = includeGhostLayers ? flagField->xyzSizeWithGhostLayer() : flagField->xyzSize();
reconstructPDFsInCells(cells, block, pdfField, flagField, bodyField, formerObstacle );
}
// update the flags from formerObstacle to fluid (inside domain & in ghost layers)
......
......@@ -350,14 +350,14 @@ int main( int argc, char **argv )
"pe Time Step", finestLevel );
// add sweep for updating the pe body mapping into the LBM simulation
refinementTimestep->addPostStreamVoidFunction( lbm::refinement::SweepAsFunctorWrapper( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID,
refinementTimestep->addPostStreamVoidFunction( lbm::refinement::SweepAsFunctorWrapper( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID,
bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag ), blocks ),
"Body Mapping", finestLevel );
// add sweep for restoring PDFs in cells previously occupied by pe bodies
typedef pe_coupling::EquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID );
refinementTimestep->addPostStreamVoidFunction( lbm::refinement::SweepAsFunctorWrapper( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T > ( blocks,
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID );
refinementTimestep->addPostStreamVoidFunction( lbm::refinement::SweepAsFunctorWrapper( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T > ( blocks, pdfFieldID,
boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), blocks ),
"PDF Restore", finestLevel );
......
......@@ -477,8 +477,8 @@ int main( int argc, char **argv )
// testing utilities
MappingChecker mappingChecker(blocks, bodyStorageID, globalBodyStorage, boundaryHandlingID, bodyFieldID, radius);
MappingResetter mappingResetter(blocks, boundaryHandlingID, bodyFieldID);
pe_coupling::BodyMapping<BoundaryHandling_T> regularBodyMapper(blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies );
pe_coupling::BodyMapping<BoundaryHandling_T> globalBodyMapper(blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectGlobalBodies );
pe_coupling::BodyMapping<LatticeModel_T, BoundaryHandling_T> regularBodyMapper(blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies );
pe_coupling::BodyMapping<LatticeModel_T, BoundaryHandling_T> globalBodyMapper(blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectGlobalBodies );
// sphere positions for test scenarios
......
......@@ -931,13 +931,13 @@ int main( int argc, char **argv )
// sweep for updating the pe body mapping into the LBM simulation
timeloop.add()
<< Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
<< Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
// sweep for restoring PDFs in cells previously occupied by pe bodies
typedef pe_coupling::EquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID );
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID );
timeloop.add()
<< Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID,
<< Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID,
reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" );
// setup of the LBM communication for synchronizing the pdf field between neighboring blocks
std::function< void () > commFunction;
......
......@@ -511,14 +511,14 @@ int main( int argc, char **argv )
// sweep for updating the pe body mapping into the LBM simulation
timeloop.add()
<< Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ),
<< Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ),
"Body Mapping" );
// sweep for restoring PDFs in cells previously occupied by pe bodies
typedef pe_coupling::EquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID );
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID );
timeloop.add()
<< Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID,
<< Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID,
reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" );
// setup of the LBM communication for synchronizing the pdf field between neighboring blocks
......
......@@ -636,13 +636,13 @@ int main( int argc, char **argv )
if( MO_CLI )
{
timeloop.add()
<< Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_CLI_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
<< Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_CLI_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
}else if ( MO_MR ){
timeloop.add()
<< Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_MR_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
<< Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_MR_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
}else{
timeloop.add()
<< Sweep( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_BB_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
<< Sweep( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_BB_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), "Body Mapping" );
}
// sweep for restoring PDFs in cells previously occupied by pe bodies
......@@ -650,24 +650,24 @@ int main( int argc, char **argv )
{
pe_coupling::FlagFieldNormalExtrapolationDirectionFinder< BoundaryHandling_T > extrapolationFinder( blocks, boundaryHandlingID );
typedef pe_coupling::ExtrapolationReconstructor< LatticeModel_T, BoundaryHandling_T, pe_coupling::FlagFieldNormalExtrapolationDirectionFinder<BoundaryHandling_T> > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID, extrapolationFinder, true );
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID, extrapolationFinder, true );
timeloop.add()
<< Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >
( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" );
( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" );
} else if ( eanReconstructor )
{
pe_coupling::SphereNormalExtrapolationDirectionFinder extrapolationFinder( blocks, bodyFieldID );
typedef pe_coupling::EquilibriumAndNonEquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T, pe_coupling::SphereNormalExtrapolationDirectionFinder > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID, extrapolationFinder );
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID, extrapolationFinder );
timeloop.add()
<< Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >
( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" );
( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" );
} else {
typedef pe_coupling::EquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID );
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID );
timeloop.add()
<< Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >
( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" );
( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" );
}
shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer1 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID);
......
......@@ -714,14 +714,14 @@ int main( int argc, char **argv )
"pe Time Step", finestLevel );
// add sweep for updating the pe body mapping into the LBM simulation
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), blocks ),
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), blocks ),
"Body Mapping", finestLevel );
// add sweep for restoring PDFs in cells previously occupied by pe bodies
pe_coupling::SphereNormalExtrapolationDirectionFinder extrapolationFinder( blocks, bodyFieldID );
typedef pe_coupling::EquilibriumAndNonEquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T, pe_coupling::SphereNormalExtrapolationDirectionFinder > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID, extrapolationFinder );
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T > ( blocks,
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID, extrapolationFinder );
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T > ( blocks, pdfFieldID,
boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), blocks ),
"PDF Restore", finestLevel );
......
......@@ -651,15 +651,15 @@ int main( int argc, char **argv )
"pe Time Step", finestLevel );
// add sweep for updating the pe body mapping into the LBM simulation
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::BodyMapping< BoundaryHandling_T >( blocks, boundaryHandlingID, bodyStorageID,
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::BodyMapping< LatticeModel_T, BoundaryHandling_T >( blocks, pdfFieldID, boundaryHandlingID, bodyStorageID,
globalBodyStorage, bodyFieldID, MO_Flag, FormerMO_Flag, pe_coupling::selectRegularBodies ), blocks ),
"Body Mapping", finestLevel );
// add sweep for restoring PDFs in cells previously occupied by pe bodies
pe_coupling::SphereNormalExtrapolationDirectionFinder extrapolationFinder( blocks, bodyFieldID );
typedef pe_coupling::EquilibriumAndNonEquilibriumReconstructor< LatticeModel_T, BoundaryHandling_T, pe_coupling::SphereNormalExtrapolationDirectionFinder > Reconstructor_T;
Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID, extrapolationFinder );
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T > ( blocks,
Reconstructor_T reconstructor( blocks, boundaryHandlingID, bodyFieldID, extrapolationFinder );
refinementTimestep->addPostStreamVoidFunction(lbm::refinement::SweepAsFunctorWrapper( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T > ( blocks, pdfFieldID,
boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), blocks ),
"PDF Restore", finestLevel );
......
......@@ -336,15 +336,16 @@ int main(int argc, char **argv) {
// sweep for updating the pe body mapping into the LBM simulation
timeloop.add()
<< Sweep(pe_coupling::BodyMapping<BoundaryHandling_T>(blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID,
<< Sweep(pe_coupling::BodyMapping<LatticeModel_T, BoundaryHandling_T, pe_coupling::NaNDestroyer<LatticeModel_T>, true>(blocks, pdfFieldID, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID,
MO_BB_Flag, FormerMO_BB_Flag, pe_coupling::selectRegularBodies),
"Body Mapping");
// sweep for restoring PDFs in cells previously occupied by pe bodies
typedef pe_coupling::EquilibriumReconstructor<LatticeModel_T, BoundaryHandling_T> Reconstructor_T;
Reconstructor_T reconstructor(blocks, boundaryHandlingID, pdfFieldID, bodyFieldID);
Reconstructor_T reconstructor(blocks, boundaryHandlingID, bodyFieldID);
timeloop.add()
<< Sweep(pe_coupling::PDFReconstruction<LatticeModel_T, BoundaryHandling_T, Reconstructor_T>(blocks,
<< Sweep(pe_coupling::PDFReconstruction<LatticeModel_T, BoundaryHandling_T, Reconstructor_T, true>(blocks,
pdfFieldID,
boundaryHandlingID,
bodyStorageID,
globalBodyStorage,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment