mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
add reset flag for particle properties
use a reset flag to indicate if particle properties should be reset to the initial value each coupling step (note that the property value is always reset if re-allocation happens when the number of particles has changed)
This commit is contained in:
@ -829,7 +829,7 @@ bool cfdemCloud::reAllocArrays()
|
|||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (iter().size > 0 && iter().initVal == 0.0) {
|
if (iter().size > 0 && iter().reset) {
|
||||||
if ((*(iter().ti)) == typeid(int**)) {
|
if ((*(iter().ti)) == typeid(int**)) {
|
||||||
int**& property = iter().ref<int**>();
|
int**& property = iter().ref<int**>();
|
||||||
for (int index=0; index<numberOfParticles(); ++index) {
|
for (int index=0; index<numberOfParticles(); ++index) {
|
||||||
|
|||||||
@ -194,6 +194,7 @@ protected:
|
|||||||
const std::type_info* ti;
|
const std::type_info* ti;
|
||||||
int size;
|
int size;
|
||||||
double initVal;
|
double initVal;
|
||||||
|
bool reset;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& ref() {
|
T& ref() {
|
||||||
if (*ti == typeid(T)) return *reinterpret_cast<T*>(&property);
|
if (*ti == typeid(T)) return *reinterpret_cast<T*>(&property);
|
||||||
@ -460,7 +461,7 @@ public:
|
|||||||
bool checkPeriodicCells() const { return checkPeriodicCells_; }
|
bool checkPeriodicCells() const { return checkPeriodicCells_; }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void registerParticleProperty(const word& property, int size=0, double initVal=0.0);
|
void registerParticleProperty(const word& property, int size=0, double initVal=0.0, bool reset=true);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& getParticlePropertyRef(const word& property);
|
T& getParticlePropertyRef(const word& property);
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -405,9 +405,9 @@ inline const turbulenceModel& cfdemCloud::turbulence() const
|
|||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void cfdemCloud::registerParticleProperty(const word& property, int size, double initVal)
|
void cfdemCloud::registerParticleProperty(const word& property, int size, double initVal, bool reset)
|
||||||
{
|
{
|
||||||
particlePropertyTable.insert(property,{NULL,&typeid(T),size,initVal});
|
particlePropertyTable.insert(property,{NULL,&typeid(T),size,initVal,reset});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
@ -97,8 +97,8 @@ KochHillRWDrag::KochHillRWDrag
|
|||||||
if (propsDict_.found("rhoP"))
|
if (propsDict_.found("rhoP"))
|
||||||
rhoP_= readScalar(propsDict_.lookup("rhoP"));
|
rhoP_= readScalar(propsDict_.lookup("rhoP"));
|
||||||
|
|
||||||
particleCloud_.registerParticleProperty<double**>("partTime",1);
|
particleCloud_.registerParticleProperty<double**>("partTime",1,0.0,false);
|
||||||
particleCloud_.registerParticleProperty<double**>("partUfluct",3);
|
particleCloud_.registerParticleProperty<double**>("partUfluct",3,0.0,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,7 @@ virtualMassForce::virtualMassForce
|
|||||||
splitUrelCalculation_(propsDict_.lookupOrDefault<bool>("splitUrelCalculation",false)),
|
splitUrelCalculation_(propsDict_.lookupOrDefault<bool>("splitUrelCalculation",false)),
|
||||||
Cadd_(0.5)
|
Cadd_(0.5)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("UrelOld",3,NOTONCPU);
|
particleCloud_.registerParticleProperty<double**>("UrelOld",3,NOTONCPU,false);
|
||||||
|
|
||||||
// init force sub model
|
// init force sub model
|
||||||
setForceSubModels(propsDict_);
|
setForceSubModels(propsDict_);
|
||||||
|
|||||||
@ -59,8 +59,8 @@ regionModel::regionModel
|
|||||||
dict_(dict),
|
dict_(dict),
|
||||||
particleCloud_(sm)
|
particleCloud_(sm)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("inRegion",1,1.0);
|
particleCloud_.registerParticleProperty<double**>("inRegion",1,1.0,false);
|
||||||
particleCloud_.registerParticleProperty<double**>("outRegion",1,1.0);
|
particleCloud_.registerParticleProperty<double**>("outRegion",1,1.0,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -88,7 +88,7 @@ voidFractionModel::voidFractionModel
|
|||||||
weight_(1.),
|
weight_(1.),
|
||||||
porosity_(1.)
|
porosity_(1.)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<int**>("cellsPerParticle",1,1.0);
|
particleCloud_.registerParticleProperty<int**>("cellsPerParticle",1,1.0,false);
|
||||||
if (particleCloud_.getParticleEffVolFactors()) multiWeights_ = true;
|
if (particleCloud_.getParticleEffVolFactors()) multiWeights_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ voidFractionModel::voidFractionModel
|
|||||||
weight_(1.),
|
weight_(1.),
|
||||||
porosity_(1.)
|
porosity_(1.)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<int**>("cellsPerParticle",1,1.0);
|
particleCloud_.registerParticleProperty<int**>("cellsPerParticle",1,1.0,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
Reference in New Issue
Block a user