conditionally communicate particle density and angular velocity

This commit is contained in:
s126103
2018-05-18 11:40:43 +02:00
parent 41faf88df7
commit 324094bb0b
5 changed files with 35 additions and 81 deletions

View File

@ -84,7 +84,7 @@ cfdemCloud::cfdemCloud
allowCFDsubTimestep_(true),
limitDEMForces_(false),
getParticleDensities_(couplingProperties_.lookupOrDefault<bool>("getParticleDensities",false)),
getParticleTypes_(couplingProperties_.lookupOrDefault<bool>("getParticleTypes",false)),
getParticleAngVels_(couplingProperties_.lookupOrDefault<bool>("getParticleAngVels",false)),
modelType_(couplingProperties_.lookup("modelType")),
positions_(NULL),
velocities_(NULL),
@ -97,6 +97,8 @@ cfdemCloud::cfdemCloud
radii_(NULL),
voidfractions_(NULL),
cellIDs_(NULL),
particleDensities_(NULL),
particleAngVels_(NULL),
particleWeights_(NULL),
particleVolumes_(NULL),
particleV_(NULL),
@ -129,19 +131,6 @@ cfdemCloud::cfdemCloud
mesh,
dimensionedScalar("zero", dimensionSet(0,0,-1,0,0), 0) // 1/s
),
particleDensityField_
(
IOobject
(
"partRho",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimensionSet(1,-3,0,0,0), 0.0)
),
checkPeriodicCells_(false),
turbulence_
(
@ -374,7 +363,7 @@ cfdemCloud::~cfdemCloud()
dataExchangeM().destroy(particleVolumes_,1);
dataExchangeM().destroy(particleV_,1);
if(getParticleDensities_) dataExchangeM().destroy(particleDensities_,1);
if(getParticleTypes_) dataExchangeM().destroy(particleTypes_,1);
if(getParticleAngVels_) dataExchangeM().destroy(particleAngVels_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
@ -388,7 +377,7 @@ void cfdemCloud::getDEMdata()
dataExchangeM().getData("dragAcc","vector-atom",fAcc_); // array is used twice - might be necessary to clean it first
if(getParticleDensities_) dataExchangeM().getData("density","scalar-atom",particleDensities_);
if(getParticleTypes_) dataExchangeM().getData("type","scalar-atom",particleTypes_);
if(getParticleAngVels_) dataExchangeM().getData("omega","vector-atom",particleAngVels_);
}
void cfdemCloud::giveDEMdata()
@ -466,25 +455,6 @@ void cfdemCloud::setParticleForceField()
);
}
void cfdemCloud::setScalarAverages()
{
if(!getParticleDensities_) return;
if(verbose_) Info << "- setScalarAverage" << endl;
particleDensityField_.primitiveFieldRef() = 0.0;
averagingM().resetWeightFields();
averagingM().setScalarAverage
(
particleDensityField_,
particleDensities_,
particleWeights_,
averagingM().UsWeightField(),
NULL
);
if(verbose_) Info << "setScalarAverage done." << endl;
}
void cfdemCloud::setVectorAverages()
{
if(verbose_) Info << "- setVectorAverage(Us,velocities_,weights_)" << endl;
@ -637,8 +607,7 @@ bool cfdemCloud::evolve
clockM().stop("setvoidFraction");
// set average particles velocity field
clockM().start(20,"setAverages");
setScalarAverages();
clockM().start(20,"setVectorAverage");
setVectorAverages();
@ -652,7 +621,7 @@ bool cfdemCloud::evolve
if(!treatVoidCellsAsExplicitForce())
smoothingM().smoothenReferenceField(averagingM().UsNext());
clockM().stop("setAverages");
clockM().stop("setVectorAverage");
}
//============================================
@ -744,7 +713,7 @@ bool cfdemCloud::reAllocArrays()
dataExchangeM().allocateArray(particleVolumes_,0.,voidFractionM().maxCellsPerParticle());
dataExchangeM().allocateArray(particleV_,0.,1);
if(getParticleDensities_) dataExchangeM().allocateArray(particleDensities_,0.,1);
if(getParticleTypes_) dataExchangeM().allocateArray(particleTypes_,0.,1);
if(getParticleAngVels_) dataExchangeM().allocateArray(particleAngVels_,0.,3);
arraysReallocated_ = true;
return true;
}

View File

