mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
test memory allocation of registered properties by cfdemCloud
perform per-particle property allocation in cfdemCloud instead of model if registered size > 0 if no reallocation is triggered due to a change in particle number, reset data to initial values (if registered size > 0)
This commit is contained in:
@ -797,9 +797,60 @@ bool cfdemCloud::reAllocArrays()
|
|||||||
if(getParticleDensities_) dataExchangeM().allocateArray(particleDensities_,0.,1);
|
if(getParticleDensities_) dataExchangeM().allocateArray(particleDensities_,0.,1);
|
||||||
if(getParticleEffVolFactors_) dataExchangeM().allocateArray(particleEffVolFactors_,0.,1);
|
if(getParticleEffVolFactors_) dataExchangeM().allocateArray(particleEffVolFactors_,0.,1);
|
||||||
if(getParticleTypes_) dataExchangeM().allocateArray(particleTypes_,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;
|
arraysReallocated_ = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for
|
||||||
|
(
|
||||||
|
HashTable<particleProperty>::iterator iter = particlePropertyTable.begin();
|
||||||
|
iter != particlePropertyTable.end();
|
||||||
|
++iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (iter().size > 0) {
|
||||||
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -192,6 +192,8 @@ protected:
|
|||||||
struct particleProperty {
|
struct particleProperty {
|
||||||
void** property;
|
void** property;
|
||||||
const std::type_info* ti;
|
const std::type_info* ti;
|
||||||
|
int size;
|
||||||
|
double initVal;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& ref() {
|
T& ref() {
|
||||||
if (*ti == typeid(T)) return *reinterpret_cast<T*>(&property);
|
if (*ti == typeid(T)) return *reinterpret_cast<T*>(&property);
|
||||||
@ -458,7 +460,7 @@ public:
|
|||||||
bool checkPeriodicCells() const { return checkPeriodicCells_; }
|
bool checkPeriodicCells() const { return checkPeriodicCells_; }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void registerParticleProperty(const word& property);
|
void registerParticleProperty(const word& property, int size=0, double initVal=0.0);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& getParticlePropertyRef(const word& property);
|
T& getParticlePropertyRef(const word& property);
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -405,9 +405,9 @@ inline const turbulenceModel& cfdemCloud::turbulence() const
|
|||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void cfdemCloud::registerParticleProperty(const word& property)
|
void cfdemCloud::registerParticleProperty(const word& property, int size, double initVal)
|
||||||
{
|
{
|
||||||
particlePropertyTable.insert(property,{NULL,&typeid(T)});
|
particlePropertyTable.insert(property,{NULL,&typeid(T),size,initVal});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|||||||
@ -77,10 +77,10 @@ diffusionCoefficient::diffusionCoefficient
|
|||||||
initialized_(false)
|
initialized_(false)
|
||||||
{
|
{
|
||||||
particleCloud_.checkCG(false);
|
particleCloud_.checkCG(false);
|
||||||
particleCloud_.registerParticleProperty<double**>("partPressure");
|
particleCloud_.registerParticleProperty<double**>("partPressure",1);
|
||||||
for (int i=0; i<diffusantGasNames_.size(); i++)
|
for (int i=0; i<diffusantGasNames_.size(); i++)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>(diffusantGasNames_[i]);
|
particleCloud_.registerParticleProperty<double**>(diffusantGasNames_[i],1);
|
||||||
}
|
}
|
||||||
createCoeffs();
|
createCoeffs();
|
||||||
molWeightTable();
|
molWeightTable();
|
||||||
@ -94,15 +94,6 @@ diffusionCoefficient::~diffusionCoefficient()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void diffusionCoefficient::reAllocMyArrays() const
|
|
||||||
{
|
|
||||||
double initVal=0.0;
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(particleCloud_.getParticlePropertyRef<double**>("partPressure"),initVal,1);
|
|
||||||
for (int i=0; i<diffusantGasNames_.size(); i++)
|
|
||||||
{
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(particleCloud_.getParticlePropertyRef<double**>(diffusantGasNames_[i]),initVal,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void diffusionCoefficient::init()
|
void diffusionCoefficient::init()
|
||||||
{
|
{
|
||||||
@ -140,9 +131,6 @@ void diffusionCoefficient::execute()
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// realloc the arrays
|
|
||||||
reAllocMyArrays();
|
|
||||||
|
|
||||||
label cellI=0;
|
label cellI=0;
|
||||||
scalar Tfluid(0);
|
scalar Tfluid(0);
|
||||||
scalar Pfluid(0);
|
scalar Pfluid(0);
|
||||||
|
|||||||
@ -120,8 +120,6 @@ private:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
void reAllocMyArrays() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -67,8 +67,8 @@ massTransferCoeff::massTransferCoeff
|
|||||||
scaleDia_(1)
|
scaleDia_(1)
|
||||||
{
|
{
|
||||||
particleCloud_.checkCG(true);
|
particleCloud_.checkCG(true);
|
||||||
particleCloud_.registerParticleProperty<double**>(partNuName_);
|
particleCloud_.registerParticleProperty<double**>(partNuName_,1);
|
||||||
particleCloud_.registerParticleProperty<double**>(partReynolds_);
|
particleCloud_.registerParticleProperty<double**>(partReynolds_,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -79,20 +79,10 @@ massTransferCoeff::~massTransferCoeff()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void massTransferCoeff::reAllocMyArrays() const
|
|
||||||
{
|
|
||||||
double initVal=0.0;
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(particleCloud_.getParticlePropertyRef<double**>(partNuName_),initVal,1);
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(particleCloud_.getParticlePropertyRef<double**>(partReynolds_),initVal,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void massTransferCoeff::execute()
|
void massTransferCoeff::execute()
|
||||||
{
|
{
|
||||||
// realloc the arrays
|
|
||||||
reAllocMyArrays();
|
|
||||||
|
|
||||||
#ifdef compre
|
#ifdef compre
|
||||||
const volScalarField nufField = particleCloud_.turbulence().mu()/rho_;
|
const volScalarField nufField = particleCloud_.turbulence().mu()/rho_;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -95,8 +95,6 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
void reAllocMyArrays() const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ reactantPerParticle::reactantPerParticle
|
|||||||
Nevery_(propsDict_.lookupOrDefault<label>("Nevery",1))
|
Nevery_(propsDict_.lookupOrDefault<label>("Nevery",1))
|
||||||
{
|
{
|
||||||
particleCloud_.checkCG(false);
|
particleCloud_.checkCG(false);
|
||||||
particleCloud_.registerParticleProperty<double**>("reactantPerParticle");
|
particleCloud_.registerParticleProperty<double**>("reactantPerParticle",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -86,13 +86,6 @@ reactantPerParticle::~reactantPerParticle()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void reactantPerParticle::reAllocMyArrays() const
|
|
||||||
{
|
|
||||||
double initVal=0.0;
|
|
||||||
double**& reactantPerParticle_ = particleCloud_.getParticlePropertyRef<double**>("reactantPerParticle");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(reactantPerParticle_,initVal,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void reactantPerParticle::execute()
|
void reactantPerParticle::execute()
|
||||||
@ -102,8 +95,6 @@ void reactantPerParticle::execute()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// realloc the arrays
|
|
||||||
reAllocMyArrays();
|
|
||||||
|
|
||||||
particlesPerCell_ *= 0.0;
|
particlesPerCell_ *= 0.0;
|
||||||
|
|
||||||
|
|||||||
@ -87,8 +87,6 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
void reAllocMyArrays() const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -103,14 +103,14 @@ species::species
|
|||||||
initialized_(false)
|
initialized_(false)
|
||||||
{
|
{
|
||||||
particleCloud_.checkCG(false);
|
particleCloud_.checkCG(false);
|
||||||
particleCloud_.registerParticleProperty<double**>(partTempName_);
|
particleCloud_.registerParticleProperty<double**>(partTempName_,1);
|
||||||
particleCloud_.registerParticleProperty<double**>(partRhoName_);
|
particleCloud_.registerParticleProperty<double**>(partRhoName_,1);
|
||||||
particleCloud_.registerParticleProperty<double**>(partMolarConcName_);
|
particleCloud_.registerParticleProperty<double**>(partMolarConcName_,1);
|
||||||
|
|
||||||
for (int i=0; i<speciesNames_.size(); i++)
|
for (int i=0; i<speciesNames_.size(); i++)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("X_"+speciesNames_[i]);
|
particleCloud_.registerParticleProperty<double**>("X_"+speciesNames_[i],1);
|
||||||
particleCloud_.registerParticleProperty<double**>("Modified_"+speciesNames_[i]);
|
particleCloud_.registerParticleProperty<double**>("Modified_"+speciesNames_[i],1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,26 +122,6 @@ species::~species()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void species::reAllocMyArrays() const
|
|
||||||
{
|
|
||||||
double initVal=0.0;
|
|
||||||
double**& partRho_ = particleCloud_.getParticlePropertyRef<double**>(partRhoName_);
|
|
||||||
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
|
|
||||||
double**& partMolarConc_ = particleCloud_.getParticlePropertyRef<double**>(partMolarConcName_);
|
|
||||||
|
|
||||||
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++)
|
|
||||||
{
|
|
||||||
double**& molarFractions_ = particleCloud_.getParticlePropertyRef<double**>("X_"+speciesNames_[i]);
|
|
||||||
double**& changeOfSpeciesMass_ = particleCloud_.getParticlePropertyRef<double**>("Modified_"+speciesNames_[i]);
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(molarFractions_,initVal,1);
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(changeOfSpeciesMass_,initVal,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void species::init()
|
void species::init()
|
||||||
{
|
{
|
||||||
if(verbose_)
|
if(verbose_)
|
||||||
@ -203,8 +183,6 @@ void species::execute()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// realloc the arrays
|
|
||||||
reAllocMyArrays();
|
|
||||||
|
|
||||||
// get X_i, T, rho at particle positions
|
// get X_i, T, rho at particle positions
|
||||||
label cellI = 0;
|
label cellI = 0;
|
||||||
|
|||||||
@ -129,8 +129,6 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
void reAllocMyArrays() const;
|
|
||||||
|
|
||||||
tmp <volScalarField> Smi(const label i) const;
|
tmp <volScalarField> Smi(const label i) const;
|
||||||
|
|
||||||
tmp <volScalarField> Sm() const;
|
tmp <volScalarField> Sm() const;
|
||||||
|
|||||||
@ -97,8 +97,8 @@ heatTransferGranConduction::heatTransferGranConduction
|
|||||||
partHeatFluxName_(propsDict_.lookupOrDefault<word>("partHeatFluxName","conductiveHeatFlux")),
|
partHeatFluxName_(propsDict_.lookupOrDefault<word>("partHeatFluxName","conductiveHeatFlux")),
|
||||||
typePartThermCond_(propsDict_.lookupOrDefault<scalarList>("thermalConductivities",scalarList(1,-1.0)))
|
typePartThermCond_(propsDict_.lookupOrDefault<scalarList>("thermalConductivities",scalarList(1,-1.0)))
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_);
|
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_,1);
|
||||||
particleCloud_.registerParticleProperty<double**>("partThermCond");
|
particleCloud_.registerParticleProperty<double**>("partThermCond",1);
|
||||||
|
|
||||||
if (typePartThermCond_[0] < 0.0)
|
if (typePartThermCond_[0] < 0.0)
|
||||||
{
|
{
|
||||||
@ -130,23 +130,10 @@ heatTransferGranConduction::~heatTransferGranConduction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
void heatTransferGranConduction::allocateMyArrays() const
|
|
||||||
{
|
|
||||||
// get memory for 2d arrays
|
|
||||||
double initVal=0.0;
|
|
||||||
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
|
|
||||||
double**& partThermCond_ = particleCloud_.getParticlePropertyRef<double**>("partThermCond");
|
|
||||||
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partHeatFlux_,initVal,1);
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partThermCond_,initVal,1);
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void heatTransferGranConduction::calcEnergyContribution()
|
void heatTransferGranConduction::calcEnergyContribution()
|
||||||
{
|
{
|
||||||
// realloc the arrays
|
|
||||||
allocateMyArrays();
|
|
||||||
|
|
||||||
calcPartEffThermCond();
|
calcPartEffThermCond();
|
||||||
|
|
||||||
QPartPart_ = fvc::laplacian(partEffThermCondField_,partTempField_);
|
QPartPart_ = fvc::laplacian(partEffThermCondField_,partTempField_);
|
||||||
|
|||||||
@ -76,8 +76,6 @@ protected:
|
|||||||
|
|
||||||
scalarList typePartThermCond_;
|
scalarList typePartThermCond_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
void calcPartEffThermCond();
|
void calcPartEffThermCond();
|
||||||
|
|
||||||
void calcPartThermCond();
|
void calcPartThermCond();
|
||||||
|
|||||||
@ -148,16 +148,16 @@ heatTransferGunn::heatTransferGunn
|
|||||||
typeCG_(propsDict_.lookupOrDefault<scalarList>("coarseGrainingFactors",scalarList(1,1.0))),
|
typeCG_(propsDict_.lookupOrDefault<scalarList>("coarseGrainingFactors",scalarList(1,1.0))),
|
||||||
maxTypeCG_(typeCG_.size())
|
maxTypeCG_(typeCG_.size())
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>(partTempName_);
|
particleCloud_.registerParticleProperty<double**>(partTempName_,1);
|
||||||
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_);
|
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_,1);
|
||||||
if (implicit_)
|
if (implicit_)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("partHeatFluxCoeff");
|
particleCloud_.registerParticleProperty<double**>("partHeatFluxCoeff",1);
|
||||||
}
|
}
|
||||||
if(verbose_)
|
if(verbose_)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("partRe");
|
particleCloud_.registerParticleProperty<double**>("partRe",1);
|
||||||
particleCloud_.registerParticleProperty<double**>("partNu");
|
particleCloud_.registerParticleProperty<double**>("partNu",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propsDict_.found("NusseltScalingFactor"))
|
if (propsDict_.found("NusseltScalingFactor"))
|
||||||
@ -234,37 +234,11 @@ heatTransferGunn::~heatTransferGunn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
void heatTransferGunn::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);
|
|
||||||
|
|
||||||
if(implicit_)
|
|
||||||
{
|
|
||||||
double**& partHeatFluxCoeff_ = particleCloud_.getParticlePropertyRef<double**>("partHeatFluxCoeff");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partHeatFluxCoeff_,initVal,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(verbose_)
|
|
||||||
{
|
|
||||||
double**& partRe_ = particleCloud_.getParticlePropertyRef<double**>("partRe");
|
|
||||||
double**& partNu_ = particleCloud_.getParticlePropertyRef<double**>("partNu");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partRe_,initVal,1);
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partNu_,initVal,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void heatTransferGunn::calcEnergyContribution()
|
void heatTransferGunn::calcEnergyContribution()
|
||||||
{
|
{
|
||||||
// realloc the arrays
|
|
||||||
allocateMyArrays();
|
|
||||||
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
|
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
|
||||||
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
|
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
|
||||||
|
|
||||||
|
|||||||
@ -118,8 +118,6 @@ protected:
|
|||||||
|
|
||||||
const label maxTypeCG_;
|
const label maxTypeCG_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
void partTempField();
|
void partTempField();
|
||||||
|
|
||||||
scalar Nusselt(scalar, scalar, scalar) const;
|
scalar Nusselt(scalar, scalar, scalar) const;
|
||||||
|
|||||||
@ -147,16 +147,16 @@ heatTransferRanzMarshall::heatTransferRanzMarshall
|
|||||||
typeCG_(propsDict_.lookupOrDefault<scalarList>("coarseGrainingFactors",scalarList(1,1.0))),
|
typeCG_(propsDict_.lookupOrDefault<scalarList>("coarseGrainingFactors",scalarList(1,1.0))),
|
||||||
maxTypeCG_(typeCG_.size())
|
maxTypeCG_(typeCG_.size())
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>(partTempName_);
|
particleCloud_.registerParticleProperty<double**>(partTempName_,1);
|
||||||
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_);
|
particleCloud_.registerParticleProperty<double**>(partHeatFluxName_,1);
|
||||||
if (implicit_)
|
if (implicit_)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("partHeatFluxCoeff");
|
particleCloud_.registerParticleProperty<double**>("partHeatFluxCoeff",1);
|
||||||
}
|
}
|
||||||
if(verbose_)
|
if(verbose_)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("partRe");
|
particleCloud_.registerParticleProperty<double**>("partRe",1);
|
||||||
particleCloud_.registerParticleProperty<double**>("partNu");
|
particleCloud_.registerParticleProperty<double**>("partNu",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propsDict_.found("NusseltScalingFactor"))
|
if (propsDict_.found("NusseltScalingFactor"))
|
||||||
@ -233,37 +233,11 @@ heatTransferRanzMarshall::~heatTransferRanzMarshall()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
void heatTransferRanzMarshall::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);
|
|
||||||
|
|
||||||
if(implicit_)
|
|
||||||
{
|
|
||||||
double**& partHeatFluxCoeff_ = particleCloud_.getParticlePropertyRef<double**>("partHeatFluxCoeff");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partHeatFluxCoeff_,initVal,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(verbose_)
|
|
||||||
{
|
|
||||||
double**& partRe_ = particleCloud_.getParticlePropertyRef<double**>("partRe");
|
|
||||||
double**& partNu_ = particleCloud_.getParticlePropertyRef<double**>("partNu");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partRe_,initVal,1);
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partNu_,initVal,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void heatTransferRanzMarshall::calcEnergyContribution()
|
void heatTransferRanzMarshall::calcEnergyContribution()
|
||||||
{
|
{
|
||||||
// realloc the arrays
|
|
||||||
allocateMyArrays();
|
|
||||||
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
|
double**& partTemp_ = particleCloud_.getParticlePropertyRef<double**>(partTempName_);
|
||||||
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
|
double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef<double**>(partHeatFluxName_);
|
||||||
|
|
||||||
|
|||||||
@ -117,8 +117,6 @@ protected:
|
|||||||
|
|
||||||
const label maxTypeCG_;
|
const label maxTypeCG_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
void partTempField();
|
void partTempField();
|
||||||
|
|
||||||
scalar Nusselt(scalar, scalar, scalar) const;
|
scalar Nusselt(scalar, scalar, scalar) const;
|
||||||
|
|||||||
@ -64,7 +64,7 @@ reactionHeat::reactionHeat
|
|||||||
dimensionedScalar("zero", dimensionSet(1,-1,-3,0,0,0,0),0.0)
|
dimensionedScalar("zero", dimensionSet(1,-1,-3,0,0,0,0),0.0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>(reactionHeatName_);
|
particleCloud_.registerParticleProperty<double**>(reactionHeatName_,1);
|
||||||
|
|
||||||
if(propsDict_.found("maxsource"))
|
if(propsDict_.found("maxsource"))
|
||||||
{
|
{
|
||||||
@ -81,20 +81,11 @@ reactionHeat::~reactionHeat()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
void reactionHeat::allocateMyArrays() const
|
|
||||||
{
|
|
||||||
// get memory for 2d arrays
|
|
||||||
double initVal=0.0;
|
|
||||||
double**& reactionHeat_ = particleCloud_.getParticlePropertyRef<double**>(reactionHeatName_);
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(reactionHeat_,initVal,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void reactionHeat::calcEnergyContribution()
|
void reactionHeat::calcEnergyContribution()
|
||||||
{
|
{
|
||||||
// realloc the arrays
|
|
||||||
allocateMyArrays();
|
|
||||||
double**& reactionHeat_ = particleCloud_.getParticlePropertyRef<double**>(reactionHeatName_);
|
double**& reactionHeat_ = particleCloud_.getParticlePropertyRef<double**>(reactionHeatName_);
|
||||||
|
|
||||||
particleCloud_.dataExchangeM().getData(reactionHeatName_,"scalar-atom",reactionHeat_);
|
particleCloud_.dataExchangeM().getData(reactionHeatName_,"scalar-atom",reactionHeat_);
|
||||||
|
|||||||
@ -58,8 +58,6 @@ protected:
|
|||||||
|
|
||||||
volScalarField reactionHeatField_;
|
volScalarField reactionHeatField_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -97,8 +97,8 @@ KochHillRWDrag::KochHillRWDrag
|
|||||||
if (propsDict_.found("rhoP"))
|
if (propsDict_.found("rhoP"))
|
||||||
rhoP_= readScalar(propsDict_.lookup("rhoP"));
|
rhoP_= readScalar(propsDict_.lookup("rhoP"));
|
||||||
|
|
||||||
particleCloud_.registerParticleProperty<double**>("partTime");
|
particleCloud_.registerParticleProperty<double**>("partTime",1);
|
||||||
particleCloud_.registerParticleProperty<double**>("partUfluct");
|
particleCloud_.registerParticleProperty<double**>("partUfluct",3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,10 +112,6 @@ KochHillRWDrag::~KochHillRWDrag()
|
|||||||
|
|
||||||
void KochHillRWDrag::setForce() const
|
void KochHillRWDrag::setForce() const
|
||||||
{
|
{
|
||||||
|
|
||||||
// realloc the arrays
|
|
||||||
reAllocArrays();
|
|
||||||
|
|
||||||
if (scale_ > 1.0)
|
if (scale_ > 1.0)
|
||||||
{
|
{
|
||||||
Info << "KochHillRW using scale = " << scale_ << endl;
|
Info << "KochHillRW using scale = " << scale_ << endl;
|
||||||
@ -373,19 +369,6 @@ void KochHillRWDrag::setForce() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KochHillRWDrag::reAllocArrays() const
|
|
||||||
{
|
|
||||||
if (particleCloud_.numberOfParticlesChanged())
|
|
||||||
{
|
|
||||||
double**& partTime_ = particleCloud_.getParticlePropertyRef<double**>("partTime");
|
|
||||||
double**& partUfluct_ = particleCloud_.getParticlePropertyRef<double**>("partUfluct");
|
|
||||||
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partTime_,0.0,1); // field/initVal/with/lenghtFromLigghts
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partUfluct_,0.0,3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -113,8 +113,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
void setForce() const;
|
void setForce() const;
|
||||||
|
|
||||||
void reAllocArrays() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -100,8 +100,8 @@ dSauter::dSauter
|
|||||||
maxTypeCG_ = typeCG_.size();
|
maxTypeCG_ = typeCG_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
particleCloud_.registerParticleProperty<double**>("d2");
|
particleCloud_.registerParticleProperty<double**>("d2",1);
|
||||||
particleCloud_.registerParticleProperty<double**>("d3");
|
particleCloud_.registerParticleProperty<double**>("d3",1);
|
||||||
|
|
||||||
dSauter_.write();
|
dSauter_.write();
|
||||||
|
|
||||||
@ -118,15 +118,6 @@ dSauter::~dSauter()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void dSauter::allocateMyArrays() const
|
|
||||||
{
|
|
||||||
// get memory for 2d arrays
|
|
||||||
double initVal = 0.0;
|
|
||||||
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>("d2");
|
|
||||||
double**& d3_ = particleCloud_.getParticlePropertyRef<double**>("d3");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(d2_,initVal,1); // field/initVal/with/lenghtFromLigghts
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(d3_,initVal,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -137,7 +128,6 @@ void dSauter::setForce() const
|
|||||||
Info << "dSauter using CG factor(s) = " << typeCG_ << endl;
|
Info << "dSauter using CG factor(s) = " << typeCG_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocateMyArrays();
|
|
||||||
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>("d2");
|
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>("d2");
|
||||||
double**& d3_ = particleCloud_.getParticlePropertyRef<double**>("d3");
|
double**& d3_ = particleCloud_.getParticlePropertyRef<double**>("d3");
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,6 @@ private:
|
|||||||
|
|
||||||
mutable volScalarField dSauter_;
|
mutable volScalarField dSauter_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -69,7 +69,7 @@ granKineticEnergy::granKineticEnergy
|
|||||||
"zeroGradient"
|
"zeroGradient"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("vfluc_mag");
|
particleCloud_.registerParticleProperty<double**>("vfluc_mag",1);
|
||||||
granKineticEnergy_.write();
|
granKineticEnergy_.write();
|
||||||
|
|
||||||
|
|
||||||
@ -84,18 +84,10 @@ granKineticEnergy::~granKineticEnergy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
void granKineticEnergy::allocateMyArrays() const
|
|
||||||
{
|
|
||||||
// get memory for 2d arrays
|
|
||||||
double initVal = 0.0;
|
|
||||||
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>("vfluc_mag");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(vfluc_,initVal,1);
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void granKineticEnergy::setForce() const
|
void granKineticEnergy::setForce() const
|
||||||
{
|
{
|
||||||
allocateMyArrays();
|
|
||||||
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>("vfluc_mag");
|
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>("vfluc_mag");
|
||||||
|
|
||||||
label cellI = 0;
|
label cellI = 0;
|
||||||
|
|||||||
@ -49,8 +49,6 @@ private:
|
|||||||
|
|
||||||
mutable volScalarField granKineticEnergy_;
|
mutable volScalarField granKineticEnergy_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -61,7 +61,7 @@ particleDeformation::particleDeformation
|
|||||||
lowerBounds_(propsDict_.lookupOrDefault<scalarList>("lowerBounds",scalarList(1,-1.0))),
|
lowerBounds_(propsDict_.lookupOrDefault<scalarList>("lowerBounds",scalarList(1,-1.0))),
|
||||||
upperBounds_(propsDict_.lookupOrDefault<scalarList>("upperBounds",scalarList(1,-1.0)))
|
upperBounds_(propsDict_.lookupOrDefault<scalarList>("upperBounds",scalarList(1,-1.0)))
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("partDeformations");
|
particleCloud_.registerParticleProperty<double**>("partDeformations",1);
|
||||||
|
|
||||||
// init force sub model
|
// init force sub model
|
||||||
setForceSubModels(propsDict_);
|
setForceSubModels(propsDict_);
|
||||||
@ -122,13 +122,6 @@ particleDeformation::~particleDeformation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
void particleDeformation::allocateMyArrays() const
|
|
||||||
{
|
|
||||||
// get memory for 2d arrays
|
|
||||||
double initVal = 0.0;
|
|
||||||
double**& partDeformations_ = particleCloud_.getParticlePropertyRef<double**>("partDeformations");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partDeformations_,initVal,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool particleDeformation::defaultDeformCell(label cell) const
|
bool particleDeformation::defaultDeformCell(label cell) const
|
||||||
{
|
{
|
||||||
@ -144,8 +137,7 @@ void particleDeformation::setForce() const
|
|||||||
init();
|
init();
|
||||||
initialExec_ = false;
|
initialExec_ = false;
|
||||||
}
|
}
|
||||||
// realloc the arrays
|
|
||||||
allocateMyArrays();
|
|
||||||
double**& partDeformations_ = particleCloud_.getParticlePropertyRef<double**>("partDeformations");
|
double**& partDeformations_ = particleCloud_.getParticlePropertyRef<double**>("partDeformations");
|
||||||
|
|
||||||
label cellI = 0;
|
label cellI = 0;
|
||||||
|
|||||||
@ -76,8 +76,6 @@ private:
|
|||||||
|
|
||||||
label getListIndex(label) const;
|
label getListIndex(label) const;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
void init() const;
|
void init() const;
|
||||||
|
|
||||||
bool defaultDeformCell(label) const;
|
bool defaultDeformCell(label) const;
|
||||||
|
|||||||
@ -146,11 +146,11 @@ pdCorrelation::pdCorrelation
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
particleCloud_.registerParticleProperty<double**>("d");
|
particleCloud_.registerParticleProperty<double**>("d",1);
|
||||||
particleCloud_.registerParticleProperty<double**>("p");
|
particleCloud_.registerParticleProperty<double**>("p",3);
|
||||||
particleCloud_.registerParticleProperty<double**>("d2");
|
particleCloud_.registerParticleProperty<double**>("d2",1);
|
||||||
particleCloud_.registerParticleProperty<double**>("pd");
|
particleCloud_.registerParticleProperty<double**>("pd",3);
|
||||||
particleCloud_.registerParticleProperty<double**>("cg3");
|
particleCloud_.registerParticleProperty<double**>("cg3",1);
|
||||||
|
|
||||||
dField_.write();
|
dField_.write();
|
||||||
pdField_.write();
|
pdField_.write();
|
||||||
@ -167,22 +167,6 @@ pdCorrelation::~pdCorrelation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
void pdCorrelation::allocateMyArrays() const
|
|
||||||
{
|
|
||||||
// get memory for 2d arrays
|
|
||||||
double initVal = 0.0;
|
|
||||||
double**& d_ = particleCloud_.getParticlePropertyRef<double**>("d");
|
|
||||||
double**& p_ = particleCloud_.getParticlePropertyRef<double**>("p");
|
|
||||||
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>("d2");
|
|
||||||
double**& pd_ = particleCloud_.getParticlePropertyRef<double**>("pd");
|
|
||||||
double**& cg3_ = particleCloud_.getParticlePropertyRef<double**>("cg3");
|
|
||||||
|
|
||||||
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void pdCorrelation::setForce() const
|
void pdCorrelation::setForce() const
|
||||||
@ -191,7 +175,6 @@ void pdCorrelation::setForce() const
|
|||||||
|
|
||||||
if (runOnWriteOnly_ && !mesh.write()) return; // skip if it's not write time
|
if (runOnWriteOnly_ && !mesh.write()) return; // skip if it's not write time
|
||||||
|
|
||||||
allocateMyArrays();
|
|
||||||
double**& d_ = particleCloud_.getParticlePropertyRef<double**>("d");
|
double**& d_ = particleCloud_.getParticlePropertyRef<double**>("d");
|
||||||
double**& p_ = particleCloud_.getParticlePropertyRef<double**>("p");
|
double**& p_ = particleCloud_.getParticlePropertyRef<double**>("p");
|
||||||
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>("d2");
|
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>("d2");
|
||||||
|
|||||||
@ -59,8 +59,6 @@ private:
|
|||||||
const Switch CG_;
|
const Switch CG_;
|
||||||
const Switch runOnWriteOnly_;
|
const Switch runOnWriteOnly_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -84,7 +84,7 @@ potentialRelaxation::potentialRelaxation
|
|||||||
ignoreDirection_(propsDict_.lookupOrDefault<vector>("ignoreDirection",vector::zero)),
|
ignoreDirection_(propsDict_.lookupOrDefault<vector>("ignoreDirection",vector::zero)),
|
||||||
ignorePoint_(propsDict_.lookupOrDefault<vector>("ignorePoint",vector::zero))
|
ignorePoint_(propsDict_.lookupOrDefault<vector>("ignorePoint",vector::zero))
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("vfluc");
|
particleCloud_.registerParticleProperty<double**>("vfluc",3);
|
||||||
|
|
||||||
if(ignoreReg_)
|
if(ignoreReg_)
|
||||||
{
|
{
|
||||||
@ -106,13 +106,6 @@ potentialRelaxation::~potentialRelaxation()
|
|||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||||
void potentialRelaxation::allocateMyArrays() const
|
|
||||||
{
|
|
||||||
// get memory for 2d arrays
|
|
||||||
double initVal=0.0;
|
|
||||||
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>("vfluc");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(vfluc_,initVal,3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -124,8 +117,6 @@ void potentialRelaxation::setForce() const
|
|||||||
|
|
||||||
// volVectorField relaxStream = DField_ * fvc::grad(voidfraction_ - voidfractionRec_);
|
// volVectorField relaxStream = DField_ * fvc::grad(voidfraction_ - voidfractionRec_);
|
||||||
|
|
||||||
// realloc the arrays
|
|
||||||
allocateMyArrays();
|
|
||||||
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>("vfluc");
|
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>("vfluc");
|
||||||
|
|
||||||
vector position(0,0,0);
|
vector position(0,0,0);
|
||||||
|
|||||||
@ -78,8 +78,6 @@ private:
|
|||||||
|
|
||||||
vector ignorePoint_;
|
vector ignorePoint_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
void relax(scalar, scalar) const;
|
void relax(scalar, scalar) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -72,7 +72,7 @@ virtualMassForce::virtualMassForce
|
|||||||
splitUrelCalculation_(propsDict_.lookupOrDefault<bool>("splitUrelCalculation",false)),
|
splitUrelCalculation_(propsDict_.lookupOrDefault<bool>("splitUrelCalculation",false)),
|
||||||
Cadd_(0.5)
|
Cadd_(0.5)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("UrelOld");
|
particleCloud_.registerParticleProperty<double**>("UrelOld",3,NOTONCPU);
|
||||||
|
|
||||||
// init force sub model
|
// init force sub model
|
||||||
setForceSubModels(propsDict_);
|
setForceSubModels(propsDict_);
|
||||||
@ -117,7 +117,6 @@ virtualMassForce::~virtualMassForce()
|
|||||||
|
|
||||||
void virtualMassForce::setForce() const
|
void virtualMassForce::setForce() const
|
||||||
{
|
{
|
||||||
reAllocArrays();
|
|
||||||
double**& UrelOld_ = particleCloud_.getParticlePropertyRef<double**>("UrelOld");
|
double**& UrelOld_ = particleCloud_.getParticlePropertyRef<double**>("UrelOld");
|
||||||
|
|
||||||
scalar dt = U_.mesh().time().deltaT().value();
|
scalar dt = U_.mesh().time().deltaT().value();
|
||||||
@ -226,18 +225,6 @@ void virtualMassForce::setForce() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
void Foam::virtualMassForce::reAllocArrays() const
|
|
||||||
{
|
|
||||||
if(particleCloud_.numberOfParticlesChanged())
|
|
||||||
{
|
|
||||||
Pout << "virtualMassForce::reAllocArrays..." << endl;
|
|
||||||
double**& UrelOld_ = particleCloud_.getParticlePropertyRef<double**>("UrelOld");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(UrelOld_,NOTONCPU,3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -98,8 +98,6 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
void setForce() const;
|
void setForce() const;
|
||||||
|
|
||||||
void reAllocArrays() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,6 @@ allRegion::~allRegion()
|
|||||||
|
|
||||||
void allRegion::defineRegion() const
|
void allRegion::defineRegion() const
|
||||||
{
|
{
|
||||||
reAllocArrays();
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,17 +46,6 @@ defineRunTimeSelectionTable(regionModel, dictionary);
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void regionModel::reAllocArrays() const
|
|
||||||
{
|
|
||||||
if(particleCloud_.numberOfParticlesChanged())
|
|
||||||
{
|
|
||||||
// get arrays of new length
|
|
||||||
double**& inRegion_ = particleCloud_.getParticlePropertyRef<double**>("inRegion");
|
|
||||||
double**& outRegion_ = particleCloud_.getParticlePropertyRef<double**>("outRegion");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(inRegion_,1.,1);
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(outRegion_,1.,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -70,8 +59,8 @@ regionModel::regionModel
|
|||||||
dict_(dict),
|
dict_(dict),
|
||||||
particleCloud_(sm)
|
particleCloud_(sm)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("inRegion");
|
particleCloud_.registerParticleProperty<double**>("inRegion",1,1.0);
|
||||||
particleCloud_.registerParticleProperty<double**>("outRegion");
|
particleCloud_.registerParticleProperty<double**>("outRegion",1,1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -113,8 +113,6 @@ public:
|
|||||||
|
|
||||||
virtual void resetVolFields(volVectorField&) const = 0;
|
virtual void resetVolFields(volVectorField&) const = 0;
|
||||||
|
|
||||||
void reAllocArrays() const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ ZehnerSchluenderThermCond::ZehnerSchluenderThermCond
|
|||||||
|
|
||||||
if (typeKs_.size() > 1)
|
if (typeKs_.size() > 1)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<double**>("partKs");
|
particleCloud_.registerParticleProperty<double**>("partKs",1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -78,14 +78,6 @@ ZehnerSchluenderThermCond::~ZehnerSchluenderThermCond()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ZehnerSchluenderThermCond::allocateMyArrays() const
|
|
||||||
{
|
|
||||||
double initVal=0.0;
|
|
||||||
double**& partKs_ = particleCloud_.getParticlePropertyRef<double**>("partKs");
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(partKs_,initVal,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void ZehnerSchluenderThermCond::calcThermCond()
|
void ZehnerSchluenderThermCond::calcThermCond()
|
||||||
@ -135,7 +127,6 @@ void ZehnerSchluenderThermCond::calcPartKsField() const
|
|||||||
FatalError << "ZehnerSchluenderThermCond needs data for more than one type, but types are not communicated." << abort(FatalError);
|
FatalError << "ZehnerSchluenderThermCond needs data for more than one type, but types are not communicated." << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
allocateMyArrays();
|
|
||||||
double**& partKs_ = particleCloud_.getParticlePropertyRef<double**>("partKs");
|
double**& partKs_ = particleCloud_.getParticlePropertyRef<double**>("partKs");
|
||||||
label cellI=0;
|
label cellI=0;
|
||||||
label partType = 0;
|
label partType = 0;
|
||||||
|
|||||||
@ -64,8 +64,6 @@ private:
|
|||||||
|
|
||||||
scalarList typeKs_;
|
scalarList typeKs_;
|
||||||
|
|
||||||
void allocateMyArrays() const;
|
|
||||||
|
|
||||||
void calcPartKsField() const;
|
void calcPartKsField() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -89,8 +89,6 @@ GaussVoidFraction::~GaussVoidFraction()
|
|||||||
|
|
||||||
void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
|
void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
|
||||||
{
|
{
|
||||||
reAllocArrays();
|
|
||||||
|
|
||||||
voidfractionNext_.ref()=1;
|
voidfractionNext_.ref()=1;
|
||||||
|
|
||||||
scalar radius(-1);
|
scalar radius(-1);
|
||||||
|
|||||||
@ -91,8 +91,6 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction
|
|||||||
{
|
{
|
||||||
const boundBox& globalBb = particleCloud_.mesh().bounds();
|
const boundBox& globalBb = particleCloud_.mesh().bounds();
|
||||||
|
|
||||||
reAllocArrays();
|
|
||||||
|
|
||||||
voidfractionNext_.ref() = 1.0;
|
voidfractionNext_.ref() = 1.0;
|
||||||
|
|
||||||
for (int index=0; index < particleCloud_.numberOfParticles(); index++)
|
for (int index=0; index < particleCloud_.numberOfParticles(); index++)
|
||||||
|
|||||||
@ -88,8 +88,6 @@ bigParticleVoidFraction::~bigParticleVoidFraction()
|
|||||||
|
|
||||||
void bigParticleVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
|
void bigParticleVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
|
||||||
{
|
{
|
||||||
reAllocArrays();
|
|
||||||
|
|
||||||
voidfractionNext_.ref()=1;
|
voidfractionNext_.ref()=1;
|
||||||
|
|
||||||
scalar radius(-1);
|
scalar radius(-1);
|
||||||
|
|||||||
@ -80,8 +80,6 @@ centreVoidFraction::~centreVoidFraction()
|
|||||||
|
|
||||||
void centreVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
|
void centreVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
|
||||||
{
|
{
|
||||||
reAllocArrays();
|
|
||||||
|
|
||||||
scalar radius(-1);
|
scalar radius(-1);
|
||||||
scalar volume(0);
|
scalar volume(0);
|
||||||
scalar cellVol(0);
|
scalar cellVol(0);
|
||||||
|
|||||||
@ -69,8 +69,7 @@ dividedVoidFraction::dividedVoidFraction
|
|||||||
alphaMin_(readScalar(propsDict_.lookup("alphaMin"))),
|
alphaMin_(readScalar(propsDict_.lookup("alphaMin"))),
|
||||||
alphaLimited_(0),
|
alphaLimited_(0),
|
||||||
tooMuch_(0.0),
|
tooMuch_(0.0),
|
||||||
interpolation_(propsDict_.found("interpolation")),
|
interpolation_(propsDict_.found("interpolation"))
|
||||||
cfdemUseOnly_(propsDict_.lookupOrDefault<bool>("cfdemUseOnly", false))
|
|
||||||
{
|
{
|
||||||
maxCellsPerParticle_ = numberOfMarkerPoints;
|
maxCellsPerParticle_ = numberOfMarkerPoints;
|
||||||
|
|
||||||
@ -158,10 +157,6 @@ dividedVoidFraction::~dividedVoidFraction()
|
|||||||
|
|
||||||
void dividedVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes, double**& particleV)
|
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.);
|
vector position(0.,0.,0.);
|
||||||
label cellID = -1;
|
label cellID = -1;
|
||||||
|
|||||||
@ -74,8 +74,6 @@ private:
|
|||||||
|
|
||||||
const bool interpolation_;
|
const bool interpolation_;
|
||||||
|
|
||||||
const bool cfdemUseOnly_;
|
|
||||||
|
|
||||||
vector offsets[numberOfMarkerPoints];
|
vector offsets[numberOfMarkerPoints];
|
||||||
|
|
||||||
virtual inline scalar Vp(int index, scalar radius, scalar scaleVol) const
|
virtual inline scalar Vp(int index, scalar radius, scalar scaleVol) const
|
||||||
|
|||||||
@ -90,8 +90,6 @@ trilinearVoidFraction::~trilinearVoidFraction()
|
|||||||
|
|
||||||
void trilinearVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
|
void trilinearVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes,double**& particleV)
|
||||||
{
|
{
|
||||||
reAllocArrays();
|
|
||||||
|
|
||||||
scalar radius(-1.);
|
scalar radius(-1.);
|
||||||
scalar volume(0.);
|
scalar volume(0.);
|
||||||
scalar scaleVol = weight();
|
scalar scaleVol = weight();
|
||||||
|
|||||||
@ -88,7 +88,7 @@ voidFractionModel::voidFractionModel
|
|||||||
weight_(1.),
|
weight_(1.),
|
||||||
porosity_(1.)
|
porosity_(1.)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<int**>("cellsPerParticle");
|
particleCloud_.registerParticleProperty<int**>("cellsPerParticle",1,1.0);
|
||||||
if (particleCloud_.getParticleEffVolFactors()) multiWeights_ = true;
|
if (particleCloud_.getParticleEffVolFactors()) multiWeights_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ voidFractionModel::voidFractionModel
|
|||||||
weight_(1.),
|
weight_(1.),
|
||||||
porosity_(1.)
|
porosity_(1.)
|
||||||
{
|
{
|
||||||
particleCloud_.registerParticleProperty<int**>("cellsPerParticle");
|
particleCloud_.registerParticleProperty<int**>("cellsPerParticle",1,1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -167,24 +167,6 @@ int voidFractionModel::maxCellsPerParticle() const
|
|||||||
return maxCellsPerParticle_;
|
return maxCellsPerParticle_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void voidFractionModel::reAllocArrays()
|
|
||||||
{
|
|
||||||
if(particleCloud_.numberOfParticlesChanged())
|
|
||||||
{
|
|
||||||
// get arrays of new length
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(particleCloud_.getParticlePropertyRef<int**>("cellsPerParticle"),1,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void voidFractionModel::reAllocArrays(int nP)
|
|
||||||
{
|
|
||||||
if(particleCloud_.numberOfParticlesChanged())
|
|
||||||
{
|
|
||||||
// get arrays of new length
|
|
||||||
particleCloud_.dataExchangeM().allocateArray(particleCloud_.getParticlePropertyRef<int**>("cellsPerParticle"),1,1,nP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scalar voidFractionModel::pointInParticle(int index, const vector& positionCenter, const vector& point, double scale) const
|
scalar voidFractionModel::pointInParticle(int index, const vector& positionCenter, const vector& point, double scale) const
|
||||||
{
|
{
|
||||||
const scalar radius = particleCloud_.radius(index);
|
const scalar radius = particleCloud_.radius(index);
|
||||||
|
|||||||
@ -163,10 +163,6 @@ public:
|
|||||||
|
|
||||||
int maxCellsPerParticle() const;
|
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 void setParticleType(label type) const {}
|
||||||
|
|
||||||
virtual bool checkParticleType(label) const { return true; } //consider all particles by default
|
virtual bool checkParticleType(label) const { return true; } //consider all particles by default
|
||||||
|
|||||||
Reference in New Issue
Block a user