From 093153e83df3820bcc6685cdfe8353da1a6768a3 Mon Sep 17 00:00:00 2001 From: Yeongdo Park Date: Sun, 25 Nov 2018 16:46:19 -0500 Subject: [PATCH] extract thermal conductivity calculation to Particle class methods --- diffusivityModel/Ion/Ion.H | 3 ++ diffusivityModel/Ion/IonI.H | 8 +++ diffusivityModel/Neutral/Neutral.H | 2 + diffusivityModel/Neutral/NeutralI.H | 7 +++ diffusivityModel/Particle/Particle.H | 7 +++ diffusivityModel/Particle/ParticleI.H | 26 ++++++++++ .../diffusivityModel/diffusivityModel.C | 50 ++----------------- 7 files changed, 58 insertions(+), 45 deletions(-) diff --git a/diffusivityModel/Ion/Ion.H b/diffusivityModel/Ion/Ion.H index d3a16d5..8e8dc23 100644 --- a/diffusivityModel/Ion/Ion.H +++ b/diffusivityModel/Ion/Ion.H @@ -37,6 +37,7 @@ SourceFiles #define Ion_H #include "Particle.H" + #include "hashedWordList.H" #include "scalarList.H" @@ -136,6 +137,8 @@ public: inline scalar Zrot(const GasState &state) const; + inline scalar lambda(const scalar mu, const scalar D, const GasState &state) const; + inline bool hasRct(const word &target) const; inline scalar Arct(const word &target) const; diff --git a/diffusivityModel/Ion/IonI.H b/diffusivityModel/Ion/IonI.H index a372c66..f32fcfa 100644 --- a/diffusivityModel/Ion/IonI.H +++ b/diffusivityModel/Ion/IonI.H @@ -68,6 +68,14 @@ inline Foam::scalar Foam::Ion::Zrot(const GasState &state) } +inline Foam::scalar Foam::Ion::lambda(const scalar mu, const scalar D, const GasState &state) + const +{ + return Particle::lambda(mu, D, Zrot(state), state); +} + + + inline bool Foam::Ion::hasRct(const word &target) const { diff --git a/diffusivityModel/Neutral/Neutral.H b/diffusivityModel/Neutral/Neutral.H index 5b1f49a..ba30223 100644 --- a/diffusivityModel/Neutral/Neutral.H +++ b/diffusivityModel/Neutral/Neutral.H @@ -133,6 +133,8 @@ public: inline scalar Zrot(scalar T) const; + inline scalar lambda(const scalar mu, const scalar D, const GasState &state) const; + // Check // Edit diff --git a/diffusivityModel/Neutral/NeutralI.H b/diffusivityModel/Neutral/NeutralI.H index 8858301..23aa519 100644 --- a/diffusivityModel/Neutral/NeutralI.H +++ b/diffusivityModel/Neutral/NeutralI.H @@ -85,6 +85,13 @@ inline Foam::scalar Foam::Neutral::Zrot(const scalar T) } +inline Foam::scalar Foam::Neutral::lambda(const scalar mu, const scalar D, const GasState &state) + const +{ + return Particle::lambda(mu, D, Zrot(state.T()), state); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // diff --git a/diffusivityModel/Particle/Particle.H b/diffusivityModel/Particle/Particle.H index 50e206f..005913e 100644 --- a/diffusivityModel/Particle/Particle.H +++ b/diffusivityModel/Particle/Particle.H @@ -40,6 +40,8 @@ SourceFiles #include "scalar.H" #include "thermoPhysicsTypes.H" +#include "GasState.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -183,6 +185,11 @@ public: inline scalar AB(const scalar rSc) const; inline scalar fTrans(const scalar rSc) const; + + inline scalar lambda(const scalar mu, const scalar D, const GasState &state) const; + + inline scalar lambda(const scalar mu, const scalar D, const scalar Zrot, const GasState &state) const; + // Check // Edit diff --git a/diffusivityModel/Particle/ParticleI.H b/diffusivityModel/Particle/ParticleI.H index edb267f..d5930a9 100644 --- a/diffusivityModel/Particle/ParticleI.H +++ b/diffusivityModel/Particle/ParticleI.H @@ -25,6 +25,8 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "Particle.H" + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -142,6 +144,30 @@ inline Foam::scalar Foam::Particle::fTrans(const scalar rSc) } +inline Foam::scalar Foam::Particle::lambda(const scalar mu, const scalar D, const scalar Zrot, const GasState &state) + const +{ + const scalar rSc = state.rho() * D / mu; + + const scalar A = 5./2. - rSc; + const scalar B = Zrot + (2./pi) * ((5./3.)*CvRot()/R() + rSc); + const scalar AB = (2./pi) * (A/B); + + const scalar fTrans = (5./2.) * (1.0 - AB * CvRot() / CvTrans()); + const scalar fRot = rSc * (1.0 + AB); + const scalar fVib = rSc; + + return (mu/W()) * (fTrans*CvTrans() + fRot*CvRot() + fVib*CvVib(state.p(), state.T())); +} + + +inline Foam::scalar Foam::Particle::lambda(const scalar mu, const scalar D, const GasState &state) + const +{ + return lambda(mu, D, 0.0, state); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // diff --git a/diffusivityModel/diffusivityModel/diffusivityModel.C b/diffusivityModel/diffusivityModel/diffusivityModel.C index f823215..6723ced 100644 --- a/diffusivityModel/diffusivityModel/diffusivityModel.C +++ b/diffusivityModel/diffusivityModel/diffusivityModel.C @@ -296,67 +296,28 @@ void Foam::diffusivityModel::calculateK const GasState &state ) { - const scalar rhoi = state.rho(); - const scalar pi = state.p(); - const scalar Ti = state.T(); - label ionStart = 0; if (electron_.valid()) { ionStart = 1; - const scalar rSc = rhoi * Dii[0] / muI[0]; - - const scalar A = 5./2. - rSc; - const scalar B = (2./Neutral::pi) * ((5./3.)*electron_->CvRot()/electron_->R() + rSc); - const scalar AB = (2./Neutral::pi)*(A/B); - - const scalar fTrans = (5./2.) * (1.0 - AB * electron_->CvRot() / electron_->CvTrans()); - const scalar fRot = rSc*(1.0 + AB); - const scalar fVib = rSc; - - kI[0] = (muI[0]/electron_->W()) * - (fTrans*electron_->CvTrans() + fRot*electron_->CvRot() + fVib*electron_->CvVib(pi, Ti)); + kI[0] = electron_->lambda(muI[0], Dii[0], state); } forAll (ions_, j) { label i = j + ionStart; - const scalar rSc = rhoi * Dii[i] / muI[i]; - - const scalar A = 5./2. - rSc; - const scalar B = ions_[j].Zrot(Ti) + (2./Neutral::pi) * ((5./3.)*ions_[j].CvRot()/ions_[j].R() + rSc); - const scalar AB = (2./Neutral::pi)*(A/B); - - const scalar fTrans = (5./2.) * (1.0 - AB * ions_[j].CvRot() / ions_[j].CvTrans()); - const scalar fRot = rSc*(1.0 + AB); - const scalar fVib = rSc; - - kI[i] = (muI[i]/ions_[j].W()) * - (fTrans*ions_[j].CvTrans() + fRot*ions_[j].CvRot() + fVib*ions_[j].CvVib(pi, Ti)); - + kI[i] = ions_[j].lambda(muI[i], Dii[i], state); } forAll (neutrals_, j) { label i = j + ionStart + ions_.size(); - const scalar rSc = rhoi * Dii[i] / muI[i]; - - const scalar A = 5./2. - rSc; - const scalar B = neutrals_[j].Zrot(Ti) + (2./Neutral::pi) * ((5./3.)*neutrals_[j].CvRot()/neutrals_[j].R() + rSc); - const scalar AB = (2./Neutral::pi)*(A/B); - - const scalar fTrans = (5./2.) * (1.0 - AB * neutrals_[j].CvRot() / neutrals_[j].CvTrans()); - const scalar fRot = rSc*(1.0 + AB); - const scalar fVib = rSc; - - kI[i] = (muI[i]/neutrals_[j].W()) * - (fTrans*neutrals_[j].CvTrans() + fRot*neutrals_[j].CvRot() + fVib*neutrals_[j].CvVib(pi, Ti)); + kI[i] = neutrals_[j].lambda(muI[i], Dii[i], state); } - } @@ -676,7 +637,6 @@ void Foam::diffusivityModel::correct() forAll (p, celli) { - const scalar pi = p[celli]; const scalar Ti = T[celli]; @@ -712,8 +672,8 @@ void Foam::diffusivityModel::correct() forAll(p.boundaryField(), patchi) { - const volScalarField::Patch &pp = p.boundaryField()[patchi]; - const volScalarField::Patch &Tp = T.boundaryField()[patchi]; + const volScalarField::Patch &pp = p.boundaryField()[patchi]; + const volScalarField::Patch &Tp = T.boundaryField()[patchi]; forAll(pp, facei) {