SLFMFoam selecting species to postprocess #2

Merged
park0d merged 1 commit from slfm-select-post-species into master 2017-08-04 00:47:12 +09:00
5 changed files with 30 additions and 13 deletions

View file

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
postSpeciesN 2; //number of species for post-processing
postSpecieNames (CO OH); //names of species for post-processing
stoiMF 0.351; //stoichiometric mixture fraction
stretchFactor 1.05;
lowerN 20; //number of eta-space under stoichiometric value

View file

@ -90,12 +90,14 @@ int main(int argc, char *argv[])
turbulence->correct();
#include "updateYi.H" //update species
if(runTime.write() == true)
{
rho.write();
#include "updateYi.H" //update species
for(label y=0 ; y<postSpeciesN ; y++)
forAll(postSpecieIndices, yi)
{
const label y = postSpecieIndices[yi];
Y[y].write();
}
}

View file

@ -12,6 +12,10 @@ thermo.validate(args.executable(), "h", "e");
basicSpecieMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
forAll (Y, i)
{
Y[i].writeOpt() = IOobject::NO_WRITE;
}
word inertSpecie(thermo.lookup("inertSpecie"));
@ -291,7 +295,15 @@ IOdictionary SLFMdict //SLFM properties dictionary
);
label Ysize = Y.size();
scalar postSpeciesN(readScalar(SLFMdict.lookup("postSpeciesN")));
wordList postSpecieNames(SLFMdict.lookup("postSpecieNames"));
labelList postSpecieIndices(postSpecieNames.size(),-1);
forAll(postSpecieNames, i)
{
const word &spName (postSpecieNames[i]);
const label spI (composition.species()[spName]);
postSpecieIndices[i] = spI;
Y[spI].writeOpt() = IOobject::AUTO_WRITE;
}
scalar stoiMF(readScalar(SLFMdict.lookup("stoiMF")));
scalar stretchFac(readScalar(SLFMdict.lookup("stretchFactor")));
scalar lowerN(readScalar(SLFMdict.lookup("lowerN")));

View file

@ -26,9 +26,9 @@ scalarFieldArray2d Rtable
scalarFieldArray3d Ytable
(
postSpeciesN,
postSpecieNames.size(),
scalarFieldArray2d
(
(
etamax+1,
scalarFieldArray1d
(
@ -55,9 +55,10 @@ for(label j=0 ; j<=etamax ; j++)
{
Ttable[j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, Y_SLFM[n][Ysize]);
Rtable[j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, Rgas_SLFM[n]);
for(label y=0 ; y<postSpeciesN ; y++)
forAll(postSpecieIndices, yi)
{
Ytable[y][j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, Y_SLFM[n][y]);
const label y = postSpecieIndices[yi];
Ytable[yi][j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, Y_SLFM[n][y]);
}
}
}

View file

@ -31,12 +31,13 @@ forAll(rho, cellI)
scalar jfac = jfc[cellI], vfac = vfc[cellI], nfac = nfc[cellI];
for(label y=0 ; y<postSpeciesN ; y++)
forAll(postSpecieIndices, yi)
{
scalar y00 = Ytable[y][jl][vl][nl]*(1-jfac)+Ytable[y][jh][vl][nl]*jfac;
scalar y01 = Ytable[y][jl][vl][nh]*(1-jfac)+Ytable[y][jh][vl][nh]*jfac;
scalar y10 = Ytable[y][jl][vh][nl]*(1-jfac)+Ytable[y][jh][vh][nl]*jfac;
scalar y11 = Ytable[y][jl][vh][nh]*(1-jfac)+Ytable[y][jh][vh][nh]*jfac;
const label y = postSpecieIndices[yi];
scalar y00 = Ytable[yi][jl][vl][nl]*(1-jfac)+Ytable[yi][jh][vl][nl]*jfac;
scalar y01 = Ytable[yi][jl][vl][nh]*(1-jfac)+Ytable[yi][jh][vl][nh]*jfac;
scalar y10 = Ytable[yi][jl][vh][nl]*(1-jfac)+Ytable[yi][jh][vh][nl]*jfac;
scalar y11 = Ytable[yi][jl][vh][nh]*(1-jfac)+Ytable[yi][jh][vh][nh]*jfac;
scalar y0 = y00*(1-vfac)+y10*vfac;
scalar y1 = y01*(1-vfac)+y11*vfac;
@ -48,8 +49,9 @@ forAll(rho, cellI)
}
//correct processor boundary value of T and rho
for(label y=0 ; y<postSpeciesN ; y++)
forAll(postSpecieIndices, yi)
{
const label y = postSpecieIndices[yi];
Y[y].correctBoundaryConditions();
}