use particle property registration in force, region and therm. cond. models

This commit is contained in:
danielque
2020-08-11 11:32:35 +02:00
parent 214e10e5a3
commit 647c84d323
20 changed files with 110 additions and 155 deletions

View File

@ -74,8 +74,6 @@ KochHillRWDrag::KochHillRWDrag
interpolation_(propsDict_.found("interpolation")),
scale_(1.),
randomTauE_(propsDict_.found("randomTauE")),
partTime_(NULL),
partUfluct_(NULL),
RanGen_(label(0))
{
@ -99,16 +97,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**>("partTime");
particleCloud_.registerParticleProperty<double**>("partUfluct");
}
@ -116,8 +106,6 @@ KochHillRWDrag::KochHillRWDrag
KochHillRWDrag::~KochHillRWDrag()
{
particleCloud_.dataExchangeM().destroy(partTime_, 1);
particleCloud_.dataExchangeM().destroy(partUfluct_, 3);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -189,6 +177,9 @@ void KochHillRWDrag::setForce() const
interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_);
interpolationCellPoint<vector> UInterpolator_(U_);
double**& partTime_ = particleCloud_.getParticlePropertyRef<double**>("partTime");
double**& partUfluct_ = particleCloud_.getParticlePropertyRef<double**>("partUfluct");
//Info << "RW-TEST: We are in setForce() at t = " << t << endl; // TEST-Output
for (int index = 0; index<particleCloud_.numberOfParticles(); ++index)
@ -386,6 +377,9 @@ 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);
}

View File

@ -89,10 +89,6 @@ private:
const bool randomTauE_;
mutable double **partTime_; // Lagrangian array
mutable double **partUfluct_; // Lagrangian array
mutable Random RanGen_;
public:

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,6 @@ dSauter::dSauter
forceModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
multiTypes_(false),
d2_(NULL),
d3_(NULL),
maxTypeCG_(1),
typeCG_(propsDict_.lookupOrDefault<scalarList>("coarseGrainingFactors",scalarList(1,1.0))),
d2Field_
@ -101,9 +99,11 @@ dSauter::dSauter
multiTypes_ = true;
maxTypeCG_ = typeCG_.size();
}
allocateMyArrays();
dSauter_.write();
particleCloud_.registerParticleProperty<double**>("d2");
particleCloud_.registerParticleProperty<double**>("d3");
dSauter_.write();
// init force sub model
setForceSubModels(propsDict_);
@ -114,8 +114,6 @@ dSauter::dSauter
dSauter::~dSauter()
{
particleCloud_.dataExchangeM().destroy(d2_,1);
particleCloud_.dataExchangeM().destroy(d3_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
@ -124,6 +122,8 @@ 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);
}
@ -138,6 +138,8 @@ void dSauter::setForce() const
}
allocateMyArrays();
double**& d2_ = particleCloud_.getParticlePropertyRef<double**>("d2");
double**& d3_ = particleCloud_.getParticlePropertyRef<double**>("d3");
label cellI = 0;
label partType = 1;
@ -151,11 +153,11 @@ void dSauter::setForce() const
cellI = particleCloud_.cellIDs()[index][0];
if (cellI >= 0)
{
if (particleCloud_.getParticleEffVolFactors())
if (particleCloud_.getParticleEffVolFactors())
{
effVolFac = particleCloud_.particleEffVolFactor(index);
}
if (multiTypes_)
if (multiTypes_)
{
partType = particleCloud_.particleType(index);
if (partType > maxTypeCG_)

View File

@ -45,18 +45,14 @@ private:
bool multiTypes_;
mutable double **d2_;
mutable double **d3_;
label maxTypeCG_;
scalarList typeCG_;
mutable volScalarField d2Field_;
mutable volScalarField d3Field_;
mutable volScalarField dSauter_;
void allocateMyArrays() const;

View File

@ -53,7 +53,6 @@ granKineticEnergy::granKineticEnergy
:
forceModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
vfluc_(NULL),
UsFieldName_(propsDict_.lookup("granVelFieldName")),
UsField_(sm.mesh().lookupObject<volVectorField> (UsFieldName_)),
granKineticEnergy_
@ -70,7 +69,7 @@ granKineticEnergy::granKineticEnergy
"zeroGradient"
)
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>("vfluc_mag");
granKineticEnergy_.write();
@ -82,7 +81,6 @@ granKineticEnergy::granKineticEnergy
granKineticEnergy::~granKineticEnergy()
{
particleCloud_.dataExchangeM().destroy(vfluc_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
@ -90,6 +88,7 @@ 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 * * * * * * * * * * * * * //
@ -97,6 +96,7 @@ void granKineticEnergy::allocateMyArrays() const
void granKineticEnergy::setForce() const
{
allocateMyArrays();
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>("vfluc_mag");
label cellI = 0;
vector velfluc(0,0,0);

View File

@ -43,8 +43,6 @@ private:
dictionary propsDict_;
mutable double **vfluc_;
word UsFieldName_;
const volVectorField& UsField_;

View File

@ -59,10 +59,9 @@ particleDeformation::particleDeformation
defaultDeformation_(propsDict_.lookupOrDefault<scalar>("defaultDeformation",1.0)),
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)
upperBounds_(propsDict_.lookupOrDefault<scalarList>("upperBounds",scalarList(1,-1.0)))
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>("partDeformations");
// init force sub model
setForceSubModels(propsDict_);
@ -120,7 +119,6 @@ particleDeformation::particleDeformation
particleDeformation::~particleDeformation()
{
particleCloud_.dataExchangeM().destroy(partDeformations_,1);
}
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
@ -128,6 +126,7 @@ 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);
}
@ -147,6 +146,7 @@ void particleDeformation::setForce() const
}
// realloc the arrays
allocateMyArrays();
double**& partDeformations_ = particleCloud_.getParticlePropertyRef<double**>("partDeformations");
label cellI = 0;
label partType = -1;

