Merge pull request #115 from ParticulateFlow/release

Release 21.03
This commit is contained in:
Daniel
2021-03-22 17:59:49 +01:00
committed by GitHub
93 changed files with 939 additions and 763 deletions

View File

@ -14,7 +14,8 @@ EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude
-I$(LIB_SRC)/fvOptions/lnInclude \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -17,6 +17,7 @@ EXE_INC = \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -8,7 +8,8 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-Wno-deprecated-copy
LIB_LIBS = \
-linterfaceProperties \

View File

@ -10,6 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -11,6 +11,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -11,6 +11,7 @@ EXE_INC = \
-I../cfdemSolverPiso \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -17,6 +17,7 @@ EXE_INC = \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -28,8 +28,7 @@ EXE_INC = \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude \
-I$(FOAM_SOLVERS)/combustion/reactingFoam \
-Wno-deprecated-copy
EXE_LIBS = \

View File

@ -12,6 +12,7 @@ EXE_INC = \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-I$(CFDEM_SRC_DIR)/recurrence/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/derived/cfdemCloudRec \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -12,6 +12,7 @@ EXE_INC = \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-I$(CFDEM_SRC_DIR)/recurrence/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/derived/cfdemCloudRec \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -12,6 +12,7 @@ EXE_INC = \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-I$(CFDEM_SRC_DIR)/recurrence/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/derived/cfdemCloudRec \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -18,6 +18,7 @@ EXE_INC = \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-I$(CFDEM_SRC_DIR)/recurrence/lnInclude \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -12,6 +12,7 @@ EXE_INC = \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \
-I$(CFDEM_SRC_DIR)/recurrence/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/derived/cfdemCloudRec \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -9,6 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-Wno-deprecated-copy
EXE_LIBS = \

View File

@ -7,7 +7,8 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude
-I$(LIB_SRC)/fvOptions/lnInclude \
-Wno-deprecated-copy
EXE_LIBS = \
-lfiniteVolume \

View File

@ -7,7 +7,8 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude
-I$(LIB_SRC)/fvOptions/lnInclude \
-Wno-deprecated-copy
EXE_LIBS = \
-lfiniteVolume \

View File

@ -5,6 +5,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(CFDEM_SRC_DIR)/recurrence/lnInclude \
-Wno-deprecated-copy
EXE_LIBS = \
-L$(CFDEM_LIB_DIR)\

View File

@ -17,7 +17,7 @@
#------------------------------------------------------------------------------
export CFDEM_PROJECT=CFDEM
export CFDEM_VERSION=20.09
export CFDEM_VERSION=21.03
################################################################################
# USER EDITABLE PART: Changes made here may be lost with the next upgrade

View File

@ -15,7 +15,7 @@
#------------------------------------------------------------------------------
setenv CFDEM_PROJECT CFDEM
setenv CFDEM_VERSION 20.09
setenv CFDEM_VERSION 21.03
################################################################################
# USER EDITABLE PART: Changes made here may be lost with the next upgrade

View File

@ -4,7 +4,8 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-Wno-old-style-cast \
-Wno-unused-result \
-Wno-literal-suffix
-Wno-literal-suffix \
-Wno-deprecated-copy
LIB_LIBS = \
-lOpenFOAM \

View File

@ -91,6 +91,7 @@ $(forceModels)/pdCorrelation/pdCorrelation.C
$(forceModels)/surfaceTensionForce/surfaceTensionForce.C
$(forceModels)/gradPForceSmooth/gradPForceSmooth.C
$(forceModels)/particleDeformation/particleDeformation.C
$(forceModels)/turbulentDispersion/turbulentDispersion.C
$(forceModelsMS)/forceModelMS/forceModelMS.C
$(forceModelsMS)/forceModelMS/newForceModelMS.C

View File

@ -23,7 +23,8 @@ EXE_INC = \
-I$(CFDEM_SRC_DIR)/cfdTools \
-Wno-old-style-cast \
-Wno-unused-result \
-Wno-literal-suffix
-Wno-literal-suffix \
-Wno-deprecated-copy
LIB_LIBS = \

View File

@ -34,8 +34,8 @@ Description
#ifndef versionInfo_H
#define versionInfo_H
word CFDEMversion="PFM 20.09";
word compatibleLIGGGHTSversion="PFM 20.09";
word CFDEMversion="PFM 21.03";
word compatibleLIGGGHTSversion="PFM 21.03";
word OFversion="6";
Info << "\nCFDEMcoupling version: " << CFDEMversion << endl;

View File

@ -160,6 +160,7 @@ cfdemCloud::cfdemCloud
turbulenceModelType_
)
),
particlePropertyTable(32),
dataExchangeModel_
(
dataExchangeModel::New
@ -402,6 +403,22 @@ cfdemCloud::~cfdemCloud()
if(getParticleDensities_) dataExchangeM().destroy(particleDensities_,1);
if(getParticleEffVolFactors_) dataExchangeM().destroy(particleEffVolFactors_,1);
if(getParticleTypes_) dataExchangeM().destroy(particleTypes_,1);
for
(
HashTable<particleProperty>::iterator iter = particlePropertyTable.begin();
iter != particlePropertyTable.end();
++iter
)
{
if ((*(iter().ti)) == typeid(int**)) {
dataExchangeM().destroy(iter().ref<int**>(),-1);
} else if ((*(iter().ti)) == typeid(double**)) {
dataExchangeM().destroy(iter().ref<double**>(),-1);
} else {
FatalError << "Trying to destroy property of type " << iter().ti->name() << endl;
}
}
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
@ -780,9 +797,60 @@ bool cfdemCloud::reAllocArrays()
if(getParticleDensities_) dataExchangeM().allocateArray(particleDensities_,0.,1);
if(getParticleEffVolFactors_) dataExchangeM().allocateArray(particleEffVolFactors_,0.,1);
if(getParticleTypes_) dataExchangeM().allocateArray(particleTypes_,0,1);
for
(
HashTable<particleProperty>::iterator iter = particlePropertyTable.begin();
iter != particlePropertyTable.end();
++iter
)
{
if (iter().size > 0) {
///Info << "!! about to realloc property of type " << iter().ti->name() << endl;
if ((*(iter().ti)) == typeid(int**)) {
dataExchangeM().allocateArray(iter().ref<int**>(),iter().initVal,iter().size);
} else if ((*(iter().ti)) == typeid(double**)) {
dataExchangeM().allocateArray(iter().ref<double**>(),iter().initVal,iter().size);
} else {
FatalError << "Trying to realloc property of type " << iter().ti->name() << endl;
}
}
}
arraysReallocated_ = true;
return true;
}
else
{
for
(
HashTable<particleProperty>::iterator iter = particlePropertyTable.begin();
iter != particlePropertyTable.end();
++iter
)
{
if (iter().size > 0 && iter().reset) {
if ((*(iter().ti)) == typeid(int**)) {
int**& property = iter().ref<int**>();
for (int index=0; index<numberOfParticles(); ++index) {
for (int icomponent=0; icomponent<iter().size; ++icomponent) {
property[index][icomponent] = iter().initVal;
}
}
} else if ((*(iter().ti)) == typeid(double**)) {
double**& property = iter().ref<double**>();
for (int index=0; index<numberOfParticles(); ++index) {
for (int icomponent=0; icomponent<iter().size; ++icomponent) {
property[index][icomponent] = iter().initVal;
}
}
} else {
FatalError << "Trying to reset property of type " << iter().ti->name() << endl;
}
}
}
}
return false;
}

View File

@ -45,6 +45,7 @@ SourceFiles
// choose version
#include "OFversion.H"
#include <vector>
#include <typeinfo>
#include "fvCFD.H"
#include "IFstream.H"
@ -188,6 +189,21 @@ protected:
const turbulenceModel& turbulence_;
struct particleProperty {
void** property; // pointer to per-particle data; memory deallocation by cfdemCloud
const std::type_info* ti; // type of particle data (int**, double**)
int size; // size of single particle data; memory allocation by cfdemCloud if size > 0
double initVal; // initial property value
bool reset; // if true, data is reset to initial value every coupling step
template<typename T>
T& ref() {
if (*ti == typeid(T)) return *reinterpret_cast<T*>(&property);
else throw std::bad_cast();
}
};
HashTable<particleProperty> particlePropertyTable; // table of registered per-particle properties
autoPtr<dataExchangeModel> dataExchangeModel_;
PtrList<forceModel> forceModel_;
@ -443,6 +459,14 @@ public:
void otherForces(volVectorField&);
bool checkPeriodicCells() const { return checkPeriodicCells_; }
template<typename T>
void registerParticleProperty(const word& property, int size=0, double initVal=0.0, bool reset=true);
template<typename T>
T& getParticlePropertyRef(const word& property);
protected:
virtual int**& getParticlePropertyImpl(const word& property, int**);
virtual double**& getParticlePropertyImpl(const word& property, double**);
};

View File

@ -403,5 +403,28 @@ inline const turbulenceModel& cfdemCloud::turbulence() const
return turbulence_;
}
template<typename T>
void cfdemCloud::registerParticleProperty(const word& property, int size, double initVal, bool reset)
{
particlePropertyTable.insert(property,{NULL,&typeid(T),size,initVal,reset});
}
template<typename T>
T& cfdemCloud::getParticlePropertyRef(const word& property)
{
return getParticlePropertyImpl(property, static_cast<T>(0));
}
inline int**& cfdemCloud::getParticlePropertyImpl(const word& property, int**)
{
return particlePropertyTable[property].ref<int**>();
}
inline double**& cfdemCloud::getParticlePropertyImpl(const word& property, double**)
{
return particlePropertyTable[property].ref<double**>();
}
}
// ************************************************************************* //

View File

@ -71,15 +71,17 @@ diffusionCoefficient::diffusionCoefficient
pressureFieldName_(propsDict_.lookupOrDefault<word>("pressureFieldName","p")),
P_(sm.mesh().lookupObject<volScalarField>(pressureFieldName_)),
partPressureName_(propsDict_.lookupOrDefault<word>("partPressureName","partP")),
partPressure_(NULL),
X_(speciesNames_.size()),
diffusantGasNames_(propsDict_.lookup("diffusantGasNames")),
diffusionCoefficients_(diffusantGasNames_.size(),NULL),
Xdiffusant_(diffusantGasNames_.size()),
initialized_(false)
{
particleCloud_.checkCG(false);
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(partPressureName_,1);
for (int i=0; i<diffusantGasNames_.size(); i++)
{
particleCloud_.registerParticleProperty<double**>(diffusantGasNames_[i],1);
}
createCoeffs();
molWeightTable();
}
@ -88,37 +90,10 @@ diffusionCoefficient::diffusionCoefficient
diffusionCoefficient::~diffusionCoefficient()
{
particleCloud_.dataExchangeM().destroy(partPressure_,1);
for (int i=0; i<diffusantGasNames_.size(); i++) particleCloud_.dataExchangeM().destroy(diffusionCoefficients_[i],1);
coeffs.clearStorage();
molWeight.clearStorage();
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void diffusionCoefficient::allocateMyArrays() const
{
double initVal=0.0;
if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0)
{
particleCloud_.dataExchangeM().allocateArray(partPressure_,initVal,1,"nparticles");
for (int i=0; i<diffusantGasNames_.size(); i++)
{
particleCloud_.dataExchangeM().allocateArray(diffusionCoefficients_[i],initVal,1,"nparticles");
}
}
}
void diffusionCoefficient::reAllocMyArrays() const
{
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(partPressure_,initVal,1,"nparticles");
for (int i=0; i<diffusantGasNames_.size(); i++)
{
particleCloud_.dataExchangeM().allocateArray(diffusionCoefficients_[i],initVal,1);
}
}
void diffusionCoefficient::init()
{
@ -156,9 +131,6 @@ void diffusionCoefficient::execute()
init();
}
// realloc the arrays
reAllocMyArrays();
label cellI=0;
scalar Tfluid(0);
scalar Pfluid(0);
@ -172,6 +144,8 @@ void diffusionCoefficient::execute()
interpolationCellPoint <scalar> TInterpolator_(tempField_);
interpolationCellPoint <scalar> PInterpolator_(P_);
double**& partPressure_ = particleCloud_.getParticlePropertyRef<double**>(partPressureName_);
for (int index=0; index<particleCloud_.numberOfParticles(); ++index)
{
cellI = particleCloud_.cellIDs()[index][0];
@ -207,6 +181,7 @@ void diffusionCoefficient::execute()
for (int j=0; j<diffusantGasNames_.size(); j++)
{
double**& diffusionCoefficients_ = particleCloud_.getParticlePropertyRef<double**>(diffusantGasNames_[j]);
TotalFraction_[j] = 0.0;
dBinary_ = 0.0;
@ -243,9 +218,9 @@ void diffusionCoefficient::execute()
// pass on dCoeff values to array
if (TotalFraction_[j] < VSMALL)
diffusionCoefficients_[j][index][0] = VSMALL;
diffusionCoefficients_[index][0] = VSMALL;
else
diffusionCoefficients_[j][index][0] = (1.0 - Xdiffusant_[j][cellI]) / TotalFraction_[j];
diffusionCoefficients_[index][0] = (1.0 - Xdiffusant_[j][cellI]) / TotalFraction_[j];
}
else
{
@ -258,7 +233,7 @@ void diffusionCoefficient::execute()
}
if(verbose_)
Info << "diffusionCoefficient of species " << diffusantGasNames_[j] << " = " << diffusionCoefficients_[j][index][0] << endl;
Info << "diffusionCoefficient of species " << diffusantGasNames_[j] << " = " << diffusionCoefficients_[index][0] << endl;
}
}
}
@ -268,7 +243,8 @@ void diffusionCoefficient::execute()
for (int j=0; j<diffusantGasNames_.size(); j++)
{
word pushName = diffusantGasNames_[j] + "_diffCoeff";
particleCloud_.dataExchangeM().giveData(pushName,"scalar-atom",diffusionCoefficients_[j]);
double**& diffusionCoefficients_ = particleCloud_.getParticlePropertyRef<double**>(diffusantGasNames_[j]);
particleCloud_.dataExchangeM().giveData(pushName,"scalar-atom",diffusionCoefficients_);
}
Info << "give data done" << endl;

