Dear CS10-Gitlab-users, on Thursday, Feb 3 there will be maintenance. That will lead to a downtime of the CS10-Gitlab-service including Subversion and Mattermost chat from 09:30. This might take the whole day since we don't know how long it is going to take. We are sorry for the inconvenience! Best regards, CS10-Admin-Team

Commit 57476454 authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

extended pe solver interface

getMaximumPenetration()
getNumberOfContacts()
getNumberOfContactsTreated()
parent 88a92435
......@@ -54,13 +54,19 @@ DEM::DEM( const shared_ptr<BodyStorage>& globalBodyStorage
, ccdID_(ccdID)
, fcdID_(fcdID)
, tt_(tt)
, maxPenetration_(0)
, numberOfContacts_(0)
, numberOfContactsTreated_(0)
{
}
void DEM::timestep( real_t dt )
{
// auto numContacts = 0;
maxPenetration_ = real_c(0.0);
numberOfContacts_ = 0;
numberOfContactsTreated_ = 0;
for (auto it = blockStorage_->begin(); it != blockStorage_->end(); ++it){
IBlock & currentBlock = *it;
......@@ -71,16 +77,18 @@ void DEM::timestep( real_t dt )
Contacts& cont = fcd->generateContacts( ccd->getPossibleContacts() );
if (tt_ != NULL) tt_->stop("FCD");
real_t maxOverlap = real_c(0);
for (auto cIt = cont.begin(); cIt != cont.end(); ++cIt){
const real_t overlap( -cIt->getDistance() );
if( overlap > maxOverlap )
maxOverlap = overlap;
if( overlap > maxPenetration_ )
maxPenetration_ = overlap;
if (shouldContactBeTreated( &(*cIt), currentBlock.getAABB() ))
{
++numberOfContactsTreated_;
resolveContact( &(*cIt) );
}
}
// numContacts += cont.size();
numberOfContacts_ += cont.size();
cont.clear();
}
......
......@@ -52,6 +52,10 @@ public:
void operator()(const real_t dt) { timestep(dt); }
/// Advances the simulation dt seconds.
void timestep( const real_t dt );
virtual inline real_t getMaximumPenetration() const WALBERLA_OVERRIDE { return maxPenetration_; }
virtual inline size_t getNumberOfContacts() const WALBERLA_OVERRIDE { return numberOfContacts_; }
virtual inline size_t getNumberOfContactsTreated() const WALBERLA_OVERRIDE { return numberOfContactsTreated_; }
private:
void resolveContact( ContactID c ) const;
void move( BodyID id, real_t dt );
......@@ -62,6 +66,10 @@ private:
domain_decomposition::BlockDataID ccdID_;
domain_decomposition::BlockDataID fcdID_;
WcTimingTree* tt_;
real_t maxPenetration_;
size_t numberOfContacts_;
size_t numberOfContactsTreated_;
};
} // namespace cr
......
......@@ -129,8 +129,9 @@ public:
//**Get functions*******************************************************************************
/*!\name Get functions */
//@{
inline real_t getMaximumPenetration() const;
inline size_t getNumberOfContacts() const;
virtual inline real_t getMaximumPenetration() const WALBERLA_OVERRIDE;
virtual inline size_t getNumberOfContacts() const WALBERLA_OVERRIDE;
virtual inline size_t getNumberOfContactsTreated() const WALBERLA_OVERRIDE;
inline const std::map<IBlockID::IDType, ContactCache> getContactCache() const { return blockToContactCache_; }
//@}
//**********************************************************************************************
......@@ -231,6 +232,7 @@ private:
real_t relaxationParam_; //!< Parameter specifying underrelaxation of velocity corrections for boundary bodies.
real_t maximumPenetration_;
size_t numContacts_;
size_t numContactsTreated_;
//**********************************************************************************************
/*! \cond WALBERLA_INTERNAL */
......@@ -294,6 +296,11 @@ inline size_t HardContactSemiImplicitTimesteppingSolvers::getNumberOfContacts()
{
return numContacts_;
}
inline size_t HardContactSemiImplicitTimesteppingSolvers::getNumberOfContactsTreated() const
{
return numContactsTreated_;
}
//*************************************************************************************************
......
......@@ -102,6 +102,7 @@ inline HardContactSemiImplicitTimesteppingSolvers::HardContactSemiImplicitTimest
, relaxationParam_ ( real_c(0.9) )
, maximumPenetration_ ( real_c(0.0) )
, numContacts_ ( 0 )
, numContactsTreated_( 0)
, requireSync_ ( false )
{
// Logging the successful setup of the collision system
......@@ -151,6 +152,9 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d
const real_t dtinv( real_c(1) / dt );
numContacts_ = 0;
numContactsTreated_ = 0;
if (tt_ != NULL) tt_->start("Simulation Step");
for (auto it = blockStorage_->begin(); it != blockStorage_->end(); ++it)
......@@ -194,6 +198,9 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d
contactsMask_[i] = false;
}
}
numContacts_ += numContacts;
numContactsTreated_ += numContactsMasked;
// WALBERLA_LOG_DEVEL("contact filtering: " << numContactsMasked << "/" << contacts.size());
if (tt_ != NULL) tt_->stop("Filtering");
if (tt_ != NULL) tt_->stop("Collision Detection");
......@@ -204,7 +211,6 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d
{
maximumPenetration_ = 0;
numContacts_ = numContactsMasked;
size_t j = 0;
for( size_t i = 0; i < numContacts; ++i )
......
......@@ -50,11 +50,46 @@ public:
/// This can be used for example to set a gravitational force.
inline void setGlobalLinearAcceleration(const Vec3& acc) { globalLinearAcceleration_ = acc; }
inline const Vec3& getGlobalLinearAcceleration() { return globalLinearAcceleration_; }
virtual inline real_t getMaximumPenetration() const;
virtual inline size_t getNumberOfContacts() const;
virtual inline size_t getNumberOfContactsTreated() const;
private:
// real_t globalLinearDrag_;
Vec3 globalLinearAcceleration_;
};
inline real_t ICR::getMaximumPenetration() const
{
static bool warned = false;
if (!warned) {
WALBERLA_LOG_WARNING("getMaximumPenetration() is not implemented for this solver!");
warned = true;
}
return real_c(0);
}
inline size_t ICR::getNumberOfContacts() const
{
static bool warned = false;
if (!warned) {
WALBERLA_LOG_WARNING("getMaximumPenetration() is not implemented for this solver!");
warned = true;
}
return 0;
}
inline size_t ICR::getNumberOfContactsTreated() const
{
static bool warned = false;
if (!warned) {
WALBERLA_LOG_WARNING("getMaximumPenetration() is not implemented for this solver!");
warned = true;
}
return 0;
}
} // namespace cr
} // namespace pe
} // namespace walberla
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