@ -98,7 +98,7 @@ protected:
bool getParticleDensities_;
bool getParticleTypes_;
bool getParticleAngVels_;
scalar maxDEMForce_;
@ -128,7 +128,7 @@ protected:
mutable double **particleDensities_;
mutable int **particleTypes_;
mutable double **particleAngVels_;
mutable double **particleWeights_;
@ -170,8 +170,6 @@ protected:
mutable volScalarField ddtVoidfraction_;
mutable volScalarField particleDensityField_;
mutable Switch checkPeriodicCells_;
const turbulenceModel& turbulence_;
@ -215,8 +213,6 @@ protected:
virtual void setParticleForceField();
virtual void setScalarAverages();
virtual void setVectorAverages();
public:
@ -335,15 +331,15 @@ public:
virtual inline int maxType() {return -1;}
virtual inline bool multipleTypesDMax() {return false;}
virtual inline bool multipleTypesDMin() {return false;}
virtual inline double ** particleDensity() const;
virtual inline double ** particleDensities() const;
virtual inline double particleDensity(label index) const;
virtual inline int ** particleTypes() const;
virtual inline label particleType(label index) const;
virtual inline double ** particleAngVels() const;
virtual vector particleAngVel(label index) const;
virtual inline int ** particleTypes() const {return NULL;}
virtual label particleType(label index) const {return -1;}
//access to the particle's rotation and torque data
//access to the particle's and torque data
virtual inline double ** DEMTorques() const {return NULL;}
virtual inline double ** omegaArray() const {return NULL;}
virtual vector omega(int) const {return vector::zero;}
//access to the particles' orientation information
virtual inline double ** exArray() const {return NULL;}

View File

@ -216,7 +216,7 @@ inline double cfdemCloud::d32(bool recalc)
return d32_;
}
inline double ** cfdemCloud::particleDensity() const
inline double ** cfdemCloud::particleDensities() const
{
if(!getParticleDensities_) return NULL;
else
@ -234,21 +234,23 @@ inline double cfdemCloud::particleDensity(label index) const
}
}
inline int ** cfdemCloud::particleTypes() const
inline double ** cfdemCloud::particleAngVels() const
{
if(!getParticleTypes_) return NULL;
if(!getParticleAngVels_) return NULL;
else
{
return particleTypes_;
return particleAngVels_;
}
}
inline label cfdemCloud::particleType(label index) const
inline vector cfdemCloud::particleAngVel(label index) const
{
if(!getParticleDensities_) return -1;
if(!getParticleAngVels_) return vector::zero;
else
{
return particleTypes_[index][0];
vector angVel;
for(int i=0;i<3;i++) angVel[i] = particleAngVels_[index][i];
return angVel;
}
}

View File

@ -94,13 +94,15 @@ MeiLift::MeiLift
{
Info << "Lift model: including spin-induced term.\n";
Info << "Make sure to use a rolling friction model in LIGGGHTS!\n";
if(!dict.lookupOrDefault<bool>("getParticleAngVels",false))
FatalError << "Lift model: useSpinInduced=true requires getParticleAngVels=true in couplingProperties" << abort(FatalError);
}
if(combineShearSpin_)
{
Info << "Lift model: combining shear- and spin-terms by assuming equilibrium spin-rate.\n";
if(!useShearInduced_ || !useSpinInduced_)
FatalError << "Shear- and spin-induced lift must be activated in order to combine.\n";
FatalError << "Shear- and spin-induced lift must be activated in order to combine." << abort(FatalError);
}
// init force sub model
@ -199,7 +201,7 @@ void MeiLift::setForce() const
{
// properties
Us = particleCloud_.velocity(index);
Omega = particleCloud_.omega(index);
Omega = particleCloud_.particleAngVel(index);
if (forceSubM(0).interpolation())
{
@ -227,26 +229,7 @@ void MeiLift::setForce() const
Rew = magVorticity*ds*ds/nuf;
omega_star = magVorticity * ds / magUr;
alphaStar = 0.5 * omega_star;
/*
//Second order terms given by Loth and Dorgan (2009)
if (useSecondOrderTerms_)
{
scalar sqrtRep = sqrt(Rep);
//Loth and Dorgan (2009), Eq (34)
Cl_star = 1.0 - (0.675 + 0.15 * (1.0 + tanh(0.28 * (alphaStar - 2.0)))) * tanh(0.18 * sqrtRep);
//Loth and Dorgan (2009), Eq (38)
Omega_eq = alphaStar * (1.0 - 0.0075 * Rew) * (1.0 - 0.062 * sqrtRep - 0.001 * Rep);
//Loth and Dorgan (2009), Eq (39)
Cl += Omega_eq * Cl_star;
}
//Loth and Dorgan (2009), Eq (27)
lift = 0.125 * constant::mathematical::pi
* rho
* Cl
* magUr * Ur ^ vorticity / magVorticity
* ds * ds;
*/ epsilonSqr = omega_star / Rep;
epsilonSqr = omega_star / Rep;
epsilon = sqrt(epsilonSqr);

View File

@ -113,6 +113,10 @@ virtualMassForce::virtualMassForce
{
Info << "Virtual mass model: using Cadd correlation by Felderhof \n";
Info << "WARNING: ignoring user-set Cadd \n";
bool getParticleDensities_ = dict.lookupOrDefault<bool>("getParticleDensities",false);
if(!dict.lookupOrDefault<bool>("getParticleDensities",false))
FatalError << "Virtual mass model: useFelderhof=true requires getParticleDensities=true in couplingProperties" << abort(FatalError);
}
particleCloud_.checkCG(true);
@ -259,7 +263,7 @@ void virtualMassForce::setForce() const
else
voidfraction = voidfraction_[cellI];
sg = particleCloud_.density(index) / rho;
sg = particleCloud_.particleDensity(index) / rho;
logsg = log(sg);
epsilons = 1-voidfraction;