View File

@ -76,19 +76,15 @@ private:
word partPressureName_;
mutable double **partPressure_;
UPtrList<volScalarField> X_;
wordList diffusantGasNames_;
mutable List<double**> diffusionCoefficients_;
UPtrList<volScalarField> Xdiffusant_;
HashTable<scalar, word> coeffs;
HashTable<scalar> coeffs;
HashTable<scalar, word> molWeight;
HashTable<scalar> molWeight;
void createCoeffs();
@ -100,8 +96,6 @@ private:
// calculate denominator part diffusion volume equation
double calcDiffVol(int, int);
void allocateMyArrays() const;
bool initialized_;
void init();
@ -126,8 +120,6 @@ private:
// Member Functions
void execute();
void reAllocMyArrays() const;
};

View File

@ -63,51 +63,26 @@ massTransferCoeff::massTransferCoeff
densityFieldName_(propsDict_.lookupOrDefault<word>("densityFieldName","rho")),
rho_(sm.mesh().lookupObject<volScalarField> (densityFieldName_)),
partNuName_(propsDict_.lookupOrDefault<word>("partViscos","partNu")),
partNu_(NULL),
partReynolds_(propsDict_.lookupOrDefault<word>("partReynolds","partRe")),
partRe_(NULL),
partReName_(propsDict_.lookupOrDefault<word>("partReynolds","partRe")),
scaleDia_(1)
{
particleCloud_.checkCG(true);
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(partNuName_,1);
particleCloud_.registerParticleProperty<double**>(partReName_,1);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
massTransferCoeff::~massTransferCoeff()
{
int nP_ = particleCloud_.numberOfParticles();
particleCloud_.dataExchangeM().destroy(partNu_,nP_);
particleCloud_.dataExchangeM().destroy(partRe_,nP_);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void massTransferCoeff::allocateMyArrays() const
{
double initVal=0.0;
if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0)
{
// get memory for 2d arrays
particleCloud_.dataExchangeM().allocateArray(partNu_,initVal,1,"nparticles");
particleCloud_.dataExchangeM().allocateArray(partRe_,initVal,1,"nparticles");
}
}
void massTransferCoeff::reAllocMyArrays() const
{
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(partNu_,initVal,1);
particleCloud_.dataExchangeM().allocateArray(partRe_,initVal,1);
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
void massTransferCoeff::execute()
{
// realloc the arrays
reAllocMyArrays();
#ifdef compre
const volScalarField nufField = particleCloud_.turbulence().mu()/rho_;
#else
@ -139,6 +114,9 @@ void massTransferCoeff::execute()
interpolationCellPoint <vector> UluidInterpolator_(U_);
interpolationCellPoint <scalar> voidfractionInterpolator_(voidfraction_);
double**& partNu_ = particleCloud_.getParticlePropertyRef<double**>(partNuName_);
double**& partRe_ = particleCloud_.getParticlePropertyRef<double**>(partReName_);
for (int index=0; index<particleCloud_.numberOfParticles(); ++index)
{
cellI=particleCloud_.cellIDs()[index][0];
@ -195,7 +173,7 @@ void massTransferCoeff::execute()
// give DEM data
particleCloud_.dataExchangeM().giveData(partNuName_, "scalar-atom", partNu_);
particleCloud_.dataExchangeM().giveData(partReynolds_, "scalar-atom", partRe_);
particleCloud_.dataExchangeM().giveData(partReName_, "scalar-atom", partRe_);
Info << "give data done" << endl;
}

View File

@ -56,27 +56,21 @@ private:
const fvMesh& mesh_;
word velFieldName_;
const word velFieldName_;
const volVectorField& U_;
word voidfractionFieldName_;
const word voidfractionFieldName_;
const volScalarField& voidfraction_;
word densityFieldName_;
const word densityFieldName_;
const volScalarField& rho_;
word partNuName_;
const word partNuName_;
mutable double **partNu_;
word partReynolds_;
mutable double **partRe_;
void allocateMyArrays() const;
const word partReName_;
mutable scalar scaleDia_;
@ -101,8 +95,6 @@ public:
// Member Functions
void execute();
void reAllocMyArrays() const;
};

View File

@ -57,7 +57,7 @@ reactantPerParticle::reactantPerParticle
propsDict_(dict.subDict(typeName + "Props")),
mesh_(sm.mesh()),
verbose_(propsDict_.lookupOrDefault<bool>("verbose",false)),
reactantPerParticle_(NULL),
partReactantName_("reactantPerParticle"),
voidfractionFieldName_(propsDict_.lookupOrDefault<word>("voidfractionFieldName","voidfraction")),
voidfraction_(sm.mesh().lookupObject<volScalarField>(voidfractionFieldName_)),
particlesPerCell_
@ -76,32 +76,16 @@ reactantPerParticle::reactantPerParticle
Nevery_(propsDict_.lookupOrDefault<label>("Nevery",1))
{
particleCloud_.checkCG(false);
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(partReactantName_,1);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
reactantPerParticle::~reactantPerParticle()
{
particleCloud_.dataExchangeM().destroy(reactantPerParticle_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void reactantPerParticle::allocateMyArrays() const
{
double initVal=0.0;
if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0)
{
// get memory for 2d arrays
particleCloud_.dataExchangeM().allocateArray(reactantPerParticle_,initVal,1,"nparticles");
}
}
void reactantPerParticle::reAllocMyArrays() const
{
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(reactantPerParticle_,initVal,1);
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
@ -112,8 +96,6 @@ void reactantPerParticle::execute()
{
return;
}
// realloc the arrays
reAllocMyArrays();
particlesPerCell_ *= 0.0;
@ -121,6 +103,7 @@ void reactantPerParticle::execute()
scalar voidfraction(1);
scalar cellvolume(0.0);
scalar particlesPerCell(1.0);
double**& reactantPerParticle_ = particleCloud_.getParticlePropertyRef<double**>(partReactantName_);
// first create particles per cell field
for (int index=0; index<particleCloud_.numberOfParticles(); ++index)
@ -148,7 +131,7 @@ void reactantPerParticle::execute()
}
// give DEM data
particleCloud_.dataExchangeM().giveData("reactantPerParticle", "scalar-atom", reactantPerParticle_);
particleCloud_.dataExchangeM().giveData(partReactantName_, "scalar-atom", reactantPerParticle_);
Info << "give data done" << endl;
}

View File

@ -56,16 +56,14 @@ private:
bool verbose_;
mutable double **reactantPerParticle_;
const word partReactantName_;
word voidfractionFieldName_;
const word voidfractionFieldName_;
const volScalarField& voidfraction_;
mutable volScalarField particlesPerCell_;
void allocateMyArrays() const;
label loopCounter_;
label Nevery_;
@ -91,8 +89,6 @@ public:
// Member Functions
void execute();
void reAllocMyArrays() const;
};

View File

@ -70,8 +70,6 @@ species::species
speciesNames_(specDict_.lookup("species")),
mod_spec_names_(speciesNames_.size()),
X_(speciesNames_.size()), //volumeScalarFields of molarFractions
molarFractions_(speciesNames_.size(),NULL), //the value of molar fractions for every species
changeOfSpeciesMass_(speciesNames_.size(),NULL), //the values that are received from DEM with the name of Modified_+species name
changeOfSpeciesMassFields_(speciesNames_.size()), //the scalar fields generated with the values from Modified_+species names
changeOfGasMassField_ //the total change of Gas Mass field (when the Modified species
(
@ -89,18 +87,15 @@ species::species
tempFieldName_(propsDict_.lookupOrDefault<word>("tempFieldName","T")),
tempField_(sm.mesh().lookupObject<volScalarField> (tempFieldName_)),
partTempName_(propsDict_.lookupOrDefault<word>("partTempName","partTemp")),
partTemp_(NULL),
densityFieldName_(propsDict_.lookupOrDefault<word>("densityFieldName","rho")),
rho_(sm.mesh().lookupObject<volScalarField> (densityFieldName_)),
partRhoName_(propsDict_.lookupOrDefault<word>("partRhoName","partRho")),
partRho_(NULL),
voidfractionFieldName_(propsDict_.lookupOrDefault<word>("voidfractionFieldName","voidfraction")),
voidfraction_(sm.mesh().lookupObject<volScalarField>(voidfractionFieldName_)),
// total mole field
molarConcFieldName_(propsDict_.lookupOrDefault<word>("totalMoleFieldName","molarConc")),
molarConc_(sm.mesh().lookupObject<volScalarField>(molarConcFieldName_)),
partMolarConcName_(propsDict_.lookupOrDefault<word>("partMoleName","partMolarConc")),
partMolarConc_(NULL),
loopCounter_(-1),
Nevery_(propsDict_.lookupOrDefault<label>("Nevery",1)),
massSourceCurr_(0.0),
@ -108,56 +103,25 @@ species::species
initialized_(false)
{
particleCloud_.checkCG(false);
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(partTempName_,1);
particleCloud_.registerParticleProperty<double**>(partRhoName_,1);
particleCloud_.registerParticleProperty<double**>(partMolarConcName_,1);
for (int i=0; i<speciesNames_.size(); i++)
{
particleCloud_.registerParticleProperty<double**>("X_"+speciesNames_[i],1);
particleCloud_.registerParticleProperty<double**>("Modified_"+speciesNames_[i],1);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
species::~species()
{
particleCloud_.dataExchangeM().destroy(partTemp_,1);
particleCloud_.dataExchangeM().destroy(partRho_,1);
particleCloud_.dataExchangeM().destroy(partMolarConc_,1);
for (int i=0; i<speciesNames_.size();i++) particleCloud_.dataExchangeM().destroy(molarFractions_[i],1);
for (int i=0; i<speciesNames_.size();i++) particleCloud_.dataExchangeM().destroy(changeOfSpeciesMass_[i],1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void species::allocateMyArrays() const
{
double initVal=0.0;
if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0)
{
// get memory for 2d arrays
particleCloud_.dataExchangeM().allocateArray(partRho_,initVal,1,"nparticles");
particleCloud_.dataExchangeM().allocateArray(partTemp_,initVal,1,"nparticles");
particleCloud_.dataExchangeM().allocateArray(partMolarConc_,initVal,1,"nparticles");
for (int i=0; i<speciesNames_.size(); i++)
{
particleCloud_.dataExchangeM().allocateArray(molarFractions_[i],initVal,1,"nparticles");
particleCloud_.dataExchangeM().allocateArray(changeOfSpeciesMass_[i],initVal,1,"nparticles");
}
}
}
void species::reAllocMyArrays() const
{
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(partRho_,initVal,1);
particleCloud_.dataExchangeM().allocateArray(partTemp_,initVal,1);
particleCloud_.dataExchangeM().allocateArray(partMolarConc_,initVal,1);
for (int i=0; i<speciesNames_.size(); i++)
{
particleCloud_.dataExchangeM().allocateArray(molarFractions_[i],initVal,1);
particleCloud_.dataExchangeM().allocateArray(changeOfSpeciesMass_[i],initVal,1);
}
}
void species::init()
{
if(verbose_)
@ -219,8 +183,6 @@ void species::execute()
{
return;
}
// realloc the arrays
reAllocMyArrays();
// get X_i, T, rho at particle positions
label cellI = 0;
@ -235,6 +197,9 @@ void species::execute()
interpolationCellPoint <scalar> voidfractionInterpolator_(voidfraction_);
interpolationCellPoint <scalar> molarConcInterpolator_(molarConc_);
double**& partRho_ = particleCloud_.getParticlePropertyRef<double**>(partRhoName_);
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partMolarConc_ = particleCloud_.getParticlePropertyRef<double**>(partMolarConcName_);
for (int index=0; index<particleCloud_.numberOfParticles(); ++index)
{
@ -264,7 +229,8 @@ void species::execute()
for (int i=0; i<speciesNames_.size();i++)
{
// attention for indices when not communicating all species
molarFractions_[i][index][0] = X_[i][cellI];
double**& molarFractions_ = particleCloud_.getParticlePropertyRef<double**>("X_"+speciesNames_[i]);
molarFractions_[index][0] = X_[i][cellI];
}
}
}
@ -274,8 +240,9 @@ void species::execute()
{
for(int i =0; i<speciesNames_.size(); i++)
{
double**& molarFractions_ = particleCloud_.getParticlePropertyRef<double**>("X_"+speciesNames_[i]);
Info << "X_i = " << X_[i].name() << endl;
Info << "molarFractions_= " << molarFractions_[i][0][0] << endl;
Info << "molarFractions_= " << molarFractions_[0][0] << endl;
Info << "partRho_[index][0] = " << partRho_[0][0] << endl;
Info << "rhofluid = " << rhofluid << endl;
Info << "partTemp_[index][0] = " << partTemp_[0][0] << endl;
@ -292,7 +259,8 @@ void species::execute()
for (int i=0; i<speciesNames_.size();i++)
{
particleCloud_.dataExchangeM().giveData("X_"+speciesNames_[i],"scalar-atom",molarFractions_[i]);
double**& molarFractions_ = particleCloud_.getParticlePropertyRef<double**>("X_"+speciesNames_[i]);
particleCloud_.dataExchangeM().giveData("X_"+speciesNames_[i],"scalar-atom",molarFractions_);
}
if (verbose_) Info << "give data done" << endl;
@ -305,17 +273,18 @@ void species::execute()
changeOfGasMassField_.boundaryFieldRef() = 0.0;
for (int i=0; i<speciesNames_.size();i++)
{
double**& changeOfSpeciesMass_ = particleCloud_.getParticlePropertyRef<double**>("Modified_"+speciesNames_[i]);
changeOfSpeciesMassFields_[i].primitiveFieldRef() = 0.0;
changeOfSpeciesMassFields_[i].boundaryFieldRef() = 0.0;
particleCloud_.dataExchangeM().getData(mod_spec_names_[i],"scalar-atom",changeOfSpeciesMass_[i],particleCloud_.dataExchangeM().couplingInterval());
particleCloud_.dataExchangeM().getData(mod_spec_names_[i],"scalar-atom",changeOfSpeciesMass_,particleCloud_.dataExchangeM().couplingInterval());
if (verbose_) Info << "changeOfSpeciesMass received from DEM = " << changeOfSpeciesMass_[i][0][0] << endl;
if (verbose_) Info << "changeOfSpeciesMass received from DEM = " << changeOfSpeciesMass_[0][0] << endl;
particleCloud_.averagingM().setScalarSumCentre
(
changeOfSpeciesMassFields_[i],
changeOfSpeciesMass_[i],
changeOfSpeciesMass_,
particleCloud_.particleWeights(),
NULL
);

View File

@ -68,44 +68,32 @@ private:
UPtrList<volScalarField> X_;
mutable List<double**> molarFractions_;
mutable List<double**> changeOfSpeciesMass_;
PtrList<volScalarField> changeOfSpeciesMassFields_;
volScalarField changeOfGasMassField_;
word tempFieldName_;
const word tempFieldName_;
const volScalarField& tempField_; // ref to gas temperature field
word partTempName_;
const word partTempName_;
mutable double **partTemp_; // gas temperature at particle positions
word densityFieldName_;
const word densityFieldName_;
const volScalarField& rho_;
word partRhoName_;
const word partRhoName_;
mutable double **partRho_; // gas density at particle positions
word voidfractionFieldName_;
const word voidfractionFieldName_;
const volScalarField& voidfraction_;
void allocateMyArrays() const;
// total mole field
word molarConcFieldName_;
const word molarConcFieldName_;
const volScalarField& molarConc_;
word partMolarConcName_;
mutable double **partMolarConc_;
const word partMolarConcName_;
label loopCounter_;
@ -141,8 +129,6 @@ public:
// Member Functions
void execute();
void reAllocMyArrays() const;
tmp <volScalarField> Smi(const label i) const;
tmp <volScalarField> Sm() const;

View File

@ -129,31 +129,31 @@ public:
template <typename T>
void getData
(
word name,
word type,
const word& name,
const word& type,
T ** const& field
) const { getData(name,type,field,couplingStep_-1); }
virtual void getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const = 0;
virtual void getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label step
) const = 0;
virtual void giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype="double"
) const = 0;

View File

@ -78,24 +78,24 @@ public:
// Member Functions
void getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const {}
void getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label step
) const {}
void giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype = ""
) const {}

View File

@ -84,8 +84,8 @@ oneWayVTK::~oneWayVTK()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void oneWayVTK::getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const
@ -194,8 +194,8 @@ void oneWayVTK::getData
void oneWayVTK::giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype
) const

View File

@ -87,16 +87,16 @@ public:
// Member Functions
void getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const;
void getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label step
) const
@ -104,8 +104,8 @@ public:
void giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype = ""
) const;

View File

@ -80,7 +80,7 @@ twoWayFiles::~twoWayFiles()
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
fileName twoWayFiles::getFilePath(word& name, bool in) const
fileName twoWayFiles::getFilePath(const word& name, bool in) const
{
char timeStep[40];
@ -100,7 +100,7 @@ fileName twoWayFiles::getFilePath(word& name, bool in) const
return particleFilePathOld;
}
void twoWayFiles::renameFilePath(fileName& particleFilePathOld,word& name) const
void twoWayFiles::renameFilePath(const fileName& particleFilePathOld, const word& name) const
{
char timeStep[40];
@ -116,8 +116,8 @@ void twoWayFiles::renameFilePath(fileName& particleFilePathOld,word& name) const
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
void twoWayFiles::getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const
@ -164,8 +164,8 @@ void twoWayFiles::getData
void twoWayFiles::giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype
) const

View File

@ -65,9 +65,9 @@ private:
// private member functions
fileName getFilePath(word&, bool) const;
fileName getFilePath(const word&, bool) const;
void renameFilePath(fileName&,word&) const;
void renameFilePath(const fileName&, const word&) const;
public:
@ -92,24 +92,24 @@ public:
// Member Functions
void getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const;
void getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label step
) const { FatalError<<"function not implemented !!! twoWayFiles::getData!!!\n" << abort(FatalError); }
void giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype = ""
) const;

