global damping is activated for velocity and rVelocity in both sphere and grain solvers
This commit is contained in:
parent
db9b1e62e4
commit
8466e02d81
|
@ -324,10 +324,12 @@ bool pFlow::grainParticles::iterate()
|
|||
{
|
||||
return false;
|
||||
}
|
||||
real damping = dynPointStruct().dampingFactor(ti);
|
||||
if(!rVelIntegration_().correct(
|
||||
ti.dt(),
|
||||
rVelocity_,
|
||||
rAcceleration_))
|
||||
rAcceleration_,
|
||||
damping))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
|
||||
inline bool insertionTime(uint32 iter, real t, real dt) const
|
||||
{
|
||||
return tControl_.timeEvent(iter, t, dt);
|
||||
return tControl_.eventTime(iter, t, dt);
|
||||
}
|
||||
|
||||
uint32 numberToBeInserted(uint32 iter, real t, real dt);
|
||||
|
|
|
@ -300,10 +300,12 @@ bool pFlow::sphereParticles::iterate()
|
|||
{
|
||||
return false;
|
||||
}
|
||||
real damping = dynPointStruct().dampingFactor(ti);
|
||||
if(!rVelIntegration_().correct(
|
||||
dt(),
|
||||
ti.dt(),
|
||||
rVelocity_,
|
||||
rAcceleration_))
|
||||
rAcceleration_,
|
||||
damping))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -89,9 +89,11 @@ pFlow::dynamicPointStructure::dynamicPointStructure
|
|||
fatalExit;
|
||||
}
|
||||
|
||||
REPORT(1)<<"Reading globalDamping dictionary ..."<<END_REPORT;
|
||||
velDamping_ = makeUnique<globalDamping>(control);
|
||||
|
||||
if(control.settingsDict().containsDictionay("globalDamping"))
|
||||
{
|
||||
REPORT(1)<<"Reading globalDamping dictionary ..."<<END_REPORT;
|
||||
velDamping_ = makeUnique<globalDamping>(control);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,10 +113,6 @@ bool pFlow::dynamicPointStructure::iterate()
|
|||
{
|
||||
return pointStructure::iterate();
|
||||
|
||||
/*real dt = this->dt();
|
||||
|
||||
auto& acc = time().lookupObject<realx3PointField_D>("acceleration");
|
||||
return correct(dt, acc);*/
|
||||
}
|
||||
|
||||
bool pFlow::dynamicPointStructure::afterIteration()
|
||||
|
@ -122,7 +120,6 @@ bool pFlow::dynamicPointStructure::afterIteration()
|
|||
//const auto ti = TimeInfo();
|
||||
|
||||
auto succs = pointStructure::afterIteration();
|
||||
//velDamping_().applyDamping(ti, velocity_);
|
||||
|
||||
return succs;
|
||||
}
|
||||
|
@ -141,7 +138,7 @@ bool pFlow::dynamicPointStructure::correct(real dt)
|
|||
const auto& ti = TimeInfo();
|
||||
|
||||
if(!integrationPos_().correctPStruct(dt, *this, velocity_) )return false;
|
||||
if(!integrationVel_().correct(dt, velocity_, acceleration_, velDamping_().dampingFactor(ti)))return false;
|
||||
if(!integrationVel_().correct(dt, velocity_, acceleration_, dampingFactor(ti)))return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,16 @@ public:
|
|||
return acceleration_;
|
||||
}
|
||||
|
||||
inline
|
||||
real dampingFactor(const timeInfo& ti)const
|
||||
{
|
||||
if(velDamping_)
|
||||
{
|
||||
return velDamping_().dampingFactor(ti);
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
/// In the time loop before iterate
|
||||
bool beforeIteration() override;
|
||||
|
||||
|
|
|
@ -23,13 +23,12 @@ Licence:
|
|||
|
||||
|
||||
pFlow::globalDamping::globalDamping(const systemControl& control)
|
||||
{}
|
||||
/*:
|
||||
:
|
||||
timeControl_(control.settingsDict().subDict("globalDamping"), control.time().dt(), "damping")
|
||||
{
|
||||
const dictionary& dict = control.settingsDict().subDict("globalDamping");
|
||||
|
||||
dampingFactor_ = dict.getValOrSetMin<real>("dampingFactor", static_cast<real>(1.0));
|
||||
dampingFactor_ = dict.getValMin<real>("dampingFactor", static_cast<real>(1.0));
|
||||
|
||||
dampingFactor_ = max( dampingFactor_ , static_cast<real>(0.01));
|
||||
|
||||
|
@ -41,36 +40,11 @@ pFlow::globalDamping::globalDamping(const systemControl& control)
|
|||
else
|
||||
REPORT(2)<<"Global damping "<<Yellow_Text("is not active")<<"."<<END_REPORT;
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
/*void pFlow::globalDamping::applyDamping
|
||||
(
|
||||
const timeInfo& ti,
|
||||
realx3PointField_D& velocity
|
||||
)
|
||||
{
|
||||
if(!performDamping_) return;
|
||||
if(!timeControl_.timeEvent(ti.iter(), ti.t(), ti.dt()) )return;
|
||||
|
||||
auto d_v = velocity.deviceView();
|
||||
auto activeRng = velocity.activeRange();
|
||||
auto dmpng = dampingFactor_;
|
||||
|
||||
Kokkos::parallel_for(
|
||||
"globalDamping::applyDamping",
|
||||
deviceRPolicyStatic(activeRng.start(), activeRng.end()),
|
||||
LAMBDA_HD(uint32 i){
|
||||
d_v[i] *= dmpng;
|
||||
});
|
||||
Kokkos::fence();
|
||||
//REPORT(1)<<"Applied global damping "<<END_REPORT;
|
||||
}*/
|
||||
}
|
||||
|
||||
pFlow::real pFlow::globalDamping::dampingFactor(const timeInfo& ti)const
|
||||
{
|
||||
return 1;
|
||||
/*if(!performDamping_) return 1.0;
|
||||
if(!timeControl_.timeEvent(ti.iter(), ti.t(), ti.dt()) )return 1.0;
|
||||
return dampingFactor_;*/
|
||||
if(!performDamping_) return 1.0;
|
||||
if(!timeControl_.eventTime(ti ))return 1.0;
|
||||
return dampingFactor_;
|
||||
}
|
|
@ -37,8 +37,7 @@ private:
|
|||
|
||||
real dampingFactor_;
|
||||
|
||||
// baseTimeControl timeControl_;
|
||||
|
||||
baseTimeControl timeControl_;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -47,9 +46,7 @@ public:
|
|||
|
||||
~globalDamping()=default;
|
||||
|
||||
//void applyDamping( const timeInfo& ti, realx3PointField_D& velocity);
|
||||
|
||||
bool performDamping()const
|
||||
bool dampingActive()const
|
||||
{
|
||||
return performDamping_;
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ Licence:
|
|||
-----------------------------------------------------------------------------*/
|
||||
|
||||
#include "baseTimeControl.hpp"
|
||||
|
||||
#include "timeInfo.hpp"
|
||||
|
||||
pFlow::baseTimeControl::baseTimeControl
|
||||
(
|
||||
const dictionary &dict,
|
||||
const word& intervalPrefix,
|
||||
real defStartTime
|
||||
timeValue defStartTime
|
||||
)
|
||||
:
|
||||
intervalPrefix_(intervalPrefix)
|
||||
|
@ -49,10 +49,10 @@ pFlow::baseTimeControl::baseTimeControl
|
|||
|
||||
if(!isTimeStep_)
|
||||
{
|
||||
auto startTime = (dict.getValOrSet<real>("startTime", defStartTime));
|
||||
auto endTime = (dict.getValOrSet<real>("endTime", largeValue));
|
||||
auto interval = dict.getVal<real>(intervalWord);
|
||||
rRange_ = realStridedRange(startTime, endTime, interval);
|
||||
auto startTime = (dict.getValOrSet<timeValue>("startTime", defStartTime));
|
||||
auto endTime = (dict.getValOrSet<timeValue>("endTime", largeValue));
|
||||
auto interval = dict.getVal<timeValue>(intervalWord);
|
||||
rRange_ = stridedRange<timeValue>(startTime, endTime, interval);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -68,9 +68,9 @@ pFlow::baseTimeControl::baseTimeControl
|
|||
pFlow::baseTimeControl::baseTimeControl
|
||||
(
|
||||
const dictionary& dict,
|
||||
const real defInterval,
|
||||
const word& intervalPrefix,
|
||||
const real defStartTime
|
||||
const timeValue defInterval,
|
||||
const word& intervalPrefix,
|
||||
const timeValue defStartTime
|
||||
)
|
||||
:
|
||||
intervalPrefix_(intervalPrefix)
|
||||
|
@ -94,10 +94,10 @@ pFlow::baseTimeControl::baseTimeControl
|
|||
|
||||
if(!isTimeStep_)
|
||||
{
|
||||
auto startTime = (dict.getValOrSet<real>("startTime", defStartTime));
|
||||
auto endTime = (dict.getValOrSet<real>("endTime", largeValue));
|
||||
auto interval = dict.getValOrSet<real>(intervalWord, defInterval);
|
||||
rRange_ = realStridedRange(startTime, endTime, interval);
|
||||
auto startTime = (dict.getValOrSet<timeValue>("startTime", defStartTime));
|
||||
auto endTime = (dict.getValOrSet<timeValue>("endTime", largeValue));
|
||||
auto interval = dict.getValOrSet<timeValue>(intervalWord, defInterval);
|
||||
rRange_ = stridedRange<timeValue>(startTime, endTime, interval);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -119,7 +119,7 @@ pFlow::baseTimeControl::baseTimeControl(int32 start, int32 end, int32 stride, co
|
|||
{
|
||||
}
|
||||
|
||||
bool pFlow::baseTimeControl::timeEvent(uint32 iter, real t, real dt) const
|
||||
bool pFlow::baseTimeControl::eventTime(uint32 iter, timeValue t, timeValue dt) const
|
||||
{
|
||||
if(isTimeStep_)
|
||||
{
|
||||
|
@ -132,8 +132,13 @@ bool pFlow::baseTimeControl::timeEvent(uint32 iter, real t, real dt) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool pFlow::baseTimeControl::eventTime(const timeInfo &ti) const
|
||||
{
|
||||
return eventTime(ti.iter(), ti.t(), ti.dt());
|
||||
}
|
||||
|
||||
bool
|
||||
pFlow::baseTimeControl::isInRange(uint32 iter, real t, real dt) const
|
||||
pFlow::baseTimeControl::isInRange(uint32 iter, timeValue t, timeValue dt) const
|
||||
{
|
||||
if(isTimeStep_)
|
||||
{
|
||||
|
@ -145,7 +150,7 @@ pFlow::baseTimeControl::isInRange(uint32 iter, real t, real dt) const
|
|||
}
|
||||
}
|
||||
|
||||
pFlow::real
|
||||
pFlow::timeValue
|
||||
pFlow::baseTimeControl::startTime() const
|
||||
{
|
||||
if(!isTimeStep_)
|
||||
|
@ -158,7 +163,7 @@ pFlow::baseTimeControl::startTime() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
pFlow::real
|
||||
pFlow::timeValue
|
||||
pFlow::baseTimeControl::endTime() const
|
||||
{
|
||||
if(!isTimeStep_)
|
||||
|
@ -171,7 +176,7 @@ pFlow::baseTimeControl::endTime() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
pFlow::real
|
||||
pFlow::timeValue
|
||||
pFlow::baseTimeControl::rInterval() const
|
||||
{
|
||||
if(!isTimeStep_)
|
||||
|
|
|
@ -26,6 +26,8 @@ under the terms of GNU General Public License v3 or any other later versions.
|
|||
namespace pFlow
|
||||
{
|
||||
|
||||
class timeInfo;
|
||||
|
||||
class baseTimeControl
|
||||
{
|
||||
private:
|
||||
|
@ -34,7 +36,7 @@ private:
|
|||
|
||||
int32StridedRagne iRange_;
|
||||
|
||||
realStridedRange rRange_;
|
||||
stridedRange<timeValue> rRange_;
|
||||
|
||||
const word intervalPrefix_;
|
||||
|
||||
|
@ -43,14 +45,14 @@ public:
|
|||
baseTimeControl(
|
||||
const dictionary& dict,
|
||||
const word& intervalPrefix = "",
|
||||
real defStartTime = 0.0
|
||||
timeValue defStartTime = 0.0
|
||||
);
|
||||
|
||||
baseTimeControl(
|
||||
const dictionary& dict,
|
||||
const real defInterval,
|
||||
const word& intervalPrefix="",
|
||||
const real defStartTime=0.0);
|
||||
const dictionary& dict,
|
||||
const timeValue defInterval,
|
||||
const word& intervalPrefix="",
|
||||
const timeValue defStartTime=0.0);
|
||||
|
||||
baseTimeControl(
|
||||
int32 start,
|
||||
|
@ -64,15 +66,17 @@ public:
|
|||
return isTimeStep_;
|
||||
}
|
||||
|
||||
bool timeEvent(uint32 iter, real t, real dt) const;
|
||||
bool eventTime(uint32 iter, timeValue t, timeValue dt) const;
|
||||
|
||||
bool isInRange(uint32 iter, real t, real dt) const;
|
||||
bool eventTime(const timeInfo& ti)const;
|
||||
|
||||
real startTime() const;
|
||||
bool isInRange(uint32 iter, timeValue t, timeValue dt) const;
|
||||
|
||||
real endTime() const;
|
||||
timeValue startTime() const;
|
||||
|
||||
real rInterval() const;
|
||||
timeValue endTime() const;
|
||||
|
||||
timeValue rInterval() const;
|
||||
|
||||
int32 startIter() const;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
bool sortTime(uint32 iter, real t, real dt)const
|
||||
{
|
||||
return performSorting_() && timeControl_.timeEvent(iter, t, dt);
|
||||
return performSorting_() && timeControl_.eventTime(iter, t, dt);
|
||||
}
|
||||
|
||||
uint32IndexContainer getSortedIndices(
|
||||
|
|
Loading…
Reference in New Issue