diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillRWDrag/KochHillRWDrag.C b/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillRWDrag/KochHillRWDrag.C index 496556d2..98421eec 100755 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillRWDrag/KochHillRWDrag.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillRWDrag/KochHillRWDrag.C @@ -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("partTime"); + particleCloud_.registerParticleProperty("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 voidfractionInterpolator_(voidfraction_); interpolationCellPoint UInterpolator_(U_); + double**& partTime_ = particleCloud_.getParticlePropertyRef("partTime"); + double**& partUfluct_ = particleCloud_.getParticlePropertyRef("partUfluct"); + //Info << "RW-TEST: We are in setForce() at t = " << t << endl; // TEST-Output for (int index = 0; index("partTime"); + double**& partUfluct_ = particleCloud_.getParticlePropertyRef("partUfluct"); + particleCloud_.dataExchangeM().allocateArray(partTime_,0.0,1); // field/initVal/with/lenghtFromLigghts particleCloud_.dataExchangeM().allocateArray(partUfluct_,0.0,3); } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillRWDrag/KochHillRWDrag.H b/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillRWDrag/KochHillRWDrag.H index 5a8b762d..4cf5a291 100755 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillRWDrag/KochHillRWDrag.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillRWDrag/KochHillRWDrag.H @@ -89,10 +89,6 @@ private: const bool randomTauE_; - mutable double **partTime_; // Lagrangian array - - mutable double **partUfluct_; // Lagrangian array - mutable Random RanGen_; public: diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.C b/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.C index bb8813fc..84604074 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.C @@ -71,14 +71,10 @@ LaEuScalarTemp::LaEuScalarTemp velFieldName_(propsDict_.lookup("velFieldName")), U_(sm.mesh().lookupObject (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(partTempName_); + particleCloud_.registerParticleProperty(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(partTempName_); + double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef(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(partTempName_); + double**& partHeatFlux_ = particleCloud_.getParticlePropertyRef(partHeatFluxName_); // reset Scalar field EuField.primitiveFieldRef() = 0.0; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.H b/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.H index c9de04f9..98fa42e2 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.H @@ -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)] diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/dSauter/dSauter.C b/src/lagrangian/cfdemParticle/subModels/forceModel/dSauter/dSauter.C index 88fed5d4..942d7852 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/dSauter/dSauter.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/dSauter/dSauter.C @@ -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("coarseGrainingFactors",scalarList(1,1.0))), d2Field_ @@ -101,9 +99,11 @@ dSauter::dSauter multiTypes_ = true; maxTypeCG_ = typeCG_.size(); } - allocateMyArrays(); - dSauter_.write(); + particleCloud_.registerParticleProperty("d2"); + particleCloud_.registerParticleProperty("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("d2"); + double**& d3_ = particleCloud_.getParticlePropertyRef("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("d2"); + double**& d3_ = particleCloud_.getParticlePropertyRef("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_) diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/dSauter/dSauter.H b/src/lagrangian/cfdemParticle/subModels/forceModel/dSauter/dSauter.H index eb875ca5..7bb36701 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/dSauter/dSauter.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/dSauter/dSauter.H @@ -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; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.C b/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.C index 072ea2de..ae0c3fbd 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.C @@ -53,7 +53,6 @@ granKineticEnergy::granKineticEnergy : forceModel(dict,sm), propsDict_(dict.subDict(typeName + "Props")), - vfluc_(NULL), UsFieldName_(propsDict_.lookup("granVelFieldName")), UsField_(sm.mesh().lookupObject (UsFieldName_)), granKineticEnergy_ @@ -70,7 +69,7 @@ granKineticEnergy::granKineticEnergy "zeroGradient" ) { - allocateMyArrays(); + particleCloud_.registerParticleProperty("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("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("vfluc_mag"); label cellI = 0; vector velfluc(0,0,0); diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.H b/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.H index 46a8a7ff..60a8b82d 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/granKineticEnergy/granKineticEnergy.H @@ -43,8 +43,6 @@ private: dictionary propsDict_; - mutable double **vfluc_; - word UsFieldName_; const volVectorField& UsField_; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/particleDeformation/particleDeformation.C b/src/lagrangian/cfdemParticle/subModels/forceModel/particleDeformation/particleDeformation.C index ed1444c7..2df2701a 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/particleDeformation/particleDeformation.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/particleDeformation/particleDeformation.C @@ -59,10 +59,9 @@ particleDeformation::particleDeformation defaultDeformation_(propsDict_.lookupOrDefault("defaultDeformation",1.0)), partTypes_(propsDict_.lookupOrDefault("partTypes",labelList(1,-1))), lowerBounds_(propsDict_.lookupOrDefault("lowerBounds",scalarList(1,-1.0))), - upperBounds_(propsDict_.lookupOrDefault("upperBounds",scalarList(1,-1.0))), - partDeformations_(NULL) + upperBounds_(propsDict_.lookupOrDefault("upperBounds",scalarList(1,-1.0))) { - allocateMyArrays(); + particleCloud_.registerParticleProperty("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("partDeformations"); particleCloud_.dataExchangeM().allocateArray(partDeformations_,initVal,1); } @@ -147,6 +146,7 @@ void particleDeformation::setForce() const } // realloc the arrays allocateMyArrays(); + double**& partDeformations_ = particleCloud_.getParticlePropertyRef("partDeformations"); label cellI = 0; label partType = -1; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/particleDeformation/particleDeformation.H b/src/lagrangian/cfdemParticle/subModels/forceModel/particleDeformation/particleDeformation.H index ce5718cd..44cfabae 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/particleDeformation/particleDeformation.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/particleDeformation/particleDeformation.H @@ -74,8 +74,6 @@ private: scalarList upperBounds_; - mutable double **partDeformations_; - label getListIndex(label) const; void allocateMyArrays() const; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/pdCorrelation/pdCorrelation.C b/src/lagrangian/cfdemParticle/subModels/forceModel/pdCorrelation/pdCorrelation.C index d79f03d2..e5dac0bc 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/pdCorrelation/pdCorrelation.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/pdCorrelation/pdCorrelation.C @@ -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("d"); + particleCloud_.registerParticleProperty("p"); + particleCloud_.registerParticleProperty("d2"); + particleCloud_.registerParticleProperty("pd"); + particleCloud_.registerParticleProperty("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("d"); + double**& p_ = particleCloud_.getParticlePropertyRef("p"); + double**& d2_ = particleCloud_.getParticlePropertyRef("d2"); + double**& pd_ = particleCloud_.getParticlePropertyRef("pd"); + double**& cg3_ = particleCloud_.getParticlePropertyRef("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("d"); + double**& p_ = particleCloud_.getParticlePropertyRef("p"); + double**& d2_ = particleCloud_.getParticlePropertyRef("d2"); + double**& pd_ = particleCloud_.getParticlePropertyRef("pd"); + double**& cg3_ = particleCloud_.getParticlePropertyRef("cg3"); const Switch densityFromList ( diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/pdCorrelation/pdCorrelation.H b/src/lagrangian/cfdemParticle/subModels/forceModel/pdCorrelation/pdCorrelation.H index 04fb2bf0..80141183 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/pdCorrelation/pdCorrelation.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/pdCorrelation/pdCorrelation.H @@ -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_; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/potentialRelaxation/potentialRelaxation.C b/src/lagrangian/cfdemParticle/subModels/forceModel/potentialRelaxation/potentialRelaxation.C index ff8abc89..7c2330bb 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/potentialRelaxation/potentialRelaxation.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/potentialRelaxation/potentialRelaxation.C @@ -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("ignoreRegion",false)), ignoreDirection_(propsDict_.lookupOrDefault("ignoreDirection",vector::zero)), - ignorePoint_(propsDict_.lookupOrDefault("ignorePoint",vector::zero)), - vfluc_(NULL) + ignorePoint_(propsDict_.lookupOrDefault("ignorePoint",vector::zero)) { - allocateMyArrays(); - + particleCloud_.registerParticleProperty("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("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("vfluc"); + vector position(0,0,0); scalar voidfraction(0.0); vector flucU(0,0,0); label cellI=0; - + interpolationCellPoint voidfractionInterpolator_(voidfraction_); interpolationCellPoint 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_) diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/potentialRelaxation/potentialRelaxation.H b/src/lagrangian/cfdemParticle/subModels/forceModel/potentialRelaxation/potentialRelaxation.H index 81cebc5a..4388a472 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/potentialRelaxation/potentialRelaxation.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/potentialRelaxation/potentialRelaxation.H @@ -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: diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.C b/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.C index 122b50e7..6c618740 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.C @@ -69,16 +69,10 @@ virtualMassForce::virtualMassForce U_(sm.mesh().lookupObject (velFieldName_)), phiFieldName_(propsDict_.lookup("phiFieldName")), phi_(sm.mesh().lookupObject (phiFieldName_)), - UrelOld_(NULL), splitUrelCalculation_(propsDict_.lookupOrDefault("splitUrelCalculation",false)), Cadd_(0.5) { - - if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0) - { - // get memory for 2d array - particleCloud_.dataExchangeM().allocateArray(UrelOld_,NOTONCPU,3); - } + particleCloud_.registerParticleProperty("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("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("UrelOld"); particleCloud_.dataExchangeM().allocateArray(UrelOld_,NOTONCPU,3); } } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.H b/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.H index 28597d0b..41859f7d 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.H @@ -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! diff --git a/src/lagrangian/cfdemParticle/subModels/regionModel/regionModel/regionModel.C b/src/lagrangian/cfdemParticle/subModels/regionModel/regionModel/regionModel.C index b1770d07..14353790 100644 --- a/src/lagrangian/cfdemParticle/subModels/regionModel/regionModel/regionModel.C +++ b/src/lagrangian/cfdemParticle/subModels/regionModel/regionModel/regionModel.C @@ -51,6 +51,8 @@ void regionModel::reAllocArrays() const if(particleCloud_.numberOfParticlesChanged()) { // get arrays of new length + double**& inRegion_ = particleCloud_.getParticlePropertyRef("inRegion"); + double**& outRegion_ = particleCloud_.getParticlePropertyRef("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("inRegion"); + particleCloud_.registerParticleProperty("outRegion"); } @@ -83,8 +79,6 @@ regionModel::regionModel regionModel::~regionModel() { - particleCloud_.dataExchangeM().destroy(inRegion_,1); - particleCloud_.dataExchangeM().destroy(outRegion_,1); } diff --git a/src/lagrangian/cfdemParticle/subModels/regionModel/regionModel/regionModel.H b/src/lagrangian/cfdemParticle/subModels/regionModel/regionModel/regionModel.H index c087cf1f..5f985be8 100644 --- a/src/lagrangian/cfdemParticle/subModels/regionModel/regionModel/regionModel.H +++ b/src/lagrangian/cfdemParticle/subModels/regionModel/regionModel/regionModel.H @@ -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_; }; - }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/cfdemParticle/subModels/thermCondModel/ZehnerSchluenderThermCond/ZehnerSchluenderThermCond.C b/src/lagrangian/cfdemParticle/subModels/thermCondModel/ZehnerSchluenderThermCond/ZehnerSchluenderThermCond.C index 7a5b1ce9..5bce7350 100644 --- a/src/lagrangian/cfdemParticle/subModels/thermCondModel/ZehnerSchluenderThermCond/ZehnerSchluenderThermCond.C +++ b/src/lagrangian/cfdemParticle/subModels/thermCondModel/ZehnerSchluenderThermCond/ZehnerSchluenderThermCond.C @@ -54,15 +54,17 @@ ZehnerSchluenderThermCond::ZehnerSchluenderThermCond partKsField_(const_cast(sm.mesh().lookupObject (partKsFieldName_))), voidfractionFieldName_(propsDict_.lookupOrDefault("voidfractionFieldName","voidfraction")), voidfraction_(sm.mesh().lookupObject (voidfractionFieldName_)), - typeKs_(propsDict_.lookupOrDefault("thermalConductivities",scalarList(1,-1.0))), - partKs_(NULL) + typeKs_(propsDict_.lookupOrDefault("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("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("partKs"); particleCloud_.dataExchangeM().allocateArray(partKs_,initVal,1); } @@ -134,6 +136,7 @@ void ZehnerSchluenderThermCond::calcPartKsField() const } allocateMyArrays(); + double**& partKs_ = particleCloud_.getParticlePropertyRef("partKs"); label cellI=0; label partType = 0; for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) diff --git a/src/lagrangian/cfdemParticle/subModels/thermCondModel/ZehnerSchluenderThermCond/ZehnerSchluenderThermCond.H b/src/lagrangian/cfdemParticle/subModels/thermCondModel/ZehnerSchluenderThermCond/ZehnerSchluenderThermCond.H index b681483e..da7ea5f8 100644 --- a/src/lagrangian/cfdemParticle/subModels/thermCondModel/ZehnerSchluenderThermCond/ZehnerSchluenderThermCond.H +++ b/src/lagrangian/cfdemParticle/subModels/thermCondModel/ZehnerSchluenderThermCond/ZehnerSchluenderThermCond.H @@ -64,8 +64,6 @@ private: scalarList typeKs_; - mutable double **partKs_; - void allocateMyArrays() const; void calcPartKsField() const;