View File

@ -138,8 +138,8 @@ double twoWayMPI::DEMVariableValue(word variablename)
void twoWayMPI::getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label /*step*/
) const
@ -149,8 +149,8 @@ void twoWayMPI::getData
void twoWayMPI::getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label /*step*/
) const
@ -160,8 +160,8 @@ void twoWayMPI::getData
void twoWayMPI::giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype
) const

View File

@ -107,24 +107,24 @@ public:
// Member Functions
void getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const;
void getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label step
) const;
void giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype
) const;

View File

@ -6,7 +6,7 @@ SHELL = /bin/sh
CC = mpic++
CCFLAGS = -O2 -fPIC \
-funroll-loops -fstrict-aliasing -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-literal-suffix
-funroll-loops -fstrict-aliasing -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-literal-suffix -Wno-cast-function-type
DEPFLAGS = -M
LINK = mpic++
LINKFLAGS = -O -fPIC

View File

@ -178,8 +178,8 @@ twoWayMany2Many::~twoWayMany2Many()
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
void twoWayMany2Many::getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label /*step*/
) const
@ -231,8 +231,8 @@ void twoWayMany2Many::getData
void twoWayMany2Many::getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label /*step*/
) const
@ -242,8 +242,8 @@ void twoWayMany2Many::getData
void twoWayMany2Many::giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* /*datatype*/
) const

View File

@ -157,24 +157,24 @@ public:
// Member Functions
void getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const;
void getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label step
) const;
void giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype
) const;

View File

@ -253,8 +253,8 @@ twoWayOne2One::~twoWayOne2One()
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
void twoWayOne2One::getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label /*step*/
) const
@ -361,8 +361,8 @@ void twoWayOne2One::getData
void twoWayOne2One::getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label /*step*/
) const
@ -383,8 +383,8 @@ void twoWayOne2One::getData
void twoWayOne2One::giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype
) const

View File

@ -152,24 +152,24 @@ public:
// Member Functions
void getData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
label step
) const;
void getData
(
word name,
word type,
const word& name,
const word& type,
int ** const& field,
label step
) const;
void giveData
(
word name,
word type,
const word& name,
const word& type,
double ** const& field,
const char* datatype
) const;

View File

