From 60c1104feae6c7b1e9c3ce901c04162cb6a01858 Mon Sep 17 00:00:00 2001 From: ignis Date: Fri, 11 May 2018 15:37:28 +0900 Subject: [PATCH] skeletal ion transport model --- diffusivityModel/Ion/Ion.C | 39 ++--- diffusivityModel/Ion/Ion.H | 40 +++-- diffusivityModel/Ion/IonI.H | 44 ++---- .../diffusivityModel/diffusivityModel.C | 139 ++++++++++++++++-- .../diffusivityModel/diffusivityModel.H | 3 +- 5 files changed, 177 insertions(+), 88 deletions(-) diff --git a/diffusivityModel/Ion/Ion.C b/diffusivityModel/Ion/Ion.C index 080db99..487e390 100644 --- a/diffusivityModel/Ion/Ion.C +++ b/diffusivityModel/Ion/Ion.C @@ -47,31 +47,14 @@ License Foam::Ion::Ion(const dictionary& dict) : Particle(dict), - wellDepth_(dict.lookupOrDefault("wellDepth", 0.0)), - diameter_(dict.lookupOrDefault("diameter", 0.0)), - dipoleMoment_(dict.lookupOrDefault("dipoleMoment", 0.0)), alpha_(dict.lookupOrDefault("dipolePolarizability", 0.0)), - alphaQ_(dict.lookupOrDefault("quadpolePolarizability", 0.0)), C6_(dict.lookupOrDefault("dispersionCoef", 0.0)), - Zrot_(dict.lookupOrDefault("rotationalRelaxation", 0.0)) -{ - - const entry* entryPtr = dict.lookupEntryPtr("tranlib", false, true); - - if (entryPtr) - { - scalarList tranlib(entryPtr->stream()); - - wellDepth_ = tranlib[1]; - diameter_ = tranlib[2]; - dipoleMoment_ = tranlib[3]; - alpha_ = tranlib[4]; - // alphaQ_ = tranlib[0]; - // C6_ = tranlib[0]; - Zrot_ = tranlib[5]; - } - -} + Zrot_(dict.lookupOrDefault("rotationalRelaxation", 0.0)), + n_(dict.lookupOrDefault("nStockmayer", 12)), + rctTarget_(dict.lookupOrDefault("rctTargets", hashedWordList())), + Arct_(dict.lookupOrDefault("Arct", scalarList())), + Brct_(dict.lookupOrDefault("Brct", scalarList())) +{} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -104,13 +87,13 @@ void Foam::Ion::operator=(const Ion& rhs) Foam::Ostream& Foam::operator<<(Ostream& os, const Ion& st) { os << static_cast(st) << tab - << st.wellDepth_ << tab - << st.diameter_ << tab - << st.dipoleMoment_ << tab << st.alpha_ << tab - << st.alphaQ_ << tab << st.C6_ << tab - << st.Zrot_; + << st.Zrot_ << tab + << st.n_ << tab + << st.rctTarget_ << tab + << st.Arct_ << tab + << st.Brct_; os.check("Ostream& operator<<(Ostream& os, const specie& st)"); return os; diff --git a/diffusivityModel/Ion/Ion.H b/diffusivityModel/Ion/Ion.H index f728bda..4db7a0d 100644 --- a/diffusivityModel/Ion/Ion.H +++ b/diffusivityModel/Ion/Ion.H @@ -37,6 +37,8 @@ SourceFiles #define Ion_H #include "Particle.H" +#include "hashedWordList.H" +#include "scalarList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,28 +65,27 @@ class Ion { // Private data - //- Lenard-Jones parameter - potential well depth - //- epsilon / kB [K] - scalar wellDepth_; - - //- Lenard-Jones parameter - collision diameter [Angstrom] - scalar diameter_; - - //- Dipole moment [Debye] - scalar dipoleMoment_; - //- Dipole polarizability [Angstrom^3] scalar alpha_; - //- Quadrupole polarizability [] - scalar alphaQ_; - //- Dispersion coefficient [] scalar C6_; //- Rotational relaxation collision number [-] scalar Zrot_; + //- Stockmayer parameter n of (n,6,4) + scalar n_; + + //- Resonant charge transfer targets + hashedWordList rctTarget_; + + //- Resonant charge transfer parameter A + scalarList Arct_; + + //- Resonant charge transfer parameter B + scalarList Brct_; + // Private Member Functions @@ -122,22 +123,19 @@ public: // Member Functions // Access - inline scalar wellDepth() const; - - inline scalar diameter() const; - - inline scalar dipoleMoment() const; - inline scalar alpha() const; - inline scalar alphaQ() const; - inline scalar C6() const; inline scalar Zrot() const; inline scalar Zrot(scalar T) const; + inline scalar Arct(const word &target) const; + + inline scalar Brct(const word &target) const; + + // Check // Edit diff --git a/diffusivityModel/Ion/IonI.H b/diffusivityModel/Ion/IonI.H index db6f423..0dddb69 100644 --- a/diffusivityModel/Ion/IonI.H +++ b/diffusivityModel/Ion/IonI.H @@ -36,27 +36,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline Foam::scalar Foam::Ion::wellDepth() - const -{ - return wellDepth_; -} - - -inline Foam::scalar Foam::Ion::diameter() - const -{ - return diameter_ * Angstrom; -} - - -inline Foam::scalar Foam::Ion::dipoleMoment() - const -{ - return dipoleMoment_ * Debye; -} - - inline Foam::scalar Foam::Ion::alpha() const { @@ -64,13 +43,6 @@ inline Foam::scalar Foam::Ion::alpha() } -inline Foam::scalar Foam::Ion::alphaQ() - const -{ - return alphaQ_; -} - - inline Foam::scalar Foam::Ion::C6() const { @@ -84,9 +56,11 @@ inline Foam::scalar Foam::Ion::Zrot() return Zrot_; } + inline Foam::scalar Foam::Ion::Zrot(const scalar T) const { + scalar wellDepth_ = 0.0; scalar a3 = sqrt(pow3(pi)); scalar a1 = a3/2.0; scalar a2 = sqr(pi) / 4.0 + 2.0; @@ -99,6 +73,20 @@ inline Foam::scalar Foam::Ion::Zrot(const scalar T) } +inline Foam::scalar Foam::Ion::Arct(const word &target) + const +{ + return Arct_[rctTarget_[target]]; +} + + +inline Foam::scalar Foam::Ion::Brct(const word &target) + const +{ + return Brct_[rctTarget_[target]]; +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // diff --git a/diffusivityModel/diffusivityModel/diffusivityModel.C b/diffusivityModel/diffusivityModel/diffusivityModel.C index 2cff8c3..1235d2f 100644 --- a/diffusivityModel/diffusivityModel/diffusivityModel.C +++ b/diffusivityModel/diffusivityModel/diffusivityModel.C @@ -31,6 +31,7 @@ License #include "scalarMatrices.H" #include "Particle.H" #include "Neutral.H" +#include "Ion.H" #include "Stockmayer.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -110,6 +111,7 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo) thermo_(thermo), D_(thermo_.composition().species().size()), neutrals_(thermo_.composition().species().size()), + ions_(thermo_.composition().species().size()), nns_(thermo_.composition().species().size()*thermo_.composition().species().size()) { @@ -144,9 +146,9 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo) Particle p(tranDict); - Info << tranDict << endl; - Info << p << endl; - Info << scalarList(tranDict["tranlib"]) << endl; + // Info << tranDict << endl; + // Info << p << endl; + // Info << scalarList(tranDict["tranlib"]) << endl; // Electron if (species_[i] == "E-") @@ -170,6 +172,9 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo) } readIons = true; + + ions_.set(nIon, new Ion(tranDict)); + nIon++; // new Ion (tranDict); @@ -185,9 +190,16 @@ Foam::diffusivityModel::diffusivityModel(const psiReactionThermo& thermo) } } + ions_.resize(nIon); + neutrals_.resize(nNeutral); nns_.resize(nNeutral*(nNeutral+1)/2); + // cns_.resize(nNeutral*nIon); + // ccs_.resize((nIon+1)*(nIon+2)/2 - 1); + // ens_.resize(nNeutral); + // ee_; + forAll(species_, i) { const label zi = thermo_.composition().z(i); @@ -331,6 +343,7 @@ void Foam::diffusivityModel::correct() const volScalarField &T = thermo_.T(); const volScalarField &p = thermo_.p(); const volScalarField rho(thermo_.rho()); + const volScalarField Cp(thermo_.Cp()); const speciesTable &species_(thermo_.composition().species()); @@ -356,9 +369,29 @@ void Foam::diffusivityModel::correct() scalarField muI(species_.size()); scalarField kI(species_.size()); + scalarField dof(species_.size()); + scalarField::subField dofI(dof, ions_.size(), 1); + scalarField::subField dofN(dof, neutrals_.size(), ions_.size()+1); + + dof[0] = 0; + forAll (ions_, i) + { + // dofI[i] = ions_[i].F(); + dofI[i] = 0.0; + } + forAll (neutrals_, i) + { + dofN[i] = neutrals_[i].F(); + } + + scalarField Zrot(species_.size()); + scalarField::subField ZrotI(Zrot, ions_.size(), 1); + scalarField::subField ZrotN(Zrot, neutrals_.size(), ions_.size()+1); + forAll (p, celli) { const scalar rhoi = rho[celli]; + const scalar Cpi = Cp[celli]; const scalar pi = p[celli]; const scalar Ti = T[celli]; const scalar WbarI = Wbar[celli]; @@ -374,16 +407,100 @@ void Foam::diffusivityModel::correct() localX[i] = Y[i][celli] * WbarI / Wpure[i]; } - label idx = 0; - - forAll (species_, i) + Zrot[0] = 0; + forAll (ions_, i) { + // ZrotI[i] = ions_[i].Zrot(Ti); + ZrotI[i] = 0.0; + } + forAll (neutrals_, i) + { + ZrotN[i] = neutrals_[i].Zrot(Ti); + } + + // Electron - Electron + + // muI[0] = nns_[idx].mu(pi,Ti); + muI[0] = SMALL; + + // Dii[0] = nns_[idx].D(pi,Ti); + Dii[0] = SMALL; + Dij(0,0) = Dii[0]; + + label idx = 0; + // Electron - Ions + for (label J = 0; J < ions_.size(); J++) + { + label j = J + 1; + // Calculate Dij + // Dij(0,j) = nns_[idx].D(pi,Ti); + Dij(0,j) = SMALL; + Dij(j,0) = Dij(0,j); + idx++; + } + + idx = 0; + // Electron - Neutrals + for (label J = 0; J < neutrals_.size(); J++) + { + label j = J + ions_.size() + 1; + // Calculate Dij + // Dij(0,j) = nns_[idx].D(pi,Ti); + Dij(0,j) = SMALL; + Dij(j,0) = Dij(0,j); + idx++; + } + + // Ions + label idx1 = 0; + label idx2 = 0; + forAll (ions_, I) + { + label i = I + 1; + + // muI[i] = nns_[idx1].mu(pi,Ti); + muI[i] = SMALL; + + // Dii[i] = nns_[idx1].D(pi,Ti); + Dii[i] = SMALL; + Dij(i,i) = Dii[i]; + idx1++; + + // Ion - Ions + for (label J = I+1; J < ions_.size(); J++) + { + label j = J + 1; + // Calculate Dij + // Dij(i,j) = nns_[idx1].D(pi,Ti); + Dij(i,j) = SMALL; + Dij(j,i) = Dij(i,j); + idx1++; + } + + // Ion - Neutrals + for (label j = ions_.size()+1; j < species_.size(); j++) + { + // Calculate Dij + // Dij(i,j) = nns_[idx2].D(pi,Ti); + Dij(i,j) = SMALL; + Dij(j,i) = Dij(i,j); + idx2++; + } + } + + // Neutrals + idx = 0; + forAll (neutrals_, I) + { + label i = I + 1 + ions_.size(); + muI[i] = nns_[idx].mu(pi,Ti); Dii[i] = nns_[idx].D(pi,Ti); Dij(i,i) = Dii[i]; idx++; + // Neutral - Neutrals for (label j = i+1; j < species_.size(); j++) { // Calculate Dij @@ -393,18 +510,19 @@ void Foam::diffusivityModel::correct() } } + + // Pure Thermal conductivity forAll (species_, i) { const scalar R = Neutral::RR / Wpure[i]; const scalar CvTrans = (3./2.)*R; - const scalar CvRot = (neutrals_[i].F()/2.)*R; + const scalar CvRot = (dof[i]/2.)*R; const scalar CvVib = localCv[i] - CvTrans - CvRot; const scalar rSc = rhoi * Dii[i] / muI[i]; const scalar A = 5./2. - rSc; - const scalar Zrot = neutrals_[i].Zrot(Ti); - const scalar B = Zrot + (2./Neutral::pi) * ((5./3.)*CvRot + rSc); + const scalar B = Zrot[i] + (2./Neutral::pi) * ((5./3.)*CvRot + rSc); const scalar AB = (2./Neutral::pi)*(A/B); const scalar fTrans = (5./2.) * (1.0 - AB * CvRot / CvTrans); @@ -415,6 +533,7 @@ void Foam::diffusivityModel::correct() } + // Pure Condition Test ( Xi = 1 ) Switch pure = false; label pureSpecieI = -1; forAll (species_, i) @@ -446,7 +565,7 @@ void Foam::diffusivityModel::correct() } mu_()[celli] = mixAvgMu(muI, localX, Wpure); - k_()[celli] = mixAvgK(kI, localX); + k_()[celli] = mixAvgK(kI, localX) / rhoi / Cpi; } return; diff --git a/diffusivityModel/diffusivityModel/diffusivityModel.H b/diffusivityModel/diffusivityModel/diffusivityModel.H index 67e8bfa..ad67466 100644 --- a/diffusivityModel/diffusivityModel/diffusivityModel.H +++ b/diffusivityModel/diffusivityModel/diffusivityModel.H @@ -47,6 +47,7 @@ namespace Foam // Forward declaration of classes class Neutral; +class Ion; class Stockmayer; // Forward declaration of friend functions and operators @@ -77,7 +78,7 @@ class diffusivityModel // autoPtr electron_; //- Ion object list - // PtrList ions_; + PtrList ions_; //- Neutral object list PtrList neutrals_;