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

Enabled the body selection functions for the discrete particle method coupling

parent 0f952461
Branches
Tags
No related merge requests found
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include "pe/Types.h" #include "pe/Types.h"
#include "pe/Materials.h" #include "pe/Materials.h"
#include "pe_coupling/utility/BodySelectorFunctions.h"
#include "BodyVelocityTimeDerivativeEvaluator.h" #include "BodyVelocityTimeDerivativeEvaluator.h"
#include "stencil/Directions.h" #include "stencil/Directions.h"
...@@ -57,6 +59,8 @@ namespace discrete_particle_methods { ...@@ -57,6 +59,8 @@ namespace discrete_particle_methods {
* *
* Note that the fluid velocity (and its derivatives) has to be the fluid-phase velocity (and not the volume-averaged velocity). * Note that the fluid velocity (and its derivatives) has to be the fluid-phase velocity (and not the volume-averaged velocity).
* *
* Whether or not a body gets treated by the evaluator depends on the return value of 'dpmBodySelectorFct'.
*
* For more infos on interpolators, see field interpolators in src/field/interpolators. * For more infos on interpolators, see field interpolators in src/field/interpolators.
* For more infos on distributors, see src/field/distributors. * For more infos on distributors, see src/field/distributors.
*/ */
...@@ -75,9 +79,12 @@ public: ...@@ -75,9 +79,12 @@ public:
const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags,
const BlockDataID & velocityTimeDerivativeFieldID, const BlockDataID & velocityTimeDerivativeFieldID,
const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t )> & addedMassForceCorrelationFunction, const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t )> & addedMassForceCorrelationFunction,
const shared_ptr< BodyVelocityTimeDerivativeEvaluator > & bodyVelocityTimeDerivativeEvaluator ) const shared_ptr< BodyVelocityTimeDerivativeEvaluator > & bodyVelocityTimeDerivativeEvaluator,
const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ),
addedMassForceCorrelationFunction_( addedMassForceCorrelationFunction ), bodyVelocityTimeDerivativeEvaluator_( bodyVelocityTimeDerivativeEvaluator ) addedMassForceCorrelationFunction_( addedMassForceCorrelationFunction ),
bodyVelocityTimeDerivativeEvaluator_( bodyVelocityTimeDerivativeEvaluator ),
dpmBodySelectorFct_( dpmBodySelectorFct)
{ {
velocityTimeDerivativeFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityTimeDerivativeFieldID, flagFieldID, domainFlags ); velocityTimeDerivativeFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityTimeDerivativeFieldID, flagFieldID, domainFlags );
forceDistributorID_ = field::addDistributor< ForceDistributor_T, FlagField_T >( blockStorage, forceFieldID, flagFieldID, domainFlags ); forceDistributorID_ = field::addDistributor< ForceDistributor_T, FlagField_T >( blockStorage, forceFieldID, flagFieldID, domainFlags );
...@@ -94,6 +101,8 @@ private: ...@@ -94,6 +101,8 @@ private:
shared_ptr< BodyVelocityTimeDerivativeEvaluator > bodyVelocityTimeDerivativeEvaluator_; shared_ptr< BodyVelocityTimeDerivativeEvaluator > bodyVelocityTimeDerivativeEvaluator_;
boost::function<bool(pe::BodyID)> dpmBodySelectorFct_;
BlockDataID velocityTimeDerivativeFieldInterpolatorID_; BlockDataID velocityTimeDerivativeFieldInterpolatorID_;
BlockDataID forceDistributorID_; BlockDataID forceDistributorID_;
...@@ -112,7 +121,7 @@ void AddedMassForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T > ...@@ -112,7 +121,7 @@ void AddedMassForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T >
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 )
{ {
//TODO check if body should be treated by DPM if(!dpmBodySelectorFct_(*bodyIt)) continue;
Vector3<real_t> forceOnFluid( real_t(0) ); Vector3<real_t> forceOnFluid( real_t(0) );
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include "pe/rigidbody/BodyIterators.h" #include "pe/rigidbody/BodyIterators.h"
#include "pe_coupling/utility/BodySelectorFunctions.h"
#include <boost/function.hpp>
#include <map> #include <map>
namespace walberla { namespace walberla {
...@@ -38,14 +41,18 @@ namespace discrete_particle_methods { ...@@ -38,14 +41,18 @@ namespace discrete_particle_methods {
* Calling get(..), the body's former velocity is fetched from the map and used to calculate a simple approximation of the * Calling get(..), the body's former velocity is fetched from the map and used to calculate a simple approximation of the
* body velocity time derivative (du/dt = ( u_new - u_old ) / deltaT ) * body velocity time derivative (du/dt = ( u_new - u_old ) / deltaT )
* *
* Whether or not a body gets treated by the evaluator depends on the return value of 'dpmBodySelectorFct'.
*
*/ */
class BodyVelocityTimeDerivativeEvaluator class BodyVelocityTimeDerivativeEvaluator
{ {
public: public:
BodyVelocityTimeDerivativeEvaluator( const shared_ptr<StructuredBlockStorage> & blockStorage, BodyVelocityTimeDerivativeEvaluator( const shared_ptr<StructuredBlockStorage> & blockStorage,
const BlockDataID & bodyStorageID, const real_t & deltaT = real_t(1) ) const BlockDataID & bodyStorageID, const real_t & deltaT = real_t(1),
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), deltaTinv_( real_t(1) / deltaT ) const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), deltaTinv_( real_t(1) / deltaT ),
dpmBodySelectorFct_( dpmBodySelectorFct)
{ } { }
void operator()() void operator()()
...@@ -56,6 +63,8 @@ public: ...@@ -56,6 +63,8 @@ public:
{ {
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(!dpmBodySelectorFct_(*bodyIt)) continue;
bodyVelocityMap_.insert( std::pair<walberla::id_t, Vector3< real_t > >( bodyIt->getSystemID(), bodyIt->getLinearVel() ) ); bodyVelocityMap_.insert( std::pair<walberla::id_t, Vector3< real_t > >( bodyIt->getSystemID(), bodyIt->getLinearVel() ) );
} }
} }
...@@ -79,7 +88,7 @@ private: ...@@ -79,7 +88,7 @@ private:
const BlockDataID bodyStorageID_; const BlockDataID bodyStorageID_;
std::map< walberla::id_t, Vector3< real_t > > bodyVelocityMap_; std::map< walberla::id_t, Vector3< real_t > > bodyVelocityMap_;
real_t deltaTinv_; real_t deltaTinv_;
boost::function<bool(pe::BodyID)> dpmBodySelectorFct_;
}; };
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "pe/Materials.h" #include "pe/Materials.h"
#include "pe_coupling/geometry/SphereEquivalentDiameter.h" #include "pe_coupling/geometry/SphereEquivalentDiameter.h"
#include "pe_coupling/utility/BodySelectorFunctions.h"
#include "stencil/Directions.h" #include "stencil/Directions.h"
...@@ -65,6 +66,8 @@ namespace discrete_particle_methods { ...@@ -65,6 +66,8 @@ namespace discrete_particle_methods {
* *
* Note that the fluid velocity, contained in the velocityField, has to be the fluid-phase velocity (and not the volume-averaged velocity). * Note that the fluid velocity, contained in the velocityField, has to be the fluid-phase velocity (and not the volume-averaged velocity).
* *
* Whether or not a body gets treated by the evaluator depends on the return value of 'dpmBodySelectorFct'.
*
* For more infos on interpolators, see field interpolators in src/field/interpolators. * For more infos on interpolators, see field interpolators in src/field/interpolators.
* For more infos on distributors, see src/field/distributors. * For more infos on distributors, see src/field/distributors.
*/ */
...@@ -86,9 +89,11 @@ public: ...@@ -86,9 +89,11 @@ public:
const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags,
const BlockDataID & velocityFieldID, const BlockDataID & solidVolumeFractionFieldID, const BlockDataID & pressureGradientFieldID, const BlockDataID & velocityFieldID, const BlockDataID & solidVolumeFractionFieldID, const BlockDataID & pressureGradientFieldID,
const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t, real_t )> & dragForceCorrelationFunction, const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t, real_t )> & dragForceCorrelationFunction,
real_t fluidDynamicViscosity ) real_t fluidDynamicViscosity,
const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ),
dragForceCorrelationFunction_( dragForceCorrelationFunction ), fluidDynamicViscosity_( fluidDynamicViscosity ) dragForceCorrelationFunction_( dragForceCorrelationFunction ), fluidDynamicViscosity_( fluidDynamicViscosity ),
dpmBodySelectorFct_( dpmBodySelectorFct)
{ {
velocityFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityFieldID, flagFieldID, domainFlags ); velocityFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityFieldID, flagFieldID, domainFlags );
solidVolumeFractionFieldInterpolatorID_ = field::addFieldInterpolator< ScalarFieldInterpolator_T, FlagField_T >( blockStorage, solidVolumeFractionFieldID, flagFieldID, domainFlags ); solidVolumeFractionFieldInterpolatorID_ = field::addFieldInterpolator< ScalarFieldInterpolator_T, FlagField_T >( blockStorage, solidVolumeFractionFieldID, flagFieldID, domainFlags );
...@@ -106,12 +111,14 @@ private: ...@@ -106,12 +111,14 @@ private:
boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t, real_t )> dragForceCorrelationFunction_; boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t, real_t )> dragForceCorrelationFunction_;
real_t fluidDynamicViscosity_;
boost::function<bool(pe::BodyID)> dpmBodySelectorFct_;
BlockDataID velocityFieldInterpolatorID_; BlockDataID velocityFieldInterpolatorID_;
BlockDataID solidVolumeFractionFieldInterpolatorID_; BlockDataID solidVolumeFractionFieldInterpolatorID_;
BlockDataID pressureGradientFieldInterpolatorID_; BlockDataID pressureGradientFieldInterpolatorID_;
BlockDataID forceDistributorID_; BlockDataID forceDistributorID_;
real_t fluidDynamicViscosity_;
}; };
template< typename FlagField_T, template<typename,typename> class FieldInterpolator_T, template<typename,typename> class Distributor_T > template< typename FlagField_T, template<typename,typename> class FieldInterpolator_T, template<typename,typename> class Distributor_T >
...@@ -129,7 +136,7 @@ void InteractionForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T ...@@ -129,7 +136,7 @@ void InteractionForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T
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 )
{ {
//TODO check if body should be treated by DPM if(!dpmBodySelectorFct_(*bodyIt)) continue;
Vector3<real_t> forceOnFluid( real_t(0) ); Vector3<real_t> forceOnFluid( real_t(0) );
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "pe/Materials.h" #include "pe/Materials.h"
#include "pe_coupling/geometry/SphereEquivalentDiameter.h" #include "pe_coupling/geometry/SphereEquivalentDiameter.h"
#include "pe_coupling/utility/BodySelectorFunctions.h"
#include <boost/function.hpp> #include <boost/function.hpp>
...@@ -53,6 +54,8 @@ namespace discrete_particle_methods { ...@@ -53,6 +54,8 @@ namespace discrete_particle_methods {
* *
* Note that the fluid velocity, contained in the velocityField, has to be the fluid-phase velocity (and not the volume-averaged velocity). * Note that the fluid velocity, contained in the velocityField, has to be the fluid-phase velocity (and not the volume-averaged velocity).
* *
* Whether or not a body gets treated by the evaluator depends on the return value of 'dpmBodySelectorFct'.
*
* For more infos on interpolators, see field interpolators in src/field/interpolators. * For more infos on interpolators, see field interpolators in src/field/interpolators.
* For more infos on distributors, see src/field/distributors. * For more infos on distributors, see src/field/distributors.
*/ */
...@@ -70,8 +73,10 @@ public: ...@@ -70,8 +73,10 @@ public:
const BlockDataID & forceFieldID, const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, const BlockDataID & forceFieldID, const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags,
const BlockDataID & velocityFieldID, const BlockDataID & velocityCurlFieldID, const BlockDataID & velocityFieldID, const BlockDataID & velocityCurlFieldID,
const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t )> & liftForceCorrelationFunction, const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t )> & liftForceCorrelationFunction,
real_t fluidDynamicViscosity ) real_t fluidDynamicViscosity,
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), liftForceCorrelationFunction_( liftForceCorrelationFunction ), fluidDynamicViscosity_( fluidDynamicViscosity ) const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), liftForceCorrelationFunction_( liftForceCorrelationFunction ),
fluidDynamicViscosity_( fluidDynamicViscosity ), dpmBodySelectorFct_( dpmBodySelectorFct)
{ {
velocityFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityFieldID, flagFieldID, domainFlags ); velocityFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityFieldID, flagFieldID, domainFlags );
velocityCurlFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityCurlFieldID, flagFieldID, domainFlags ); velocityCurlFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityCurlFieldID, flagFieldID, domainFlags );
...@@ -89,6 +94,8 @@ private: ...@@ -89,6 +94,8 @@ private:
real_t fluidDynamicViscosity_; real_t fluidDynamicViscosity_;
boost::function<bool(pe::BodyID)> dpmBodySelectorFct_;
BlockDataID velocityFieldInterpolatorID_; BlockDataID velocityFieldInterpolatorID_;
BlockDataID velocityCurlFieldInterpolatorID_; BlockDataID velocityCurlFieldInterpolatorID_;
BlockDataID forceDistributorID_; BlockDataID forceDistributorID_;
...@@ -108,7 +115,7 @@ void LiftForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T > ...@@ -108,7 +115,7 @@ void LiftForceEvaluator< FlagField_T, FieldInterpolator_T, Distributor_T >
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 )
{ {
//TODO check if body should be treated by DPM if(!dpmBodySelectorFct_(*bodyIt)) continue;
Vector3<real_t> forceOnFluid( real_t(0) ); Vector3<real_t> forceOnFluid( real_t(0) );
......
...@@ -30,11 +30,15 @@ ...@@ -30,11 +30,15 @@
#include "pe/rigidbody/BodyIterators.h" #include "pe/rigidbody/BodyIterators.h"
#include "pe_coupling/utility/BodySelectorFunctions.h"
#include <boost/function.hpp>
namespace walberla { namespace walberla {
namespace pe_coupling { namespace pe_coupling {
namespace discrete_particle_methods { namespace discrete_particle_methods {
/*!\brief Evalutor of the solid volume fraction field. /*!\brief Evaluator of the solid volume fraction field.
* *
* Updates the solid volume fraction field. Includes firstly removing all old entries from the field, then remapping * Updates the solid volume fraction field. Includes firstly removing all old entries from the field, then remapping
* the local bodies' volumes to the cells. * the local bodies' volumes to the cells.
...@@ -49,6 +53,8 @@ namespace discrete_particle_methods { ...@@ -49,6 +53,8 @@ namespace discrete_particle_methods {
* See Finn, Li, Apte - "Particle based modelling and simulation of natural sand dynamics in the wave bottom boundary layer" (2016) * See Finn, Li, Apte - "Particle based modelling and simulation of natural sand dynamics in the wave bottom boundary layer" (2016)
* for the application, even though different kernel was used there. * for the application, even though different kernel was used there.
* *
* Whether or not a body gets treated by the evaluator depends on the return value of 'dpmBodySelectorFct'.
*
* For more infos on distributors, see src/field/distributors. * For more infos on distributors, see src/field/distributors.
*/ */
template< typename FlagField_T, template <typename,typename> class Distributor_T > template< typename FlagField_T, template <typename,typename> class Distributor_T >
...@@ -61,8 +67,10 @@ public: ...@@ -61,8 +67,10 @@ public:
SolidVolumeFractionFieldEvaluator( const shared_ptr<StructuredBlockStorage> & blockStorage, SolidVolumeFractionFieldEvaluator( const shared_ptr<StructuredBlockStorage> & blockStorage,
const BlockDataID & solidVolumeFractionFieldID, const BlockDataID & bodyStorageID, const BlockDataID & solidVolumeFractionFieldID, const BlockDataID & bodyStorageID,
const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags ) const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags,
: blockStorage_( blockStorage ), solidVolumeFractionFieldID_( solidVolumeFractionFieldID ), bodyStorageID_( bodyStorageID ) const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), solidVolumeFractionFieldID_( solidVolumeFractionFieldID ),
bodyStorageID_( bodyStorageID ), dpmBodySelectorFct_( dpmBodySelectorFct)
{ {
scalarDistributorID_ = field::addDistributor< ScalarDistributor_T, FlagField_T >( blockStorage, solidVolumeFractionFieldID, flagFieldID, domainFlags ); scalarDistributorID_ = field::addDistributor< ScalarDistributor_T, FlagField_T >( blockStorage, solidVolumeFractionFieldID, flagFieldID, domainFlags );
} }
...@@ -81,6 +89,8 @@ public: ...@@ -81,6 +89,8 @@ public:
// assign the local bodies' volume to the cell, depending on the chosen Distributor_T // assign the local bodies' volume to the cell, depending on the chosen Distributor_T
for( auto bodyIt = pe::LocalBodyIterator::begin(*block, bodyStorageID_); bodyIt != pe::LocalBodyIterator::end(); ++bodyIt ) for( auto bodyIt = pe::LocalBodyIterator::begin(*block, bodyStorageID_); bodyIt != pe::LocalBodyIterator::end(); ++bodyIt )
{ {
if(!dpmBodySelectorFct_(*bodyIt)) continue;
real_t bodyVolume = bodyIt->getVolume(); real_t bodyVolume = bodyIt->getVolume();
const Vector3<real_t> bodyPosition = bodyIt->getPosition(); const Vector3<real_t> bodyPosition = bodyIt->getPosition();
...@@ -93,6 +103,9 @@ private: ...@@ -93,6 +103,9 @@ private:
shared_ptr<StructuredBlockStorage> blockStorage_; shared_ptr<StructuredBlockStorage> blockStorage_;
BlockDataID solidVolumeFractionFieldID_; BlockDataID solidVolumeFractionFieldID_;
BlockDataID bodyStorageID_; BlockDataID bodyStorageID_;
boost::function<bool(pe::BodyID)> dpmBodySelectorFct_;
BlockDataID scalarDistributorID_; BlockDataID scalarDistributorID_;
}; };
......
...@@ -33,9 +33,8 @@ ...@@ -33,9 +33,8 @@
#include "pe/rigidbody/BodyIterators.h" #include "pe/rigidbody/BodyIterators.h"
#include "pe/rigidbody/RigidBody.h" #include "pe/rigidbody/RigidBody.h"
#include "pe/Types.h" #include "pe/Types.h"
#include "pe/Materials.h"
#include "pe_coupling/geometry/SphereEquivalentDiameter.h" #include "pe_coupling/utility/BodySelectorFunctions.h"
#include <boost/function.hpp> #include <boost/function.hpp>
...@@ -50,6 +49,8 @@ namespace discrete_particle_methods { ...@@ -50,6 +49,8 @@ namespace discrete_particle_methods {
* The class uses an interpolator to obtain the approximate value of the fluid velocity at the bodies' position, * The class uses an interpolator to obtain the approximate value of the fluid velocity at the bodies' position,
* and then sets the bodies' velocity accordingly. * and then sets the bodies' velocity accordingly.
* *
* Whether or not a body gets treated by this initializer depends on the return value of 'dpmBodySelectorFct'.
*
* For more infos on interpolators, see field interpolators in src/field/interpolators. * For more infos on interpolators, see field interpolators in src/field/interpolators.
*/ */
...@@ -64,8 +65,10 @@ public: ...@@ -64,8 +65,10 @@ public:
BodyVelocityInitializer( const shared_ptr<StructuredBlockStorage> & blockStorage, BodyVelocityInitializer( const shared_ptr<StructuredBlockStorage> & blockStorage,
const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags,
const BlockDataID & velocityFieldID ) const BlockDataID & velocityFieldID,
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ) const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies )
: blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ),
dpmBodySelectorFct_( dpmBodySelectorFct)
{ {
velocityFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityFieldID, flagFieldID, domainFlags ); velocityFieldInterpolatorID_ = field::addFieldInterpolator< Vec3FieldInterpolator_T, FlagField_T >( blockStorage, velocityFieldID, flagFieldID, domainFlags );
} }
...@@ -79,7 +82,7 @@ public: ...@@ -79,7 +82,7 @@ public:
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 )
{ {
//TODO check if body should be treated by DPM if(!dpmBodySelectorFct_(*bodyIt)) continue;
Vector3<real_t> forceOnFluid( real_t(0) ); Vector3<real_t> forceOnFluid( real_t(0) );
...@@ -102,6 +105,7 @@ private: ...@@ -102,6 +105,7 @@ private:
shared_ptr<StructuredBlockStorage> blockStorage_; shared_ptr<StructuredBlockStorage> blockStorage_;
BlockDataID bodyStorageID_; BlockDataID bodyStorageID_;
BlockDataID velocityFieldInterpolatorID_; BlockDataID velocityFieldInterpolatorID_;
boost::function<bool(pe::BodyID)> dpmBodySelectorFct_;
}; };
......
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