@ -49,7 +49,8 @@ heatTransferGranConduction::heatTransferGranConduction
totalHeatFlux_(0.0),
QPartPartName_(propsDict_.lookupOrDefault<word>("QPartPartName","QPartPart")),
QPartPart_
( IOobject
(
IOobject
(
QPartPartName_,
sm.mesh().time().timeName(),
@ -94,11 +95,11 @@ heatTransferGranConduction::heatTransferGranConduction
voidfractionFieldName_(propsDict_.lookupOrDefault<word>("voidfractionFieldName","voidfraction")),
voidfraction_(sm.mesh().lookupObject<volScalarField> (voidfractionFieldName_)),
partHeatFluxName_(propsDict_.lookupOrDefault<word>("partHeatFluxName","conductiveHeatFlux")),
partHeatFlux_(NULL),
typePartThermCond_(propsDict_.lookupOrDefault<scalarList>("thermalConductivities",scalarList(1,-1.0))),
partThermCond_(NULL)
partThermCondRegName_(typeName + "partThermCond")
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_,1);
particleCloud_.registerParticleProperty<double**>(partThermCondRegName_,1);
if (typePartThermCond_[0] < 0.0)
{
@ -127,25 +128,13 @@ heatTransferGranConduction::heatTransferGranConduction
heatTransferGranConduction::~heatTransferGranConduction()
{
particleCloud_.dataExchangeM().destroy(partHeatFlux_,1);
particleCloud_.dataExchangeM().destroy(partThermCond_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void heatTransferGranConduction::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(partHeatFlux_,initVal,1);
particleCloud_.dataExchangeM().allocateArray(partThermCond_,initVal,1);
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
void heatTransferGranConduction::calcEnergyContribution()
{
// realloc the arrays
allocateMyArrays();
calcPartEffThermCond();
QPartPart_ = fvc::laplacian(partEffThermCondField_,partTempField_);
@ -156,6 +145,7 @@ void heatTransferGranConduction::calcEnergyContribution()
scalar voidfraction(1);
totalHeatFlux_ = 0.0;
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)
{
@ -199,6 +189,8 @@ void heatTransferGranConduction::calcPartThermCond()
{
label cellI=0;
label partType = 1;
double**& partThermCond_ = particleCloud_.getParticlePropertyRef<double**>(partThermCondRegName_);
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)
{
cellI = particleCloud_.cellIDs()[index][0];
@ -227,6 +219,7 @@ void heatTransferGranConduction::calcPartThermCond()
void heatTransferGranConduction::heatFlux(label index, scalar vol, scalar voidfraction, scalar QPartPart)
{
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
partHeatFlux_[index][0] = vol * QPartPart / (1.0 - voidfraction) ;
}
@ -238,6 +231,7 @@ void heatTransferGranConduction::giveData()
Info << "total conductive particle-particle heat flux [W] (Eulerian) = " << totalHeatFlux_ << endl;
}
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
particleCloud_.dataExchangeM().giveData(partHeatFluxName_,"scalar-atom", partHeatFlux_);
}

View File

@ -54,7 +54,7 @@ protected:
scalar totalHeatFlux_;
word QPartPartName_;
const word QPartPartName_;
volScalarField QPartPart_;
@ -64,23 +64,19 @@ protected:
const volScalarField& partTempField_;
word prescribedVoidfractionFieldName_;
const word prescribedVoidfractionFieldName_;
const volScalarField& prescribedVoidfraction_;
word voidfractionFieldName_;
const word voidfractionFieldName_;
const volScalarField& voidfraction_;
word partHeatFluxName_;
mutable double **partHeatFlux_;
const word partHeatFluxName_;
scalarList typePartThermCond_;
mutable double **partThermCond_;
void allocateMyArrays() const;
const word partThermCondRegName_;
void calcPartEffThermCond();

View File

@ -143,17 +143,25 @@ heatTransferGunn::heatTransferGunn
densityFieldName_(propsDict_.lookupOrDefault<word>("densityFieldName","rho")),
rho_(sm.mesh().lookupObject<volScalarField> (densityFieldName_)),
partTempName_(propsDict_.lookup("partTempName")),
partTemp_(NULL),
partHeatFluxName_(propsDict_.lookupOrDefault<word>("partHeatFluxName","convectiveHeatFlux")),
partHeatFlux_(NULL),
partHeatFluxCoeff_(NULL),
partRe_(NULL),
partNu_(NULL),
partHeatFluxCoeffRegName_(typeName + "partHeatFluxCoeff"),
partReRegName_(typeName + "partRe"),
partNuRegName_(typeName + "partNu"),
scaleDia_(1.),
typeCG_(propsDict_.lookupOrDefault<scalarList>("coarseGrainingFactors",scalarList(1,1.0))),
maxTypeCG_(typeCG_.size())
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(partTempName_,1);
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_,1);
if (implicit_)
{
particleCloud_.registerParticleProperty<double**>(partHeatFluxCoeffRegName_,1);
}
if(verbose_)
{
particleCloud_.registerParticleProperty<double**>(partReRegName_,1);
particleCloud_.registerParticleProperty<double**>(partNuRegName_,1);
}
if (propsDict_.found("NusseltScalingFactor"))
{
@ -226,41 +234,16 @@ heatTransferGunn::heatTransferGunn
heatTransferGunn::~heatTransferGunn()
{
particleCloud_.dataExchangeM().destroy(partTemp_,1);
particleCloud_.dataExchangeM().destroy(partHeatFlux_,1);
particleCloud_.dataExchangeM().destroy(partRe_,1);
particleCloud_.dataExchangeM().destroy(partNu_,1);
if (implicit_)
{
particleCloud_.dataExchangeM().destroy(partHeatFluxCoeff_,1);
}
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void heatTransferGunn::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(partTemp_,initVal,1); // field/initVal/with/lenghtFromLigghts
particleCloud_.dataExchangeM().allocateArray(partHeatFlux_,initVal,1);
if(implicit_)
{
particleCloud_.dataExchangeM().allocateArray(partHeatFluxCoeff_,initVal,1);
}
if(verbose_)
{
particleCloud_.dataExchangeM().allocateArray(partRe_,initVal,1);
particleCloud_.dataExchangeM().allocateArray(partNu_,initVal,1);
}
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
void heatTransferGunn::calcEnergyContribution()
{
// realloc the arrays
allocateMyArrays();
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
// reset Scalar field
QPartFluid_.primitiveFieldRef() = 0.0;
@ -387,6 +370,8 @@ void heatTransferGunn::calcEnergyContribution()
if(verbose_)
{
double**& partRe_ = particleCloud_.getParticlePropertyRef<double**>(partReRegName_);
double**& partNu_ = particleCloud_.getParticlePropertyRef<double**>(partNuRegName_);
partRe_[index][0] = Rep;
partNu_[index][0] = Nup;
}
@ -433,6 +418,7 @@ void heatTransferGunn::calcEnergyContribution()
if(implicit_)
{
double**& partHeatFluxCoeff_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxCoeffRegName_);
QPartFluidCoeff_.primitiveFieldRef() = 0.0;
particleCloud_.averagingM().setScalarSum
@ -448,6 +434,8 @@ void heatTransferGunn::calcEnergyContribution()
if(verbose_)
{
double**& partRe_ = particleCloud_.getParticlePropertyRef<double**>(partReRegName_);
double**& partNu_ = particleCloud_.getParticlePropertyRef<double**>(partNuRegName_);
ReField_.primitiveFieldRef() = 0.0;
NuField_.primitiveFieldRef() = 0.0;
particleCloud_.averagingM().resetWeightFields();
@ -515,6 +503,8 @@ scalar heatTransferGunn::Nusselt(scalar voidfraction, scalar Rep, scalar Pr) con
void heatTransferGunn::heatFlux(label index, scalar h, scalar As, scalar Tfluid, scalar cg3)
{
scalar hAs = h * As * cg3;
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
if (particleCloud_.getParticleEffVolFactors())
{
@ -529,6 +519,7 @@ void heatTransferGunn::heatFlux(label index, scalar h, scalar As, scalar Tfluid,
}
else
{
double**& partHeatFluxCoeff_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxCoeffRegName_);
partHeatFluxCoeff_[index][0] = hAs;
}
}
@ -541,6 +532,7 @@ void heatTransferGunn::giveData()
reduce(totalHeatFlux_, sumOp<scalar>());
Info << "total convective particle-fluid heat flux [W] = " << totalHeatFlux_ << endl;
}
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
particleCloud_.dataExchangeM().giveData(partHeatFluxName_,"scalar-atom", partHeatFlux_);
}
@ -552,6 +544,9 @@ void heatTransferGunn::postFlow()
scalar Tfluid(0.0);
scalar Tpart(0.0);
interpolationCellPoint<scalar> TInterpolator_(tempField_);
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
double**& partHeatFluxCoeff_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxCoeffRegName_);
totalHeatFlux_ = 0.0;
@ -585,6 +580,7 @@ void heatTransferGunn::postFlow()
void heatTransferGunn::partTempField()
{
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
partTempField_.primitiveFieldRef() = 0.0;
particleCloud_.averagingM().resetWeightFields();
particleCloud_.averagingM().setScalarAverage
@ -607,6 +603,8 @@ void heatTransferGunn::initPartTemp()
{
label cellI = 0;
scalar T = 0.0;
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)
{
cellI = particleCloud_.cellIDs()[index][0];

View File

@ -68,11 +68,11 @@ protected:
scalar NusseltScalingFactor_;
word QPartFluidName_;
const word QPartFluidName_;
volScalarField QPartFluid_;
word QPartFluidCoeffName_;
const word QPartFluidCoeffName_;
volScalarField QPartFluidCoeff_;
@ -90,37 +90,33 @@ protected:
dimensionedScalar partTempAve_;
word tempFieldName_;
const word tempFieldName_;
const volScalarField& tempField_; // ref to temperature field
word voidfractionFieldName_;
const word voidfractionFieldName_;
const volScalarField& voidfraction_; // ref to voidfraction field
scalar maxSource_; // max (limited) value of src field
word velFieldName_;
const word velFieldName_;
const volVectorField& U_;
word densityFieldName_;
const word densityFieldName_;
const volScalarField& rho_;
word partTempName_;
const word partTempName_;
mutable double **partTemp_;
const word partHeatFluxName_;
word partHeatFluxName_;
const word partHeatFluxCoeffRegName_;
mutable double **partHeatFlux_;
const word partReRegName_;
mutable double **partHeatFluxCoeff_;
mutable double **partRe_;
mutable double **partNu_;
const word partNuRegName_;
mutable scalar scaleDia_;
@ -128,8 +124,6 @@ protected:
const label maxTypeCG_;
void allocateMyArrays() const;
void partTempField();
scalar Nusselt(scalar, scalar, scalar) const;

View File

@ -142,17 +142,25 @@ heatTransferRanzMarshall::heatTransferRanzMarshall
densityFieldName_(propsDict_.lookupOrDefault<word>("densityFieldName","rho")),
rho_(sm.mesh().lookupObject<volScalarField> (densityFieldName_)),
partTempName_(propsDict_.lookup("partTempName")),
partTemp_(NULL),
partHeatFluxName_(propsDict_.lookupOrDefault<word>("partHeatFluxName","convectiveHeatFlux")),
partHeatFlux_(NULL),
partHeatFluxCoeff_(NULL),
partRe_(NULL),
partNu_(NULL),
partHeatFluxCoeffRegName_(typeName + "partHeatFluxCoeff"),
partReRegName_(typeName + "partRe"),
partNuRegName_(typeName + "partNu"),
scaleDia_(1.),
typeCG_(propsDict_.lookupOrDefault<scalarList>("coarseGrainingFactors",scalarList(1,1.0))),
maxTypeCG_(typeCG_.size())
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(partTempName_,1);
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_,1);
if (implicit_)
{
particleCloud_.registerParticleProperty<double**>(partHeatFluxCoeffRegName_,1);
}
if(verbose_)
{
particleCloud_.registerParticleProperty<double**>(partReRegName_,1);
particleCloud_.registerParticleProperty<double**>(partNuRegName_,1);
}
if (propsDict_.found("NusseltScalingFactor"))
{
@ -225,41 +233,16 @@ heatTransferRanzMarshall::heatTransferRanzMarshall
heatTransferRanzMarshall::~heatTransferRanzMarshall()
{
particleCloud_.dataExchangeM().destroy(partTemp_,1);
particleCloud_.dataExchangeM().destroy(partHeatFlux_,1);
particleCloud_.dataExchangeM().destroy(partRe_,1);
particleCloud_.dataExchangeM().destroy(partNu_,1);
if (implicit_)
{
particleCloud_.dataExchangeM().destroy(partHeatFluxCoeff_,1);
}
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void heatTransferRanzMarshall::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(partTemp_,initVal,1); // field/initVal/with/lenghtFromLigghts
particleCloud_.dataExchangeM().allocateArray(partHeatFlux_,initVal,1);
if(implicit_)
{
particleCloud_.dataExchangeM().allocateArray(partHeatFluxCoeff_,initVal,1);
}
if(verbose_)
{
particleCloud_.dataExchangeM().allocateArray(partRe_,initVal,1);
particleCloud_.dataExchangeM().allocateArray(partNu_,initVal,1);
}
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
void heatTransferRanzMarshall::calcEnergyContribution()
{
// realloc the arrays
allocateMyArrays();
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
// reset Scalar field
QPartFluid_.primitiveFieldRef() = 0.0;
@ -387,6 +370,8 @@ void heatTransferRanzMarshall::calcEnergyContribution()
if(verbose_)
{
double**& partRe_ = particleCloud_.getParticlePropertyRef<double**>(partReRegName_);
double**& partNu_ = particleCloud_.getParticlePropertyRef<double**>(partNuRegName_);
partRe_[index][0] = Rep;
partNu_[index][0] = Nup;
}
@ -427,6 +412,7 @@ void heatTransferRanzMarshall::calcEnergyContribution()
if(implicit_)
{
double**& partHeatFluxCoeff_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxCoeffRegName_);
QPartFluidCoeff_.primitiveFieldRef() = 0.0;
particleCloud_.averagingM().setScalarSum
@ -442,6 +428,8 @@ void heatTransferRanzMarshall::calcEnergyContribution()
if(verbose_)
{
double**& partRe_ = particleCloud_.getParticlePropertyRef<double**>(partReRegName_);
double**& partNu_ = particleCloud_.getParticlePropertyRef<double**>(partNuRegName_);
ReField_.primitiveFieldRef() = 0.0;
NuField_.primitiveFieldRef() = 0.0;
particleCloud_.averagingM().resetWeightFields();
@ -503,6 +491,8 @@ scalar heatTransferRanzMarshall::Nusselt(scalar voidfraction, scalar Rep, scalar
void heatTransferRanzMarshall::heatFlux(label index, scalar h, scalar As, scalar Tfluid, scalar cg3)
{
scalar hAs = h * As * cg3;
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
if (particleCloud_.getParticleEffVolFactors())
{
@ -517,6 +507,7 @@ void heatTransferRanzMarshall::heatFlux(label index, scalar h, scalar As, scalar
}
else
{
double**& partHeatFluxCoeff_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxCoeffRegName_);
partHeatFluxCoeff_[index][0] = hAs;
}
}
@ -529,6 +520,7 @@ void heatTransferRanzMarshall::giveData()
reduce(totalHeatFlux_, sumOp<scalar>());
Info << "total convective particle-fluid heat flux [W] = " << totalHeatFlux_ << endl;
}
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
particleCloud_.dataExchangeM().giveData(partHeatFluxName_,"scalar-atom", partHeatFlux_);
}
@ -540,6 +532,9 @@ void heatTransferRanzMarshall::postFlow()
scalar Tfluid(0.0);
scalar Tpart(0.0);
interpolationCellPoint<scalar> TInterpolator_(tempField_);
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
double**& partHeatFluxCoeff_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxCoeffRegName_);
totalHeatFlux_ = 0.0;
@ -573,6 +568,7 @@ void heatTransferRanzMarshall::postFlow()
void heatTransferRanzMarshall::partTempField()
{
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
partTempField_.primitiveFieldRef() = 0.0;
particleCloud_.averagingM().resetWeightFields();
particleCloud_.averagingM().setScalarAverage
@ -595,6 +591,8 @@ void heatTransferRanzMarshall::initPartTemp()
{
label cellI = 0;
scalar T = 0.0;
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)
{
cellI = particleCloud_.cellIDs()[index][0];

View File

@ -67,11 +67,11 @@ protected:
scalar NusseltScalingFactor_;
word QPartFluidName_;
const word QPartFluidName_;
volScalarField QPartFluid_;
word QPartFluidCoeffName_;
const word QPartFluidCoeffName_;
volScalarField QPartFluidCoeff_;
@ -89,37 +89,33 @@ protected:
dimensionedScalar partTempAve_;
word tempFieldName_;
const word tempFieldName_;
const volScalarField& tempField_; // ref to temperature field
word voidfractionFieldName_;
const word voidfractionFieldName_;
const volScalarField& voidfraction_; // ref to voidfraction field
scalar maxSource_; // max (limited) value of src field
word velFieldName_;
const word velFieldName_;
const volVectorField& U_;
word densityFieldName_;
const word densityFieldName_;
const volScalarField& rho_;
word partTempName_;
const word partTempName_;
mutable double **partTemp_;
const word partHeatFluxName_;
word partHeatFluxName_;
const word partHeatFluxCoeffRegName_;
mutable double **partHeatFlux_;
const word partReRegName_;
mutable double **partHeatFluxCoeff_;
mutable double **partRe_;
mutable double **partNu_;
const word partNuRegName_;
mutable scalar scaleDia_;
@ -127,8 +123,6 @@ protected:
const label maxTypeCG_;
void allocateMyArrays() const;
void partTempField();
scalar Nusselt(scalar, scalar, scalar) const;

View File

@ -50,7 +50,6 @@ reactionHeat::reactionHeat
mesh_(sm.mesh()),
maxSource_(1e30),
reactionHeatName_(propsDict_.lookupOrDefault<word>("reactionHeatName","reactionHeat")),
reactionHeat_(NULL),
reactionHeatField_
(
IOobject
@ -65,7 +64,7 @@ reactionHeat::reactionHeat
dimensionedScalar("zero", dimensionSet(1,-1,-3,0,0,0,0),0.0)
)
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(reactionHeatName_,1);
if(propsDict_.found("maxsource"))
{
@ -79,23 +78,15 @@ reactionHeat::reactionHeat
reactionHeat::~reactionHeat()
{
particleCloud_.dataExchangeM().destroy(reactionHeat_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void reactionHeat::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(reactionHeat_,initVal,1);
}
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
void reactionHeat::calcEnergyContribution()
{
// realloc the arrays
allocateMyArrays();
double**& reactionHeat_ = particleCloud_.getParticlePropertyRef<double**>(reactionHeatName_);
particleCloud_.dataExchangeM().getData(reactionHeatName_,"scalar-atom",reactionHeat_);

View File

@ -56,12 +56,8 @@ protected:
word reactionHeatName_;
mutable double **reactionHeat_;
volScalarField reactionHeatField_;
void allocateMyArrays() const;
public:
//- Runtime type information

View File

@ -74,8 +74,8 @@ KochHillRWDrag::KochHillRWDrag
interpolation_(propsDict_.found("interpolation")),
scale_(1.),
randomTauE_(propsDict_.found("randomTauE")),
partTime_(NULL),
partUfluct_(NULL),
partTimeRegName_(typeName + "partTime"),
partUfluctRegName_(typeName + "partUfluct"),
RanGen_(label(0))
{
@ -99,16 +99,8 @@ KochHillRWDrag::KochHillRWDrag
if (propsDict_.found("rhoP"))
rhoP_= readScalar(propsDict_.lookup("rhoP"));
// if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0)
// {
//allocate memory
particleCloud_.dataExchangeM().allocateArray(partTime_,0.,1);
particleCloud_.dataExchangeM().allocateArray(partUfluct_,0.,3);
// }
//Pout << "RW-TEST: maxNumberOfParticles() == " << particleCloud_.dataExchangeM().maxNumberOfParticles() << endl; // TEST-Output
particleCloud_.registerParticleProperty<double**>(partTimeRegName_,1,0.0,false);
particleCloud_.registerParticleProperty<double**>(partUfluctRegName_,3,0.0,false);
}
@ -116,18 +108,12 @@ KochHillRWDrag::KochHillRWDrag
KochHillRWDrag::~KochHillRWDrag()
{
particleCloud_.dataExchangeM().destroy(partTime_, 1);
particleCloud_.dataExchangeM().destroy(partUfluct_, 3);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void KochHillRWDrag::setForce() const
{
// realloc the arrays
reAllocArrays();
if (scale_ > 1.0)
{
Info << "KochHillRW using scale = " << scale_ << endl;
@ -189,6 +175,9 @@ void KochHillRWDrag::setForce() const
interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_);
interpolationCellPoint<vector> UInterpolator_(U_);
double**& partTime_ = particleCloud_.getParticlePropertyRef<double**>(partTimeRegName_);
double**& partUfluct_ = particleCloud_.getParticlePropertyRef<double**>(partUfluctRegName_);
//Info << "RW-TEST: We are in setForce() at t = " << t << endl; // TEST-Output
for (int index = 0; index<particleCloud_.numberOfParticles(); ++index)
@ -382,16 +371,6 @@ void KochHillRWDrag::setForce() const
}
void KochHillRWDrag::reAllocArrays() const
{
if (particleCloud_.numberOfParticlesChanged())
{
particleCloud_.dataExchangeM().allocateArray(partTime_,0.0,1); // field/initVal/with/lenghtFromLigghts
particleCloud_.dataExchangeM().allocateArray(partUfluct_,0.0,3);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -89,9 +89,9 @@ private:
const bool randomTauE_;
mutable double **partTime_; // Lagrangian array
const word partTimeRegName_;
mutable double **partUfluct_; // Lagrangian array
const word partUfluctRegName_;
mutable Random RanGen_;
@ -117,8 +117,6 @@ public:
// Member Functions
void setForce() const;
void reAllocArrays() const;
};

View File

@ -71,14 +71,10 @@ LaEuScalarTemp::LaEuScalarTemp
velFieldName_(propsDict_.lookup("velFieldName")),
U_(sm.mesh().lookupObject<volVectorField> (velFieldName_)),
partTempName_(propsDict_.lookup("partTempName")),
partTemp_(NULL),
partHeatFluxName_(propsDict_.lookup("partHeatFluxName")),
partHeatFlux_(NULL),
lambda_(readScalar(propsDict_.lookup("lambda"))),
Cp_(readScalar(propsDict_.lookup("Cp")))
{
allocateMyArrays();
if (propsDict_.found("maxSource"))
{
maxSource_=readScalar(propsDict_.lookup ("maxSource"));
@ -96,8 +92,10 @@ LaEuScalarTemp::LaEuScalarTemp
// read those switches defined above, if provided in dict
forceSubM(0).readSwitches();
particleCloud_.checkCG(false);
particleCloud_.registerParticleProperty<double**>(partTempName_);
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_);
}
@ -105,8 +103,6 @@ LaEuScalarTemp::LaEuScalarTemp
LaEuScalarTemp::~LaEuScalarTemp()
{
particleCloud_.dataExchangeM().destroy(partTemp_,1);
particleCloud_.dataExchangeM().destroy(partHeatFlux_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
@ -114,6 +110,9 @@ void LaEuScalarTemp::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal = 0.0;
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
particleCloud_.dataExchangeM().allocateArray(partTemp_,initVal,1); // field/initVal/with/lenghtFromLigghts
particleCloud_.dataExchangeM().allocateArray(partHeatFlux_,initVal,1);
}
@ -128,6 +127,8 @@ void LaEuScalarTemp::manipulateScalarField(volScalarField& EuField) const
{
// realloc the arrays
allocateMyArrays();
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
// reset Scalar field
EuField.primitiveFieldRef() = 0.0;

View File

@ -81,12 +81,8 @@ private:
word partTempName_;
mutable double **partTemp_; // Lagrangian array
word partHeatFluxName_;
mutable double **partHeatFlux_; // Lagrangian array
scalar lambda_; // fluid thermal conductivity [W/(m*K)]
scalar Cp_; // specific heat capacity [W*s/(kg*K)]

View File

@ -54,8 +54,8 @@ dSauter::dSauter
forceModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
multiTypes_(false),
d2_(NULL),
d3_(NULL),
d2RegName_(typeName + "d2"),
d3RegName_(typeName + "d3"),
maxTypeCG_(1),
typeCG_(propsDict_.lookupOrDefault<scalarList>("coarseGrainingFactors",scalarList(1,1.0))),
d2Field_
@ -101,9 +101,11 @@ dSauter::dSauter
multiTypes_ = true;
maxTypeCG_ = typeCG_.size();
}
allocateMyArrays();
dSauter_.write();
particleCloud_.registerParticleProperty<double**>(d2RegName_,1);
particleCloud_.registerParticleProperty<double**>(d3RegName_,1);
dSauter_.write();
// init force sub model
setForceSubModels(propsDict_);
@ -114,19 +116,10 @@ dSauter::dSauter
dSauter::~dSauter()
{
particleCloud_.dataExchangeM().destroy(d2_,1);
particleCloud_.dataExchangeM().destroy(d3_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void dSauter::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal = 0.0;
particleCloud_.dataExchangeM().allocateArray(d2_,initVal,1); // field/initVal/with/lenghtFromLigghts
particleCloud_.dataExchangeM().allocateArray(d3_,initVal,1);
}
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
@ -137,7 +130,8 @@ void dSauter::setForce() const
Info << "dSauter using CG factor(s) = " << typeCG_ << endl;
}
allocateMyArrays();
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>(d2RegName_);
double**& d3_ = particleCloud_.getParticlePropertyRef<double**>(d3RegName_);
label cellI = 0;
label partType = 1;

View File

@ -45,9 +45,9 @@ private:
bool multiTypes_;
mutable double **d2_;
const word d2RegName_;
mutable double **d3_;
const word d3RegName_;
label maxTypeCG_;
@ -59,8 +59,6 @@ private:
mutable volScalarField dSauter_;
void allocateMyArrays() const;
public:
//- Runtime type information

View File

@ -53,7 +53,7 @@ granKineticEnergy::granKineticEnergy
:
forceModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
vfluc_(NULL),
vflucRegName_(typeName + "vfluc_mag"),
UsFieldName_(propsDict_.lookup("granVelFieldName")),
UsField_(sm.mesh().lookupObject<volVectorField> (UsFieldName_)),
granKineticEnergy_
@ -70,7 +70,7 @@ granKineticEnergy::granKineticEnergy
"zeroGradient"
)
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(vflucRegName_,1);
granKineticEnergy_.write();
@ -82,21 +82,14 @@ granKineticEnergy::granKineticEnergy
granKineticEnergy::~granKineticEnergy()
{
particleCloud_.dataExchangeM().destroy(vfluc_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void granKineticEnergy::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal = 0.0;
particleCloud_.dataExchangeM().allocateArray(vfluc_,initVal,1);
}
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
void granKineticEnergy::setForce() const
{
allocateMyArrays();
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>(vflucRegName_);
label cellI = 0;
vector velfluc(0,0,0);

View File

@ -43,16 +43,14 @@ private:
dictionary propsDict_;
mutable double **vfluc_;
const word vflucRegName_;
word UsFieldName_;
const word UsFieldName_;
const volVectorField& UsField_;
mutable volScalarField granKineticEnergy_;
void allocateMyArrays() const;
public:
//- Runtime type information

View File

@ -60,9 +60,9 @@ particleDeformation::particleDeformation
partTypes_(propsDict_.lookupOrDefault<labelList>("partTypes",labelList(1,-1))),
lowerBounds_(propsDict_.lookupOrDefault<scalarList>("lowerBounds",scalarList(1,-1.0))),
upperBounds_(propsDict_.lookupOrDefault<scalarList>("upperBounds",scalarList(1,-1.0))),
partDeformations_(NULL)
partDeformationsName_("partDeformations")
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(partDeformationsName_,1);
// init force sub model
setForceSubModels(propsDict_);
@ -120,16 +120,9 @@ particleDeformation::particleDeformation
particleDeformation::~particleDeformation()
{
particleCloud_.dataExchangeM().destroy(partDeformations_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void particleDeformation::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal = 0.0;
particleCloud_.dataExchangeM().allocateArray(partDeformations_,initVal,1);
}
bool particleDeformation::defaultDeformCell(label cell) const
{
@ -145,8 +138,8 @@ void particleDeformation::setForce() const
init();
initialExec_ = false;
}
// realloc the arrays
allocateMyArrays();
double**& partDeformations_ = particleCloud_.getParticlePropertyRef<double**>(partDeformationsName_);
label cellI = 0;
label partType = -1;
@ -204,7 +197,7 @@ void particleDeformation::setForce() const
}
// give DEM data
particleCloud_.dataExchangeM().giveData("partDeformations","scalar-atom", partDeformations_);
particleCloud_.dataExchangeM().giveData(partDeformationsName_,"scalar-atom", partDeformations_);
}
void particleDeformation::init() const

View File

@ -55,12 +55,12 @@ private:
mutable bool initialExec_;
word refFieldName_;
const word refFieldName_;
mutable autoPtr<volScalarField> refField_;
// default deformation in region
word defaultDeformCellsName_;
const word defaultDeformCellsName_;
autoPtr<cellSet> defaultDeformCells_;
@ -74,12 +74,10 @@ private:
scalarList upperBounds_;
mutable double **partDeformations_;
const word partDeformationsName_;
label getListIndex(label) const;
void allocateMyArrays() const;
void init() const;
bool defaultDeformCell(label) const;

View File

@ -55,11 +55,11 @@ pdCorrelation::pdCorrelation
:
forceModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
d_(nullptr),
p_(nullptr),
d2_(nullptr),
pd_(nullptr),
cg3_(nullptr),
dRegName_(typeName + "d"),
pRegName_(typeName + "p"),
d2RegName_(typeName + "d2"),
pdRegName_(typeName + "pd"),
cg3RegName_(typeName + "cg3"),
dField_
( IOobject
(
@ -151,7 +151,11 @@ pdCorrelation::pdCorrelation
<< abort(FatalError);
}
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(dRegName_,1);
particleCloud_.registerParticleProperty<double**>(pRegName_,3);
particleCloud_.registerParticleProperty<double**>(d2RegName_,1);
particleCloud_.registerParticleProperty<double**>(pdRegName_,3);
particleCloud_.registerParticleProperty<double**>(cg3RegName_,1);
dField_.write();
pdField_.write();
@ -165,24 +169,9 @@ pdCorrelation::pdCorrelation
pdCorrelation::~pdCorrelation()
{
particleCloud_.dataExchangeM().destroy(cg3_, 1);
particleCloud_.dataExchangeM().destroy(d_, 1);
particleCloud_.dataExchangeM().destroy(p_, 3);
particleCloud_.dataExchangeM().destroy(d2_, 1);
particleCloud_.dataExchangeM().destroy(pd_, 3);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void pdCorrelation::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal = 0.0;
particleCloud_.dataExchangeM().allocateArray(d_, initVal, 1);
particleCloud_.dataExchangeM().allocateArray(p_, initVal, 3);
particleCloud_.dataExchangeM().allocateArray(d2_, initVal, 1);
particleCloud_.dataExchangeM().allocateArray(pd_, initVal, 3);
particleCloud_.dataExchangeM().allocateArray(cg3_, initVal, 1);
}
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
void pdCorrelation::setForce() const
@ -191,7 +180,11 @@ void pdCorrelation::setForce() const
if (runOnWriteOnly_ && !mesh.write()) return; // skip if it's not write time
allocateMyArrays();
double**& d_ = particleCloud_.getParticlePropertyRef<double**>(dRegName_);
double**& p_ = particleCloud_.getParticlePropertyRef<double**>(pRegName_);
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>(d2RegName_);
double**& pd_ = particleCloud_.getParticlePropertyRef<double**>(pdRegName_);
double**& cg3_ = particleCloud_.getParticlePropertyRef<double**>(cg3RegName_);
const Switch densityFromList
(

View File

@ -45,11 +45,11 @@ private:
dictionary propsDict_;
mutable double **d_;
mutable double **p_;
mutable double **d2_;
mutable double **pd_;
mutable double **cg3_;
const word dRegName_;
const word pRegName_;
const word d2RegName_;
const word pdRegName_;
const word cg3RegName_;
mutable volScalarField dField_;
mutable volVectorField pField_;
@ -65,8 +65,6 @@ private:
const Switch CG_;
const Switch runOnWriteOnly_;
void allocateMyArrays() const;
public:
//- Runtime type information

View File

@ -83,9 +83,9 @@ potentialRelaxation::potentialRelaxation
ignoreReg_(propsDict_.lookupOrDefault<bool>("ignoreRegion",false)),
ignoreDirection_(propsDict_.lookupOrDefault<vector>("ignoreDirection",vector::zero)),
ignorePoint_(propsDict_.lookupOrDefault<vector>("ignorePoint",vector::zero)),
vfluc_(NULL)
vflucName_("vfluc")
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>(vflucName_,3);
if(ignoreReg_)
{
@ -103,31 +103,22 @@ potentialRelaxation::potentialRelaxation
potentialRelaxation::~potentialRelaxation()
{
delete vfluc_;
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
void potentialRelaxation::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(vfluc_,initVal,3);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void potentialRelaxation::setForce() const
{
relax(D0_,D1_);
volVectorField relaxStream = -fvc::grad(correctedField_);
// volVectorField relaxStream = DField_ * fvc::grad(voidfraction_ - voidfractionRec_);
// realloc the arrays
allocateMyArrays();
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>(vflucName_);
vector position(0,0,0);
scalar voidfraction(0.0);
@ -184,7 +175,7 @@ void potentialRelaxation::setForce() const
}
}
particleCloud_.dataExchangeM().giveData("vfluc","vector-atom", vfluc_);
particleCloud_.dataExchangeM().giveData(vflucName_,"vector-atom", vfluc_);
if (measureDiff_)
{

View File

@ -51,11 +51,11 @@ private:
mutable OFstream recErrorFile_;
word voidfractionFieldName_;
const word voidfractionFieldName_;
const volScalarField& voidfraction_;
word voidfractionRecFieldName_;
const word voidfractionRecFieldName_;
const volScalarField& voidfractionRec_;
@ -78,9 +78,7 @@ private:
vector ignorePoint_;
mutable double **vfluc_; // Lagrangian array
void allocateMyArrays() const;
const word vflucName_;
void relax(scalar, scalar) const;

View File

@ -0,0 +1,256 @@
/*---------------------------------------------------------------------------*\
CFDEMcoupling academic - Open Source CFD-DEM coupling
Contributing authors:
Thomas Lichtenegger
Copyright (C) 2015- Johannes Kepler University, Linz
-------------------------------------------------------------------------------
License
This file is part of CFDEMcoupling academic.
CFDEMcoupling academic is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CFDEMcoupling academic is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with CFDEMcoupling academic. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "turbulentDispersion.H"
#include "addToRunTimeSelectionTable.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(turbulentDispersion, 0);
addToRunTimeSelectionTable
(
forceModel,
turbulentDispersion,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
turbulentDispersion::turbulentDispersion
(
const dictionary& dict,
cfdemCloud& sm,
word type
)
:
forceModel(dict,sm),
propsDict_(dict.subDict(type + "Props")),
interpolate_(propsDict_.lookupOrDefault<bool>("interpolation", false)),
mesh_(sm.mesh()),
ignoreCellsName_(propsDict_.lookupOrDefault<word>("ignoreCellsName","none")),
ignoreCells_(),
existIgnoreCells_(true),
wallIndicatorField_
( IOobject
(
"wallIndicator",
sm.mesh().time().timeName(),
sm.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
sm.mesh(),
dimensionedScalar("zero", dimensionSet(0,0,0,0,0,0,0), 0.0)
),
minTurbKineticEnergy_(propsDict_.lookupOrDefault<scalar>("minTurbKineticEnergy", 0.0)),
turbKineticEnergyFieldName_(propsDict_.lookupOrDefault<word>("turbKineticEnergyFieldName","")),
turbKineticEnergy_(NULL),
existTurbKineticEnergyInObjReg_(false),
voidfractionFieldName_(propsDict_.lookupOrDefault<word>("voidfractionFieldName","voidfraction")),
voidfraction_(sm.mesh().lookupObject<volScalarField> (voidfractionFieldName_)),
critVoidfraction_(propsDict_.lookupOrDefault<scalar>("critVoidfraction", 0.9)),
ranGen_(clock::getTime()+pid())
{
if (ignoreCellsName_ != "none")
{
ignoreCells_.set(new cellSet(particleCloud_.mesh(),ignoreCellsName_));
Info << type << ": ignoring fluctuations in cellSet " << ignoreCells_().name() <<
" with " << ignoreCells_().size() << " cells." << endl;
}
else existIgnoreCells_ = false;
// define a field to indicate if a cell is next to boundary
label cellI = -1;
forAll (mesh_.boundary(),patchI)
{
word patchName = mesh_.boundary()[patchI].name();
if (patchName.rfind("procB",0) == 0) continue;
forAll(mesh_.boundary()[patchI], faceI)
{
cellI = mesh_.boundary()[patchI].faceCells()[faceI];
wallIndicatorField_[cellI] = 1.0;
}
}
if (turbKineticEnergyFieldName_ != "")
{
existTurbKineticEnergyInObjReg_ = true;
volScalarField& k(const_cast<volScalarField&>(sm.mesh().lookupObject<volScalarField> (turbKineticEnergyFieldName_)));
turbKineticEnergy_ = &k;
}
else
{
turbKineticEnergy_ = new volScalarField
(
IOobject
(
"turbKinEnergy",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensionSet(0,2,-2,0,0), 0)
);
}
// make sure this is the last force model in list so that fluid velocity does not get overwritten
label numLastForceModel = sm.nrForceModels();
word lastForceModel = sm.forceModels()[numLastForceModel-1];
if (lastForceModel != "turbulentDispersion")
{
FatalError <<"Force model 'turbulentDispersion' needs to be last in list!\n" << abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
turbulentDispersion::~turbulentDispersion()
{
if (!existTurbKineticEnergyInObjReg_) delete turbKineticEnergy_;
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
bool turbulentDispersion::ignoreCell(label cell) const
{
if (!existIgnoreCells_) return false;
else return ignoreCells_()[cell];
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void turbulentDispersion::setForce() const
{
if (!existTurbKineticEnergyInObjReg_)
{
*turbKineticEnergy_ = particleCloud_.turbulence().k()();
}
label cellI = -1;
label patchID = -1;
label faceIGlobal = -1;
scalar flucProjection = 0.0;
scalar k = 0.0;
vector faceINormal = vector::zero;
vector flucU = vector::zero;
vector position = vector::zero;
word patchName("");
interpolationCellPoint<scalar> turbKineticEnergyInterpolator_(*turbKineticEnergy_);
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)
{
cellI = particleCloud_.cellIDs()[index][0];
if (cellI > -1 && !ignoreCell(cellI))
{
// particles in dilute regions follow fluid without fluctuations
if (voidfraction_[cellI] < critVoidfraction_)
{
if (interpolate_)
{
position = particleCloud_.position(index);
k = turbKineticEnergyInterpolator_.interpolate(position,cellI);
}
else
{
k = (*turbKineticEnergy_)[cellI];
}
if (k < minTurbKineticEnergy_) k = minTurbKineticEnergy_;
flucU=unitFlucDir()*Foam::sqrt(2.0*k);
// prevent particles being pushed through walls by regulating velocity fluctuations
// check if cell is adjacent to wall and remove corresponding components
if (wallIndicatorField_[cellI] > 0.5)
{
const cell& faces = mesh_.cells()[cellI];
forAll (faces, faceI)
{
faceIGlobal = faces[faceI];
patchID = mesh_.boundaryMesh().whichPatch(faceIGlobal);
if (patchID < 0) continue;
patchName = mesh_.boundary()[patchID].name();
if (patchName.rfind("procB",0) == 0) continue;
faceINormal = mesh_.Sf()[faceIGlobal];
faceINormal /= mag(faceINormal);
flucProjection = faceINormal&flucU;
if (flucProjection > 0.0) flucU -= flucProjection*faceINormal;
}
}
for(int j=0;j<3;j++)
{
particleCloud_.fluidVels()[index][j] += flucU[j];
}
}
}
}
}
vector turbulentDispersion::unitFlucDir() const
{
// unit random vector
// algorithm according to:
// Marsaglia. "Choosing a point from the surface of a sphere." The Annals of Mathematical Statistics 43.2 (1972): 645-646.
scalar v1(0.0);
scalar v2(0.0);
scalar s(10.0);
scalar s2(0.0);
vector rvec(0,0,0);
while(s>1.0)
{
v1=2*(ranGen_.scalar01()-0.5);
v2=2*(ranGen_.scalar01()-0.5);
s=v1*v1+v2*v2;
}
s2=Foam::sqrt(1-s);
rvec[0]=2*v1*s2;
rvec[1]=2*v2*s2;
rvec[2]=1-2*s;
return rvec;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
CFDEMcoupling academic - Open Source CFD-DEM coupling
Contributing authors:
Thomas Lichtenegger
Copyright (C) 2015- Johannes Kepler University, Linz
-------------------------------------------------------------------------------
License
This file is part of CFDEMcoupling academic.
CFDEMcoupling academic is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CFDEMcoupling academic is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with CFDEMcoupling academic. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef turbulentDispersion_H
#define turbulentDispersion_H
#include "forceModel.H"
#include "interpolationCellPoint.H"
#include "Random.H"
#include "autoPtr.H"
#include "cellSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class turbulentDispersion Declaration
\*---------------------------------------------------------------------------*/
class turbulentDispersion
:
public forceModel
{
protected:
dictionary propsDict_;
bool interpolate_;
const fvMesh& mesh_;
// ignore fluctuations in region
word ignoreCellsName_;
autoPtr<cellSet> ignoreCells_;
bool existIgnoreCells_;
mutable volScalarField wallIndicatorField_;
scalar minTurbKineticEnergy_;
word turbKineticEnergyFieldName_;
volScalarField* turbKineticEnergy_;
bool existTurbKineticEnergyInObjReg_;
word voidfractionFieldName_;
const volScalarField& voidfraction_;
scalar critVoidfraction_;
virtual vector unitFlucDir() const;
mutable Random ranGen_;
bool ignoreCell(label) const;
public:
//- Runtime type information
TypeName("turbulentDispersion");
// Constructors
//- Construct from components
turbulentDispersion
(
const dictionary& dict,
cfdemCloud& sm,
word type = "turbulentDispersion"
);
// Destructor
~turbulentDispersion();
// Member Functions
void setForce() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -69,16 +69,11 @@ virtualMassForce::virtualMassForce
U_(sm.mesh().lookupObject<volVectorField> (velFieldName_)),
phiFieldName_(propsDict_.lookup("phiFieldName")),
phi_(sm.mesh().lookupObject<surfaceScalarField> (phiFieldName_)),
UrelOld_(NULL),
UrelOldRegName_(typeName + "UrelOld"),
splitUrelCalculation_(propsDict_.lookupOrDefault<bool>("splitUrelCalculation",false)),
Cadd_(0.5)
{
if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0)
{
// get memory for 2d array
particleCloud_.dataExchangeM().allocateArray(UrelOld_,NOTONCPU,3);
}
particleCloud_.registerParticleProperty<double**>(UrelOldRegName_,3,NOTONCPU,false);
// init force sub model
setForceSubModels(propsDict_);
@ -117,15 +112,13 @@ virtualMassForce::virtualMassForce
virtualMassForce::~virtualMassForce()
{
particleCloud_.dataExchangeM().destroy(UrelOld_,3);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void virtualMassForce::setForce() const
{
reAllocArrays();
double**& UrelOld_ = particleCloud_.getParticlePropertyRef<double**>(UrelOldRegName_);
scalar dt = U_.mesh().time().deltaT().value();
@ -233,17 +226,6 @@ void virtualMassForce::setForce() const
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void Foam::virtualMassForce::reAllocArrays() const
{
if(particleCloud_.numberOfParticlesChanged())
{
Pout << "virtualMassForce::reAllocArrays..." << endl;
particleCloud_.dataExchangeM().allocateArray(UrelOld_,NOTONCPU,3);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -71,7 +71,7 @@ private:
const surfaceScalarField& phi_;
mutable double **UrelOld_;
const word UrelOldRegName_;
const bool splitUrelCalculation_; //indicator to split calculation of Urel between CFDEM and LIGGGHTS
//requires the integration fix to take dv/dt into account!
@ -100,8 +100,6 @@ public:
// Member Functions
void setForce() const;
void reAllocArrays() const;
};

View File

@ -78,7 +78,6 @@ allRegion::~allRegion()
void allRegion::defineRegion() const
{
reAllocArrays();
// do nothing
}

View File

@ -46,15 +46,6 @@ defineRunTimeSelectionTable(regionModel, dictionary);
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void regionModel::reAllocArrays() const
{
if(particleCloud_.numberOfParticlesChanged())
{
// get arrays of new length
particleCloud_.dataExchangeM().allocateArray(inRegion_,1.,1);
particleCloud_.dataExchangeM().allocateArray(outRegion_,1.,1);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -66,16 +57,10 @@ regionModel::regionModel
)
:
dict_(dict),
particleCloud_(sm),
inRegion_(NULL),
outRegion_(NULL)
particleCloud_(sm)
{
if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0)
{
// get memory for 2d arrays
particleCloud_.dataExchangeM().allocateArray(inRegion_,1.,1);
particleCloud_.dataExchangeM().allocateArray(outRegion_,1.,1);
}
particleCloud_.registerParticleProperty<double**>("inRegion",1,1.0,false);
particleCloud_.registerParticleProperty<double**>("outRegion",1,1.0,false);
}
@ -83,8 +68,6 @@ regionModel::regionModel
regionModel::~regionModel()
{
particleCloud_.dataExchangeM().destroy(inRegion_,1);
particleCloud_.dataExchangeM().destroy(outRegion_,1);
}

View File

@ -60,10 +60,6 @@ protected:
cfdemCloud& particleCloud_;
mutable double **inRegion_;
mutable double **outRegion_;
public:
friend class voidFractionModel;
@ -117,13 +113,6 @@ public:
virtual void resetVolFields(volVectorField&) const = 0;
void reAllocArrays() const;
// Access
inline double ** const& inRegion()const{ return inRegion_; };
inline double ** const& outRegion()const { return outRegion_; };
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -55,14 +55,17 @@ ZehnerSchluenderThermCond::ZehnerSchluenderThermCond
voidfractionFieldName_(propsDict_.lookupOrDefault<word>("voidfractionFieldName","voidfraction")),
voidfraction_(sm.mesh().lookupObject<volScalarField> (voidfractionFieldName_)),
typeKs_(propsDict_.lookupOrDefault<scalarList>("thermalConductivities",scalarList(1,-1.0))),
partKs_(NULL)
partKsRegName_(typeName + "partKs")
{
if (typeKs_[0] < 0.0)
{
FatalError << "ZehnerSchluenderThermCond: provide list of thermal conductivities." << abort(FatalError);
}
if (typeKs_.size() > 1) allocateMyArrays();
if (typeKs_.size() > 1)
{
particleCloud_.registerParticleProperty<double**>(partKsRegName_,1);
}
else
{
partKsField_ *= typeKs_[0];
@ -74,14 +77,6 @@ ZehnerSchluenderThermCond::ZehnerSchluenderThermCond
ZehnerSchluenderThermCond::~ZehnerSchluenderThermCond()
{
if (typeKs_.size() > 1) particleCloud_.dataExchangeM().destroy(partKs_,1);
}
void ZehnerSchluenderThermCond::allocateMyArrays() const
{
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(partKs_,initVal,1);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -133,7 +128,7 @@ void ZehnerSchluenderThermCond::calcPartKsField() const
FatalError << "ZehnerSchluenderThermCond needs data for more than one type, but types are not communicated." << abort(FatalError);
}
allocateMyArrays();
double**& partKs_ = particleCloud_.getParticlePropertyRef<double**>(partKsRegName_);
label cellI=0;
label partType = 0;
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)

View File

@ -54,19 +54,17 @@ private:
dictionary propsDict_;
word partKsFieldName_;
const word partKsFieldName_;
volScalarField& partKsField_;
word voidfractionFieldName_;
const word voidfractionFieldName_;
const volScalarField& voidfraction_;
scalarList typeKs_;
mutable double **partKs_;
void allocateMyArrays() const;
const word partKsRegName_;
void calcPartKsField() const;

View File

@ -89,8 +89,6 @@ GaussVoidFraction::~GaussVoidFraction()
void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
{
reAllocArrays();
voidfractionNext_.ref()=1;
scalar radius(-1);
@ -103,12 +101,12 @@ void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfract
//if(mask[index][0])
//{
//reset
for(int subcell=0;subcell<cellsPerParticle_[index][0];subcell++)
for(int subcell=0;subcell<cellsPerParticle()[index][0];subcell++)
{
particleWeights[index][subcell]=0;
particleVolumes[index][subcell]=0;
}
cellsPerParticle_[index][0]=1;
cellsPerParticle()[index][0]=1;
particleV[index][0]=0;
//collecting data
@ -142,7 +140,7 @@ void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfract
}
else if (hashSetLength > 0)
{
cellsPerParticle_[index][0]=hashSetLength;
cellsPerParticle()[index][0]=hashSetLength;
//making sure that the cell containing the center is the first subcell
particleCloud_.cellIDs()[index][0]=particleCenterCellID;
@ -200,7 +198,7 @@ void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfract
//bringing eulerian field to particle array
for(label index=0; index< particleCloud_.numberOfParticles(); index++)
{
for(label subcell=0;subcell<cellsPerParticle_[index][0];subcell++)
for(label subcell=0;subcell<cellsPerParticle()[index][0];subcell++)
{
label cellID = particleCloud_.cellIDs()[index][subcell];

View File

@ -91,8 +91,6 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction
{
const boundBox& globalBb = particleCloud_.mesh().bounds();
reAllocArrays();
voidfractionNext_.ref() = 1.0;
for (int index=0; index < particleCloud_.numberOfParticles(); index++)
@ -100,13 +98,13 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction
//if(mask[index][0])
//{
//reset
for (int subcell=0; subcell < cellsPerParticle_[index][0]; subcell++)
for (int subcell=0; subcell < cellsPerParticle()[index][0]; subcell++)
{
particleWeights[index][subcell] = 0.0;
particleVolumes[index][subcell] = 0.0;
}
cellsPerParticle_[index][0]=1;
cellsPerParticle()[index][0]=1;
particleV[index][0]=0;
//collecting data
@ -266,7 +264,7 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction
}
else if (hashSetLength > 0)
{
cellsPerParticle_[index][0]=hashSetLength;
cellsPerParticle()[index][0]=hashSetLength;
hashSett.erase(particleCenterCellID);
for (label i=0; i < hashSetLength-1; i++)
@ -281,7 +279,7 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction
for (label index=0; index < particleCloud_.numberOfParticles(); index++)
{
for (label subcell=0; subcell < cellsPerParticle_[index][0]; subcell++)
for (label subcell=0; subcell < cellsPerParticle()[index][0]; subcell++)
{
label cellID = particleCloud_.cellIDs()[index][subcell];

View File

@ -88,8 +88,6 @@ bigParticleVoidFraction::~bigParticleVoidFraction()
void bigParticleVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
{
reAllocArrays();
voidfractionNext_.ref()=1;
scalar radius(-1);
@ -102,12 +100,12 @@ void bigParticleVoidFraction::setvoidFraction(double** const& mask,double**& voi
//if(mask[index][0])
//{
//reset
for(int subcell=0;subcell<cellsPerParticle_[index][0];subcell++)
for(int subcell=0;subcell<cellsPerParticle()[index][0];subcell++)
{
particleWeights[index][subcell]=0;
particleVolumes[index][subcell]=0;
}
cellsPerParticle_[index][0]=1;
cellsPerParticle()[index][0]=1;
particleV[index][0]=0;
//collecting data
@ -137,7 +135,7 @@ void bigParticleVoidFraction::setvoidFraction(double** const& mask,double**& voi
}
else if (hashSetLength > 0)
{
cellsPerParticle_[index][0]=hashSetLength;
cellsPerParticle()[index][0]=hashSetLength;
//making sure that the cell containing the center is the first subcell
particleCloud_.cellIDs()[index][0]=particleCenterCellID;
@ -190,7 +188,7 @@ void bigParticleVoidFraction::setvoidFraction(double** const& mask,double**& voi
//bringing eulerian field to particle array
for(label index=0; index< particleCloud_.numberOfParticles(); index++)
{
for(label subcell=0;subcell<cellsPerParticle_[index][0];subcell++)
for(label subcell=0;subcell<cellsPerParticle()[index][0];subcell++)
{
label cellID = particleCloud_.cellIDs()[index][subcell];

View File

@ -80,8 +80,6 @@ centreVoidFraction::~centreVoidFraction()
void centreVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
{
reAllocArrays();
scalar radius(-1);
scalar volume(0);
scalar cellVol(0);
@ -93,7 +91,7 @@ void centreVoidFraction::setvoidFraction(double** const& mask,double**& voidfrac
//{
// reset
particleWeights[index][0]=0;
cellsPerParticle_[index][0]=1;
cellsPerParticle()[index][0]=1;
label cellI = particleCloud_.cellIDs()[index][0];
@ -128,9 +126,9 @@ void centreVoidFraction::setvoidFraction(double** const& mask,double**& voidfrac
if (index==0)
{
Info << "centre cellI = " << cellI << endl;
Info << "cellsPerParticle_=" << cellsPerParticle_[index][0] << endl;
Info << "cellsPerParticle =" << cellsPerParticle()[index][0] << endl;
for(int i=0;i<cellsPerParticle_[index][0];i++)
for(int i=0;i<cellsPerParticle()[index][0];i++)
{
if(i==0)Info << "cellids, voidfractions, particleWeights, : \n";
Info << particleCloud_.cellIDs()[index][i] << " ," << endl;

View File

@ -69,8 +69,7 @@ dividedVoidFraction::dividedVoidFraction
alphaMin_(readScalar(propsDict_.lookup("alphaMin"))),
alphaLimited_(0),
tooMuch_(0.0),
interpolation_(propsDict_.found("interpolation")),
cfdemUseOnly_(propsDict_.lookupOrDefault<bool>("cfdemUseOnly", false))
interpolation_(propsDict_.found("interpolation"))
{
maxCellsPerParticle_ = numberOfMarkerPoints;
@ -158,10 +157,6 @@ dividedVoidFraction::~dividedVoidFraction()
void dividedVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes, double**& particleV)
{
if (cfdemUseOnly_)
reAllocArrays(particleCloud_.numberOfParticles());
else
reAllocArrays();
vector position(0.,0.,0.);
label cellID = -1;
@ -180,14 +175,14 @@ void dividedVoidFraction::setvoidFraction(double** const& mask,double**& voidfra
//{
// reset
for (int subcell=0; subcell < cellsPerParticle_[index][0]; subcell++)
for (int subcell=0; subcell < cellsPerParticle()[index][0]; subcell++)
{
particleWeights[index][subcell] = 0.;
particleVolumes[index][subcell] = 0.;
}
particleV[index][0] = 0.;
cellsPerParticle_[index][0] = 1;
cellsPerParticle()[index][0] = 1;
position = particleCloud_.position(index);
cellID = particleCloud_.cellIDs()[index][0];
radius = particleCloud_.radius(index);
@ -270,7 +265,7 @@ void dividedVoidFraction::setvoidFraction(double** const& mask,double**& voidfra
for(int index=0; index < particleCloud_.numberOfParticles(); index++)
{
{
for (int subcell=0; subcell < cellsPerParticle_[index][0]; subcell++)
for (int subcell=0; subcell < cellsPerParticle()[index][0]; subcell++)
{
label cellID = particleCloud_.cellIDs()[index][subcell];

View File

@ -74,8 +74,6 @@ private:
const bool interpolation_;
const bool cfdemUseOnly_;
vector offsets[numberOfMarkerPoints];
virtual inline scalar Vp(int index, scalar radius, scalar scaleVol) const

View File

@ -49,7 +49,7 @@
// add sub particle representation
bool createNew = true;
label storeInIndex=0;
for(int i=0; i < cellsPerParticle_[index][0] ; i++)
for(int i=0; i < cellsPerParticle()[index][0] ; i++)
{
if(partCellId == particleCloud_.cellIDs()[index][i])
{
@ -61,8 +61,8 @@
if(createNew)
{
cellsPerParticle_[index][0] ++;
storeInIndex = cellsPerParticle_[index][0]-1;
cellsPerParticle()[index][0] ++;
storeInIndex = cellsPerParticle()[index][0]-1;
particleCloud_.cellIDs()[index][storeInIndex] = partCellId;
}

View File

@ -90,8 +90,6 @@ trilinearVoidFraction::~trilinearVoidFraction()
void trilinearVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
{
reAllocArrays();
scalar radius(-1.);
scalar volume(0.);
scalar scaleVol = weight();
@ -131,7 +129,7 @@ void trilinearVoidFraction::setvoidFraction(double** const& mask,double**& voidf
for(int index = 0; index < particleCloud_.numberOfParticles(); ++index)
{
// reset
cellsPerParticle_[index][0] = 8;
cellsPerParticle()[index][0] = 8;
//TODO do we need to set particleVolumes, particleV?
// ===

View File

@ -84,12 +84,12 @@ voidFractionModel::voidFractionModel
/*sm.mesh(),
dimensionedScalar("zero", dimensionSet(0,0,0,0,0), 1)*/
),
cellsPerParticle_(NULL),
partCellsRegName_("cellsPerParticle"),
maxCellsPerParticle_(1),
weight_(1.),
porosity_(1.)
{
particleCloud_.dataExchangeM().allocateArray(cellsPerParticle_,1,1);
particleCloud_.registerParticleProperty<int**>(partCellsRegName_,1,1.0,false);
if (particleCloud_.getParticleEffVolFactors()) multiWeights_ = true;
}
@ -128,19 +128,18 @@ voidFractionModel::voidFractionModel
sm.mesh(),
dimensionedScalar("zero", dimensionSet(0,0,0,0,0), initVoidfraction)
),
cellsPerParticle_(NULL),
partCellsRegName_("cellsPerParticle"),
maxCellsPerParticle_(1),
weight_(1.),
porosity_(1.)
{
particleCloud_.dataExchangeM().allocateArray(cellsPerParticle_,1,1);
particleCloud_.registerParticleProperty<int**>(partCellsRegName_,1,1.0,false);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
voidFractionModel::~voidFractionModel()
{
particleCloud_.dataExchangeM().destroy(cellsPerParticle_,1);
}
// * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
@ -162,7 +161,7 @@ void voidFractionModel::resetVoidFractions()
int** const& voidFractionModel::cellsPerParticle() const
{
return cellsPerParticle_;
return particleCloud_.getParticlePropertyRef<int**>(partCellsRegName_);
}
int voidFractionModel::maxCellsPerParticle() const
@ -170,24 +169,6 @@ int voidFractionModel::maxCellsPerParticle() const
return maxCellsPerParticle_;
}
void voidFractionModel::reAllocArrays()
{
if(particleCloud_.numberOfParticlesChanged())
{
// get arrays of new length
particleCloud_.dataExchangeM().allocateArray(cellsPerParticle_,1,1);
}
}
void voidFractionModel::reAllocArrays(int nP)
{
if(particleCloud_.numberOfParticlesChanged())
{
// get arrays of new length
particleCloud_.dataExchangeM().allocateArray(cellsPerParticle_,1,1,nP);
}
}
scalar voidFractionModel::pointInParticle(int index, const vector& positionCenter, const vector& point, double scale) const
{
const scalar radius = particleCloud_.radius(index);

View File

@ -69,7 +69,7 @@ protected:
volScalarField voidfractionNext_;
int ** cellsPerParticle_;
const word partCellsRegName_;
int maxCellsPerParticle_;
@ -165,10 +165,6 @@ public:
int maxCellsPerParticle() const;
void reAllocArrays();
void reAllocArrays(int nP); //force number of particles during reallocation, for CFD offline-use
virtual void setParticleType(label type) const {}
virtual bool checkParticleType(label) const { return true; } //consider all particles by default

View File

@ -82,6 +82,7 @@ $(forceModels)/Fines/FanningDynFines.C
$(forceModels)/Fines/ErgunStatFines.C
$(forceModels)/granKineticEnergy/granKineticEnergy.C
$(forceModels)/particleDeformation/particleDeformation.C
$(forceModels)/turbulentDispersion/turbulentDispersion.C
$(forceSubModels)/forceSubModel/newForceSubModel.C
$(forceSubModels)/forceSubModel/forceSubModel.C

View File

@ -28,7 +28,8 @@ EXE_INC = \
-I$(CFDEM_SRC_DIR)/cfdTools \
-Wno-old-style-cast \
-Wno-unused-result \
-Wno-literal-suffix
-Wno-literal-suffix \
-Wno-deprecated-copy
LIB_LIBS = \
$(PLIBS) \

View File

@ -18,6 +18,7 @@ EXE_INC = \
-I$(CFDEM_LIGGGHTS_SRC_DIR) \
-I$(CFDEM_M2MLIB_PATH) \
-I$(CFDEM_SRC_DIR)/cfdTools \
-Wno-deprecated-copy
LIB_LIBS = \

View File

@ -66,7 +66,8 @@ MarkovPath::MarkovPath
intervalSizesCumulative_(numIntervals_),
Pjump_(0.0),
intervalWeights_(propsDict_.lookupOrDefault<scalarList>("intervalWeights",scalarList(numIntervals_,1.0))),
intervalWeightsCumulative_(intervalWeights_)
intervalWeightsCumulative_(intervalWeights_),
ranGen(clock::getTime()+pid())
{
for(int i=0;i<numIntervals_;i++)
{
@ -150,7 +151,6 @@ void MarkovPath::computeRecPath()
void MarkovPath::extendPath()
{
Random ranGen(clock::getTime()+pid());
SymmetricSquareMatrix<scalar>& recurrenceMatrix( base_.recM().recurrenceMatrix() );

View File

@ -82,6 +82,8 @@ protected:
scalarList intervalWeightsCumulative_;
Random ranGen;
public: