diff --git a/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.C b/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.C index 9ce61c26..f5a8a329 100644 --- a/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.C +++ b/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.C @@ -71,15 +71,17 @@ diffusionCoefficient::diffusionCoefficient pressureFieldName_(propsDict_.lookupOrDefault("pressureFieldName","p")), P_(sm.mesh().lookupObject(pressureFieldName_)), partPressureName_(propsDict_.lookupOrDefault("partPressureName","partP")), - partPressure_(NULL), X_(speciesNames_.size()), diffusantGasNames_(propsDict_.lookup("diffusantGasNames")), - diffusionCoefficients_(diffusantGasNames_.size(),NULL), Xdiffusant_(diffusantGasNames_.size()), initialized_(false) { particleCloud_.checkCG(false); - allocateMyArrays(); + particleCloud_.registerParticleProperty("partPressure"); + for (int i=0; i(diffusantGasNames_[i]); + } createCoeffs(); molWeightTable(); } @@ -88,35 +90,17 @@ diffusionCoefficient::diffusionCoefficient diffusionCoefficient::~diffusionCoefficient() { - particleCloud_.dataExchangeM().destroy(partPressure_,1); - for (int i=0; i 0) - { - particleCloud_.dataExchangeM().allocateArray(partPressure_,initVal,1,"nparticles"); - for (int i=0; i("partPressure"),initVal,1); for (int i=0; i(diffusantGasNames_[i]),initVal,1); } } @@ -172,6 +156,8 @@ void diffusionCoefficient::execute() interpolationCellPoint TInterpolator_(tempField_); interpolationCellPoint PInterpolator_(P_); + double**& partPressure_ = particleCloud_.getParticlePropertyRef("partPressure"); + for (int index=0; index(diffusantGasNames_[j]); TotalFraction_[j] = 0.0; dBinary_ = 0.0; @@ -243,9 +230,9 @@ void diffusionCoefficient::execute() // pass on dCoeff values to array if (TotalFraction_[j] < VSMALL) - diffusionCoefficients_[j][index][0] = VSMALL; + diffusionCoefficients_[index][0] = VSMALL; else - diffusionCoefficients_[j][index][0] = (1.0 - Xdiffusant_[j][cellI]) / TotalFraction_[j]; + diffusionCoefficients_[index][0] = (1.0 - Xdiffusant_[j][cellI]) / TotalFraction_[j]; } else { @@ -258,7 +245,7 @@ void diffusionCoefficient::execute() } if(verbose_) - Info << "diffusionCoefficient of species " << diffusantGasNames_[j] << " = " << diffusionCoefficients_[j][index][0] << endl; + Info << "diffusionCoefficient of species " << diffusantGasNames_[j] << " = " << diffusionCoefficients_[index][0] << endl; } } } @@ -268,7 +255,8 @@ void diffusionCoefficient::execute() for (int j=0; j(diffusantGasNames_[j]); + particleCloud_.dataExchangeM().giveData(pushName,"scalar-atom",diffusionCoefficients_); } Info << "give data done" << endl; diff --git a/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.H b/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.H index c8e9b1cf..add7be45 100644 --- a/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.H +++ b/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.H @@ -76,19 +76,15 @@ private: word partPressureName_; - mutable double **partPressure_; - UPtrList X_; wordList diffusantGasNames_; - mutable List diffusionCoefficients_; - UPtrList Xdiffusant_; - HashTable coeffs; + HashTable coeffs; - HashTable molWeight; + HashTable molWeight; void createCoeffs(); @@ -100,8 +96,6 @@ private: // calculate denominator part diffusion volume equation double calcDiffVol(int, int); - void allocateMyArrays() const; - bool initialized_; void init(); diff --git a/src/lagrangian/cfdemParticle/subModels/chemistryModel/massTransferCoeff/massTransferCoeff.C b/src/lagrangian/cfdemParticle/subModels/chemistryModel/massTransferCoeff/massTransferCoeff.C index 2f49a729..053aeb4c 100644 --- a/src/lagrangian/cfdemParticle/subModels/chemistryModel/massTransferCoeff/massTransferCoeff.C +++ b/src/lagrangian/cfdemParticle/subModels/chemistryModel/massTransferCoeff/massTransferCoeff.C @@ -63,42 +63,27 @@ massTransferCoeff::massTransferCoeff densityFieldName_(propsDict_.lookupOrDefault("densityFieldName","rho")), rho_(sm.mesh().lookupObject (densityFieldName_)), partNuName_(propsDict_.lookupOrDefault("partViscos","partNu")), - partNu_(NULL), partReynolds_(propsDict_.lookupOrDefault("partReynolds","partRe")), - partRe_(NULL), scaleDia_(1) { particleCloud_.checkCG(true); - allocateMyArrays(); + particleCloud_.registerParticleProperty(partNuName_); + particleCloud_.registerParticleProperty(partReynolds_); } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // massTransferCoeff::~massTransferCoeff() { - int nP_ = particleCloud_.numberOfParticles(); - - particleCloud_.dataExchangeM().destroy(partNu_,nP_); - particleCloud_.dataExchangeM().destroy(partRe_,nP_); } // * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * // -void massTransferCoeff::allocateMyArrays() const -{ - double initVal=0.0; - if (particleCloud_.dataExchangeM().maxNumberOfParticles() > 0) - { - // get memory for 2d arrays - particleCloud_.dataExchangeM().allocateArray(partNu_,initVal,1,"nparticles"); - particleCloud_.dataExchangeM().allocateArray(partRe_,initVal,1,"nparticles"); - } -} void massTransferCoeff::reAllocMyArrays() const { double initVal=0.0; - particleCloud_.dataExchangeM().allocateArray(partNu_,initVal,1); - particleCloud_.dataExchangeM().allocateArray(partRe_,initVal,1); + particleCloud_.dataExchangeM().allocateArray(particleCloud_.getParticlePropertyRef(partNuName_),initVal,1); + particleCloud_.dataExchangeM().allocateArray(particleCloud_.getParticlePropertyRef(partReynolds_),initVal,1); } // * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * // @@ -139,6 +124,9 @@ void massTransferCoeff::execute() interpolationCellPoint UluidInterpolator_(U_); interpolationCellPoint voidfractionInterpolator_(voidfraction_); + double**& partNu_ = particleCloud_.getParticlePropertyRef(partNuName_); + double**& partRe_ = particleCloud_.getParticlePropertyRef(partReynolds_); + for (int index=0; index("verbose",false)), - reactantPerParticle_(NULL), voidfractionFieldName_(propsDict_.lookupOrDefault("voidfractionFieldName","voidfraction")), voidfraction_(sm.mesh().lookupObject(voidfractionFieldName_)), particlesPerCell_ @@ -76,30 +75,21 @@ reactantPerParticle::reactantPerParticle Nevery_(propsDict_.lookupOrDefault