Skip to content
Snippets Groups Projects
Commit 95fe4d4a authored by Christoph Rettinger's avatar Christoph Rettinger
Browse files

Merge branch 'master' into 'master'

Combined resolved/unresolved coupling methods showcase

See merge request !264
parents 8975c764 42a34373
Branches
Tags
No related merge requests found
Showing
with 1372 additions and 8 deletions
add_subdirectory( BidisperseFluidizedBed ) add_subdirectory( BidisperseFluidizedBed )
add_subdirectory( CombinedResolvedUnresolved )
add_subdirectory( Mixer ) add_subdirectory( Mixer )
waLBerla_add_executable ( NAME CombinedResolvedUnresolved
DEPENDS blockforest boundary core domain_decomposition field lbm pe pe_coupling postprocessing timeloop vtk )
This diff is collapsed.
...@@ -42,6 +42,7 @@ void BodiesForceTorqueContainer::store() ...@@ -42,6 +42,7 @@ void BodiesForceTorqueContainer::store()
for( auto bodyIt = pe::BodyIterator::begin(*blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt ) for( auto bodyIt = pe::BodyIterator::begin(*blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt )
{ {
if( !bodySelectorFct_(bodyIt.getBodyID()) ) continue;
auto & f = (*bodyForceTorqueStorage)[ bodyIt->getSystemID() ]; auto & f = (*bodyForceTorqueStorage)[ bodyIt->getSystemID() ];
const auto & force = bodyIt->getForce(); const auto & force = bodyIt->getForce();
...@@ -60,6 +61,7 @@ void BodiesForceTorqueContainer::setOnBodies() ...@@ -60,6 +61,7 @@ void BodiesForceTorqueContainer::setOnBodies()
for( auto bodyIt = pe::BodyIterator::begin(*blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt ) for( auto bodyIt = pe::BodyIterator::begin(*blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt )
{ {
if( !bodySelectorFct_(bodyIt.getBodyID()) ) continue;
const auto f = bodyForceTorqueStorage->find( bodyIt->getSystemID() ); const auto f = bodyForceTorqueStorage->find( bodyIt->getSystemID() );
if( f != bodyForceTorqueStorage->end() ) if( f != bodyForceTorqueStorage->end() )
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#pragma once #pragma once
#include "blockforest/StructuredBlockForest.h" #include "blockforest/StructuredBlockForest.h"
#include "BodySelectorFunctions.h"
#include <map> #include <map>
#include <array> #include <array>
...@@ -35,8 +36,9 @@ public: ...@@ -35,8 +36,9 @@ public:
typedef std::map< walberla::id_t, std::array<real_t,6> > ForceTorqueStorage_T; typedef std::map< walberla::id_t, std::array<real_t,6> > ForceTorqueStorage_T;
BodiesForceTorqueContainer( const shared_ptr<StructuredBlockForest> & blockForest, const BlockDataID & bodyStorageID ) BodiesForceTorqueContainer( const shared_ptr<StructuredBlockForest> & blockForest, const BlockDataID & bodyStorageID, const std::function<bool(
: blockForest_( blockForest ), bodyStorageID_( bodyStorageID ) pe::BodyID)> &bodySelectorFct = selectRegularBodies)
: blockForest_( blockForest ), bodyStorageID_( bodyStorageID ), bodySelectorFct_( bodySelectorFct )
{ {
// has to be added to the forest (not the storage) to register correctly // has to be added to the forest (not the storage) to register correctly
bodyForceTorqueStorageID_ = blockForest->addBlockData(make_shared<blockforest::AlwaysCreateBlockDataHandling<ForceTorqueStorage_T> >(), "BodiesForceTorqueContainer"); bodyForceTorqueStorageID_ = blockForest->addBlockData(make_shared<blockforest::AlwaysCreateBlockDataHandling<ForceTorqueStorage_T> >(), "BodiesForceTorqueContainer");
...@@ -60,6 +62,7 @@ private: ...@@ -60,6 +62,7 @@ private:
shared_ptr<StructuredBlockStorage> blockForest_; shared_ptr<StructuredBlockStorage> blockForest_;
const BlockDataID bodyStorageID_; const BlockDataID bodyStorageID_;
BlockDataID bodyForceTorqueStorageID_; BlockDataID bodyForceTorqueStorageID_;
std::function<bool(pe::BodyID)> bodySelectorFct_;
}; };
......
...@@ -35,6 +35,7 @@ void ForceOnBodiesAdder::operator()() ...@@ -35,6 +35,7 @@ void ForceOnBodiesAdder::operator()()
{ {
for( auto bodyIt = pe::LocalBodyIterator::begin( *blockIt, bodyStorageID_); bodyIt != pe::LocalBodyIterator::end(); ++bodyIt ) for( auto bodyIt = pe::LocalBodyIterator::begin( *blockIt, bodyStorageID_); bodyIt != pe::LocalBodyIterator::end(); ++bodyIt )
{ {
if( !bodySelectorFct_(bodyIt.getBodyID()) ) continue;
bodyIt->addForce ( force_ ); bodyIt->addForce ( force_ );
} }
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "core/math/Vector3.h" #include "core/math/Vector3.h"
#include "domain_decomposition/StructuredBlockStorage.h" #include "domain_decomposition/StructuredBlockStorage.h"
#include "BodySelectorFunctions.h"
namespace walberla { namespace walberla {
namespace pe_coupling { namespace pe_coupling {
...@@ -32,8 +33,9 @@ class ForceOnBodiesAdder ...@@ -32,8 +33,9 @@ class ForceOnBodiesAdder
public: public:
ForceOnBodiesAdder( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID, ForceOnBodiesAdder( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID,
const Vector3<real_t> & force ) const Vector3<real_t> & force, const std::function<bool(
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), force_( force ) pe::BodyID)> &bodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), force_( force ), bodySelectorFct_( bodySelectorFct )
{ } { }
// set a constant force on all (only local, to avoid force duplication) bodies // set a constant force on all (only local, to avoid force duplication) bodies
...@@ -46,6 +48,7 @@ private: ...@@ -46,6 +48,7 @@ private:
shared_ptr<StructuredBlockStorage> blockStorage_; shared_ptr<StructuredBlockStorage> blockStorage_;
const BlockDataID bodyStorageID_; const BlockDataID bodyStorageID_;
Vector3<real_t> force_; Vector3<real_t> force_;
const std::function<bool(pe::BodyID)> bodySelectorFct_;
}; };
} // namespace pe_coupling } // namespace pe_coupling
......
...@@ -32,6 +32,7 @@ void ForceTorqueOnBodiesResetter::operator()() ...@@ -32,6 +32,7 @@ void ForceTorqueOnBodiesResetter::operator()()
{ {
for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt ) for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt )
{ {
if( !bodySelectorFct_(bodyIt.getBodyID()) ) continue;
bodyIt->resetForceAndTorque(); bodyIt->resetForceAndTorque();
} }
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#pragma once #pragma once
#include "domain_decomposition/StructuredBlockStorage.h" #include "domain_decomposition/StructuredBlockStorage.h"
#include "BodySelectorFunctions.h"
namespace walberla { namespace walberla {
namespace pe_coupling { namespace pe_coupling {
...@@ -30,8 +31,9 @@ class ForceTorqueOnBodiesResetter ...@@ -30,8 +31,9 @@ class ForceTorqueOnBodiesResetter
{ {
public: public:
ForceTorqueOnBodiesResetter( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID ) ForceTorqueOnBodiesResetter( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID, const std::function<bool(
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ) pe::BodyID)> &bodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), bodySelectorFct_( bodySelectorFct )
{ } { }
// resets forces and torques on all (local and remote) bodies // resets forces and torques on all (local and remote) bodies
...@@ -41,6 +43,7 @@ private: ...@@ -41,6 +43,7 @@ private:
shared_ptr<StructuredBlockStorage> blockStorage_; shared_ptr<StructuredBlockStorage> blockStorage_;
const BlockDataID bodyStorageID_; const BlockDataID bodyStorageID_;
const std::function<bool(pe::BodyID)> bodySelectorFct_;
}; };
} // namespace pe_coupling } // namespace pe_coupling
......
...@@ -35,6 +35,7 @@ void ForceTorqueOnBodiesScaler::operator()() ...@@ -35,6 +35,7 @@ void ForceTorqueOnBodiesScaler::operator()()
{ {
for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt ) for( auto bodyIt = pe::BodyIterator::begin( *blockIt, bodyStorageID_); bodyIt != pe::BodyIterator::end(); ++bodyIt )
{ {
if( !bodySelectorFct_(bodyIt.getBodyID()) ) continue;
force = scalingFactor_ * bodyIt->getForce(); force = scalingFactor_ * bodyIt->getForce();
torque = scalingFactor_ * bodyIt->getTorque(); torque = scalingFactor_ * bodyIt->getTorque();
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#pragma once #pragma once
#include "domain_decomposition/StructuredBlockStorage.h" #include "domain_decomposition/StructuredBlockStorage.h"
#include "BodySelectorFunctions.h"
namespace walberla { namespace walberla {
namespace pe_coupling { namespace pe_coupling {
...@@ -33,8 +34,9 @@ class ForceTorqueOnBodiesScaler ...@@ -33,8 +34,9 @@ class ForceTorqueOnBodiesScaler
public: public:
ForceTorqueOnBodiesScaler( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID, ForceTorqueOnBodiesScaler( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID,
const real_t & scalingFactor ) const real_t & scalingFactor, const std::function<bool(
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), scalingFactor_( scalingFactor ) pe::BodyID)> &bodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), scalingFactor_( scalingFactor ), bodySelectorFct_( bodySelectorFct )
{ } { }
// resets forces and torques on all (local and remote) bodies // resets forces and torques on all (local and remote) bodies
...@@ -47,6 +49,7 @@ private: ...@@ -47,6 +49,7 @@ private:
shared_ptr<StructuredBlockStorage> blockStorage_; shared_ptr<StructuredBlockStorage> blockStorage_;
const BlockDataID bodyStorageID_; const BlockDataID bodyStorageID_;
real_t scalingFactor_; real_t scalingFactor_;
const std::function<bool(pe::BodyID)> bodySelectorFct_;
}; };
} // namespace pe_coupling } // namespace pe_coupling
......
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