diff --git a/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.C b/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.C index d9dc0374..dc2fb5e2 100644 --- a/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.C +++ b/src/lagrangian/cfdemParticle/subModels/chemistryModel/diffusionCoefficients/diffusionCoefficients.C @@ -73,14 +73,12 @@ diffusionCoefficient::diffusionCoefficient P_(sm.mesh().lookupObject(pressureFieldName_)), densityFieldName_(propsDict_.lookupOrDefault("densityFieldName","rho")), rho_(sm.mesh().lookupObject (densityFieldName_)), - totalMoleFieldName_(propsDict_.lookupOrDefault("totalMoleFieldName","N")), - // needed to calculate the mixture diffusion coefficient - // dcoeff is dependent on molar fraction not mass fraction - N_(sm.mesh().lookupObject(totalMoleFieldName_)), - Y_(speciesNames_.size()), + molarConcFieldName_(propsDict_.lookupOrDefault("totalMoleFieldName","molarConc")), + molarConc_(sm.mesh().lookupObject(molarConcFieldName_)), + X_(speciesNames_.size()), diffusantGasNames_(propsDict_.lookup("diffusantGasNames")), diffusionCoefficients_(diffusantGasNames_.size(),NULL), - X_(diffusantGasNames_.size(), NULL) + initialized_(false) { Info << " Reading diffusionCoefficient list: " << diffusantGasNames_ << endl; for (int i = 0; i < diffusantGasNames_.size(); i++) @@ -88,14 +86,7 @@ diffusionCoefficient::diffusionCoefficient Info << "Diffusant names: " << diffusantGasNames_[i] << endl; } - for (int i=0; i - (sm.mesh().lookupObject(speciesNames_[i])); - Y_.set(i, &Y); - particleCloud_.checkCG(false); - } - + particleCloud_.checkCG(false); allocateMyArrays(); createCoeffs(); molWeightTable(); @@ -112,7 +103,6 @@ diffusionCoefficient::~diffusionCoefficient() for (int i=0; i + (mesh_.lookupObject("X_"+speciesNames_[i])); + X_.set(i, &X); + + Info << "The molar fraction fields (X_i): \n" << X_[i].name() << endl; + } + initialized_ = true; +} + // * * * * * * * * * * * * * * * * Member Fct * * * * * * * * * * * * * * * // void diffusionCoefficient::execute() { + if (!initialized_) + { + init(); + } + // realloc the arrays reAllocMyArrays(); label cellI=0; scalar Tfluid(0); scalar rhofluid(0); - List Yfluid_; - Yfluid_.setSize(speciesNames_.size()); - scalar Pfluid(0); - scalar Nfluid(0); - scalar Texp(0); - // for total stagnant gas molar fractions - List Xstag_tot; - Xstag_tot.setSize(diffusantGasNames_.size()); - // for adding gases one by one. List Xfluid_; Xfluid_.setSize(speciesNames_.size()); + scalar Pfluid(0); + scalar molarConcfluid(0); + scalar Texp(0); List dBinarytot_; dBinarytot_.setSize(diffusantGasNames_.size()); List dCoeff_; dCoeff_.setSize(diffusantGasNames_.size()); - /* List dBinary_; - dBinary_.setSize(diffusantGasNames_.size()); */ double **dBinary_ = new double*[diffusantGasNames_.size()]; double **molNum_ = new double*[diffusantGasNames_.size()]; @@ -180,7 +186,7 @@ void diffusionCoefficient::execute() interpolationCellPoint TInterpolator_(tempField_); interpolationCellPoint rhoInterpolator_(rho_); interpolationCellPoint PInterpolator_(P_); - interpolationCellPoint NInterpolator_(N_); + interpolationCellPoint molarConcInterpolator_(molarConc_); for (int index=0; index 0.0) + if (1-Xfluid_[i] > 0.0) { calcMolNum(i,j,molNum_); calcDiffVol(i,j,volDiff_); @@ -327,7 +330,7 @@ void diffusionCoefficient::execute() for(int i =0; i. Copyright (C) 2015- Thomas Lichtenegger, JKU Linz, Austria - + Description Model to communicate species concentration and changes due to reactions @@ -77,22 +77,20 @@ private: const volScalarField& rho_; // total mole field - word totalMoleFieldName_; + word molarConcFieldName_; - const volScalarField& N_; + const volScalarField& molarConc_; - UPtrList Y_; + UPtrList X_; wordList diffusantGasNames_; - - mutable List diffusionCoefficients_; - mutable List X_; + mutable List diffusionCoefficients_; HashTable coeffs; HashTable molWeight; - + void createCoeffs(); void molWeightTable(); @@ -105,6 +103,10 @@ private: void allocateMyArrays() const; + bool initialized_; + + void init(); + public: //- Runtime type information diff --git a/src/lagrangian/cfdemParticle/subModels/chemistryModel/species/species.C b/src/lagrangian/cfdemParticle/subModels/chemistryModel/species/species.C index e3e682c8..ba93139f 100644 --- a/src/lagrangian/cfdemParticle/subModels/chemistryModel/species/species.C +++ b/src/lagrangian/cfdemParticle/subModels/chemistryModel/species/species.C @@ -148,7 +148,6 @@ void species::allocateMyArrays() const } } - void species::reAllocMyArrays() const { if (particleCloud_.numberOfParticlesChanged()) diff --git a/src/lagrangian/cfdemParticle/subModels/chemistryModel/species/species.H b/src/lagrangian/cfdemParticle/subModels/chemistryModel/species/species.H index 286b934c..49248254 100644 --- a/src/lagrangian/cfdemParticle/subModels/chemistryModel/species/species.H +++ b/src/lagrangian/cfdemParticle/subModels/chemistryModel/species/species.H @@ -147,10 +147,6 @@ public: tmp Sm() const; - - - - };