View File

@ -74,8 +74,6 @@ private:
scalarList upperBounds_;
mutable double **partDeformations_;
label getListIndex(label) const;
void allocateMyArrays() const;

View File

@ -18,7 +18,7 @@ SourceFiles
pdCorrelation.C
Contributing Author
2018 Paul Kieckhefen, TUHH
2018 Paul Kieckhefen, TUHH
\*---------------------------------------------------------------------------*/
#include "error.H"
@ -55,11 +55,6 @@ pdCorrelation::pdCorrelation
:
forceModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
d_(nullptr),
p_(nullptr),
d2_(nullptr),
pd_(nullptr),
cg3_(nullptr),
dField_
( IOobject
(
@ -151,7 +146,11 @@ pdCorrelation::pdCorrelation
<< abort(FatalError);
}
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>("d");
particleCloud_.registerParticleProperty<double**>("p");
particleCloud_.registerParticleProperty<double**>("d2");
particleCloud_.registerParticleProperty<double**>("pd");
particleCloud_.registerParticleProperty<double**>("cg3");
dField_.write();
pdField_.write();
@ -165,11 +164,6 @@ 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 * * * * * * * * * * * * * //
@ -177,6 +171,12 @@ 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);
@ -192,6 +192,11 @@ void pdCorrelation::setForce() const
if (runOnWriteOnly_ && !mesh.write()) return; // skip if it's not write time
allocateMyArrays();
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");
const Switch densityFromList
(

View File

@ -45,12 +45,6 @@ private:
dictionary propsDict_;
mutable double **d_;
mutable double **p_;
mutable double **d2_;
mutable double **pd_;
mutable double **cg3_;
mutable volScalarField dField_;
mutable volVectorField pField_;
mutable volScalarField d2Field_;

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------*\
CFDEMcoupling academic - Open Source CFD-DEM coupling
Contributing authors:
Thomas Lichtenegger
Copyright (C) 2015- Johannes Kepler University, Linz
@ -82,11 +82,10 @@ potentialRelaxation::potentialRelaxation
dt_(particleCloud_.dataExchangeM().DEMts()),
ignoreReg_(propsDict_.lookupOrDefault<bool>("ignoreRegion",false)),
ignoreDirection_(propsDict_.lookupOrDefault<vector>("ignoreDirection",vector::zero)),
ignorePoint_(propsDict_.lookupOrDefault<vector>("ignorePoint",vector::zero)),
vfluc_(NULL)
ignorePoint_(propsDict_.lookupOrDefault<vector>("ignorePoint",vector::zero))
{
allocateMyArrays();
particleCloud_.registerParticleProperty<double**>("vfluc");
if(ignoreReg_)
{
if(mag(ignoreDirection_) < SMALL)
@ -103,7 +102,6 @@ potentialRelaxation::potentialRelaxation
potentialRelaxation::~potentialRelaxation()
{
delete vfluc_;
}
@ -112,39 +110,40 @@ void potentialRelaxation::allocateMyArrays() const
{
// get memory for 2d arrays
double initVal=0.0;
particleCloud_.dataExchangeM().allocateArray(vfluc_,initVal,3);
double**& vfluc_ = particleCloud_.getParticlePropertyRef<double**>("vfluc");
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**>("vfluc");
vector position(0,0,0);
scalar voidfraction(0.0);
vector flucU(0,0,0);
label cellI=0;
interpolationCellPoint<scalar> voidfractionInterpolator_(voidfraction_);
interpolationCellPoint<vector> relaxStreamInterpolator_(relaxStream);
scalar dtDEM = particleCloud_.dataExchangeM().DEMts();
scalar dtCFD = voidfraction_.mesh().time().deltaTValue();
// if DEM time step > CFD time step, scale velocity down
scalar timeFac = 1.0;
if (dtDEM > dtCFD) timeFac = dtCFD / dtDEM;
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)
{
cellI = particleCloud_.cellIDs()[index][0];
@ -164,18 +163,18 @@ void potentialRelaxation::setForce() const
{
position = particleCloud_.position(index);
voidfraction = voidfractionInterpolator_.interpolate(position,cellI);
flucU = relaxStreamInterpolator_.interpolate(position,cellI);
flucU = relaxStreamInterpolator_.interpolate(position,cellI);
}
else
{
voidfraction = voidfraction_[cellI];
flucU = relaxStream[cellI];
}
if (voidfraction > 1.0-SMALL) voidfraction = 1.0 - SMALL;
flucU /= (1-voidfraction);
flucU *= timeFac;
// write particle based data to global array
flucU *= timeFac;
// write particle based data to global array
for(int i = 0; i < 3; i++)
{
vfluc_[index][i]=flucU[i];
@ -183,13 +182,13 @@ void potentialRelaxation::setForce() const
}
}
}
particleCloud_.dataExchangeM().giveData("vfluc","vector-atom", vfluc_);
if (measureDiff_)
{
dimensionedScalar diff( fvc::domainIntegrate( sqr( voidfraction_ - voidfractionRec_ ) ) );
scalar t = particleCloud_.mesh().time().timeOutputValue();
scalar t = particleCloud_.mesh().time().timeOutputValue();
recErrorFile_ << t << "\t" << diff.value() << endl;
}
}
@ -198,12 +197,12 @@ void potentialRelaxation::relax(scalar D0, scalar D1) const
{
volScalarField src0 = voidfraction_ - voidfractionRec_;
volScalarField src1 = voidfraction_ - voidfractionRec_;
forAll(src1, cellI)
{
if(src1[cellI] > 0.0) src1[cellI] = 0.0;
}
solve
(
fvm::laplacian(correctedField_)

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------*\
CFDEMcoupling academic - Open Source CFD-DEM coupling
Contributing authors:
Thomas Lichtenegger
Copyright (C) 2015- Johannes Kepler University, Linz
@ -44,44 +44,42 @@ class potentialRelaxation
{
private:
dictionary propsDict_;
bool interpolate_;
bool measureDiff_;
mutable OFstream recErrorFile_;
word voidfractionFieldName_;
const volScalarField& voidfraction_;
word voidfractionRecFieldName_;
const volScalarField& voidfractionRec_;
scalar critVoidfraction_;
scalar D0_;
scalar D1_;
mutable volScalarField correctedField_;
const scalar dt_;
// ignore particles in cells below plane given with ref point and normal vector
// normal vector points towards region where fluctuations are permitted
bool ignoreReg_;
vector ignoreDirection_;
vector ignorePoint_;
mutable double **vfluc_; // Lagrangian array
void allocateMyArrays() const;
void relax(scalar, scalar) const;
public:

View File

@ -69,16 +69,10 @@ virtualMassForce::virtualMassForce
U_(sm.mesh().lookupObject<volVectorField> (velFieldName_)),
phiFieldName_(propsDict_.lookup("phiFieldName")),
phi_(sm.mesh().lookupObject<surfaceScalarField> (phiFieldName_)),
UrelOld_(NULL),
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**>("UrelOld");
// init force sub model
setForceSubModels(propsDict_);
@ -117,15 +111,14 @@ virtualMassForce::virtualMassForce
virtualMassForce::~virtualMassForce()
{
particleCloud_.dataExchangeM().destroy(UrelOld_,3);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void virtualMassForce::setForce() const
{
reAllocArrays();
double**& UrelOld_ = particleCloud_.getParticlePropertyRef<double**>("UrelOld");
scalar dt = U_.mesh().time().deltaT().value();
@ -239,6 +232,7 @@ void Foam::virtualMassForce::reAllocArrays() const
if(particleCloud_.numberOfParticlesChanged())
{
Pout << "virtualMassForce::reAllocArrays..." << endl;
double**& UrelOld_ = particleCloud_.getParticlePropertyRef<double**>("UrelOld");
particleCloud_.dataExchangeM().allocateArray(UrelOld_,NOTONCPU,3);
}
}

View File

@ -71,8 +71,6 @@ private:
const surfaceScalarField& phi_;
mutable double **UrelOld_;
const bool splitUrelCalculation_; //indicator to split calculation of Urel between CFDEM and LIGGGHTS
//requires the integration fix to take dv/dt into account!

View File

@ -51,6 +51,8 @@ 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);
}
@ -66,16 +68,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");
particleCloud_.registerParticleProperty<double**>("outRegion");
}
@ -83,8 +79,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;
@ -119,11 +115,6 @@ public:
void reAllocArrays() const;
// Access
inline double ** const& inRegion()const{ return inRegion_; };
inline double ** const& outRegion()const { return outRegion_; };
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -54,15 +54,17 @@ ZehnerSchluenderThermCond::ZehnerSchluenderThermCond
partKsField_(const_cast<volScalarField&>(sm.mesh().lookupObject<volScalarField> (partKsFieldName_))),
voidfractionFieldName_(propsDict_.lookupOrDefault<word>("voidfractionFieldName","voidfraction")),
voidfraction_(sm.mesh().lookupObject<volScalarField> (voidfractionFieldName_)),
typeKs_(propsDict_.lookupOrDefault<scalarList>("thermalConductivities",scalarList(1,-1.0))),
partKs_(NULL)
typeKs_(propsDict_.lookupOrDefault<scalarList>("thermalConductivities",scalarList(1,-1.0)))
{
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**>("partKs");
}
else
{
partKsField_ *= typeKs_[0];
@ -74,13 +76,13 @@ ZehnerSchluenderThermCond::ZehnerSchluenderThermCond
ZehnerSchluenderThermCond::~ZehnerSchluenderThermCond()
{
if (typeKs_.size() > 1) particleCloud_.dataExchangeM().destroy(partKs_,1);
}
void ZehnerSchluenderThermCond::allocateMyArrays() const
{
double initVal=0.0;
double**& partKs_ = particleCloud_.getParticlePropertyRef<double**>("partKs");
particleCloud_.dataExchangeM().allocateArray(partKs_,initVal,1);
}
@ -134,6 +136,7 @@ void ZehnerSchluenderThermCond::calcPartKsField() const
}
allocateMyArrays();
double**& partKs_ = particleCloud_.getParticlePropertyRef<double**>("partKs");
label cellI=0;
label partType = 0;
for(int index = 0;index < particleCloud_.numberOfParticles(); ++index)

View File

@ -64,8 +64,6 @@ private:
scalarList typeKs_;
mutable double **partKs_;
void allocateMyArrays() const;
void calcPartKsField() const;