pass GasState state to calculateK in diffusivityModel, move Zrot calculation into calculateK

This commit is contained in:
Yeongdo Park 2018-11-04 17:36:52 -05:00
parent 0c7bf3027a
commit a95508b37b
2 changed files with 18 additions and 67 deletions

View file

@ -302,7 +302,18 @@ void Foam::diffusivityModel::calculateK
UList<scalar> &kI,
const UList<scalar> &muI,
const UList<scalar> &Dii,
const UList<scalar> &Zrot,
const GasState &state
)
{
calculateK(kI, muI, Dii, state.rho(), state.p(), state.T());
}
void Foam::diffusivityModel::calculateK
(
UList<scalar> &kI,
const UList<scalar> &muI,
const UList<scalar> &Dii,
const scalar rhoi,
const scalar pi,
const scalar Ti
@ -317,7 +328,7 @@ void Foam::diffusivityModel::calculateK
const scalar rSc = rhoi * Dii[0] / muI[0];
const scalar A = 5./2. - rSc;
const scalar B = Zrot[0] + (2./Neutral::pi) * ((5./3.)*electron_->CvRot()/electron_->R() + 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());
@ -335,7 +346,7 @@ void Foam::diffusivityModel::calculateK
const scalar rSc = rhoi * Dii[i] / muI[i];
const scalar A = 5./2. - rSc;
const scalar B = Zrot[i] + (2./Neutral::pi) * ((5./3.)*ions_[j].CvRot()/ions_[j].R() + 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());
@ -354,7 +365,7 @@ void Foam::diffusivityModel::calculateK
const scalar rSc = rhoi * Dii[i] / muI[i];
const scalar A = 5./2. - rSc;
const scalar B = Zrot[i] + (2./Neutral::pi) * ((5./3.)*neutrals_[j].CvRot()/neutrals_[j].R() + 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());
@ -668,16 +679,11 @@ void Foam::diffusivityModel::correct()
{
const volScalarField &T = thermo_.T();
const volScalarField &p = thermo_.p();
const volScalarField rho(thermo_.rho());
const speciesTable &species_(thermo_.composition().species());
const volScalarField Wbar(thermo_.composition().W());
const PtrList<volScalarField> &Y(thermo_.composition().Y());
const volScalarField rhoQc2(thermo_.composition().Qc2() * rho);
scalarField Wpure(species_.size());
forAll (Wpure, i)
{
@ -694,18 +700,11 @@ void Foam::diffusivityModel::correct()
scalarField muI(species_.size());
scalarField kI(species_.size());
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 pi = p[celli];
const scalar Ti = T[celli];
const scalar WbarI = Wbar[celli];
const scalar rhoQc2i = rhoQc2[celli];
forAll (species_, i)
{
@ -723,28 +722,8 @@ void Foam::diffusivityModel::correct()
Dii[i] = Dij(i,i);
}
if (electron_.valid())
{
Zrot[0] = 0;
forAll (ions_, i)
{
ZrotI[i] = ions_[i].Zrot(Ti);
}
forAll (neutrals_, i)
{
ZrotN[i] = neutrals_[i].Zrot(Ti);
}
}
else
{
forAll (neutrals_, i)
{
Zrot[i] = neutrals_[i].Zrot(Ti);
}
}
// Pure Thermal conductivities
calculateK ( kI, muI, Dii, Zrot, rhoi, pi, Ti);
calculateK ( kI, muI, Dii, state);
mixAvgDi(Di, Dij, localX, localY);
forAll (Di, i)
@ -759,19 +738,13 @@ void Foam::diffusivityModel::correct()
forAll(p.boundaryField(), patchi)
{
const volScalarField::Patch &rhop = rho.boundaryField()[patchi];
const volScalarField::Patch &pp = p.boundaryField()[patchi];
const volScalarField::Patch &Tp = T.boundaryField()[patchi];
const volScalarField::Patch &Wbarp = Wbar.boundaryField()[patchi];
const volScalarField::Patch &rhoQc2p = rhoQc2.boundaryField()[patchi];
forAll(rhop, facei)
forAll(pp, facei)
{
const scalar rhoi = rhop[facei];
const scalar pi = pp[facei];
const scalar Ti = Tp[facei];
const scalar WbarI = Wbarp[facei];
const scalar rhoQc2i = rhoQc2p[facei];
forAll (species_, i)
{
@ -790,28 +763,8 @@ void Foam::diffusivityModel::correct()
}
if (electron_.valid())
{
Zrot[0] = 0;
forAll (ions_, i)
{
ZrotI[i] = ions_[i].Zrot(Ti);
}
forAll (neutrals_, i)
{
ZrotN[i] = neutrals_[i].Zrot(Ti);
}
}
else
{
forAll (neutrals_, i)
{
Zrot[i] = neutrals_[i].Zrot(Ti);
}
}
// Pure Thermal conductivities
calculateK ( kI, muI, Dii, Zrot, rhoi, pi, Ti);
calculateK ( kI, muI, Dii, state);
mixAvgDi(Di, Dij, localX, localY);
forAll (Di, i)

View file

@ -144,7 +144,6 @@ class diffusivityModel
UList<scalar> &kI,
const UList<scalar> &muI,
const UList<scalar> &Dii,
const UList<scalar> &Zrot,
const scalar rhoi,
const scalar pi,
const scalar Ti
@ -162,7 +161,6 @@ class diffusivityModel
UList<scalar> &kI,
const UList<scalar> &muI,
const UList<scalar> &Dii,
const UList<scalar> &Zrot,
const GasState &state
);