etaGrid for integration and class FlameStructure

This commit is contained in:
ignis 2017-08-23 01:27:06 +09:00
parent e55b76e3bb
commit 44698c3f7a
9 changed files with 491 additions and 51 deletions

View file

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "FlameStructure.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// const Foam::CMC::dataType Foam::CMC::FlameStructure::staticData();
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::CMC::FlameStructure::FlameStructure(const dictionary &dict, const label nEta, const label nY)
:
// baseClassName(),
NstDir_(dict.lookup("NstFolder")),
NstList_(dict.lookup("NstList")),
Y_(nY, scalarFieldArray1d(NstList_.size(), scalarField(nEta, 0.0))),
W_(nY, scalarFieldArray1d(NstList_.size(), scalarField(nEta, 0.0))),
T_(NstList_.size(), scalarField(nEta, 0.0)),
Q_(NstList_.size(), scalarField(nEta, 0.0)),
h_(NstList_.size(), scalarField(nEta, 0.0)),
rho_(NstList_.size(), scalarField(nEta, 0.0)),
Rgas_(NstList_.size(), scalarField(nEta, 0.0))
{}
Foam::CMC::FlameStructure::FlameStructure(const FlameStructure&)
// :
// baseClassName(),
// data_()
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
/*
Foam::autoPtr<Foam::CMC::FlameStructure>
Foam::CMC::FlameStructure::New()
{
return autoPtr<FlameStructure>(new FlameStructure);
}
*/
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::CMC::FlameStructure::~FlameStructure()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
void Foam::CMC::FlameStructure::operator=(const FlameStructure& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "Attempted assignment to self"
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -0,0 +1,210 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::CMC::FlameStructure
Description
SourceFiles
FlameStructureI.H
FlameStructure.C
FlameStructureIO.C
\*---------------------------------------------------------------------------*/
#ifndef FlameStructure_H
#define FlameStructure_H
#include "error.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
namespace CMC
{
class FlameStructure;
}
// Forward declaration of friend functions and operators
Istream& operator>>(Istream&, CMC::FlameStructure&);
Ostream& operator<<(Ostream&, const CMC::FlameStructure&);
namespace CMC
{
/*---------------------------------------------------------------------------*\
Class FlameStructure Declaration
\*---------------------------------------------------------------------------*/
class FlameStructure
{
// Private data
typedef List<scalarField> scalarFieldArray1d;
typedef List<scalarFieldArray1d> scalarFieldArray2d;
typedef List<scalarFieldArray2d> scalarFieldArray3d;
//- Species mass fraction
word NstDir_;
//- Species mass fraction
scalarList NstList_;
//- Species mass fraction
scalarFieldArray2d Y_;
//- Species production rate
scalarFieldArray2d W_;
//- Temperature
scalarFieldArray1d T_;
//- Heat source
scalarFieldArray1d Q_;
//- Enthalpy
scalarFieldArray1d h_;
//- Density
scalarFieldArray1d rho_;
//- Specific gas constant for mean W
scalarFieldArray1d Rgas_;
// Private Member Functions
//- Disallow Construct null
FlameStructure();
//- Disallow default bitwise copy construct
FlameStructure(const FlameStructure&);
//- Disallow default bitwise assignment
void operator=(const FlameStructure&);
//- limit value of alpha and beta
void limitAB();
public:
// Static data members
//- Static data staticData
// static const dataType staticData;
// Constructors
//- Construct from components
FlameStructure(const dictionary &dict, const label nEta, const label nY);
//- Construct from Istream
FlameStructure(Istream&);
//- Construct as copy
// FlameStructure(const FlameStructure&);
// Selectors
//- Select null constructed
// static autoPtr<FlameStructure> New();
//- Destructor
~FlameStructure();
// Member Functions
// Access
//- Select null constructed
scalarFieldArray2d& Y() {return Y_;}
//- Select null constructed
scalarFieldArray2d& W() {return W_;}
//- Select null constructed
scalarFieldArray1d& T() {return T_;}
//- Select null constructed
scalarFieldArray1d& Q() {return Q_;}
//- Select null constructed
scalarFieldArray1d& rho() {return rho_;}
//- Select null constructed
scalarFieldArray1d& h() {return h_;}
//- Select null constructed
scalarFieldArray1d& Rgas() {return Rgas_;}
// Check
// Edit
// Write
// Member Operators
// void operator=(const FlameStructure&);
// Friend Functions
// Friend Operators
// IOstream Operators
friend Istream& operator>>(Istream&, FlameStructure&);
friend Ostream& operator<<(Ostream&, const FlameStructure&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace CMC
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "FlameStructureI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "FlameStructure.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::CMC::FlameStructure::FlameStructure(Istream& is)
/*
:
base1(is),
base2(is),
member1(is),
member2(is)
*/
{
// Check state of Istream
is.check("Foam::CMC::FlameStructure::FlameStructure(Foam::Istream&)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, CMC::FlameStructure&)
{
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::CMC::FlameStructure&)"
);
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const CMC::FlameStructure&)
{
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
"const Foam::CMC::FlameStructure&)"
);
return os;
}
// ************************************************************************* //

View file

@ -1,3 +1,5 @@
FlameStructure/FlameStructure.C
FlameStructure/FlameStructureIO.C
SLFMFoam.C
EXE = $(FOAM_USER_APPBIN)/SLFMFoam

View file

@ -45,6 +45,7 @@ Contact
#include "rhoChemistryCombustion.H"
#include "fvOptions.H"
#include "simpleControl.H"
#include "FlameStructure/FlameStructure.H"
#include "interpolateXY.H"
#include "Math.H" //Mathematical functions for CMC (AMC, gammaln, TDMA)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -313,6 +313,32 @@ scalar Sc(readScalar(SLFMdict.lookup("Sc")));
const label etamax(lowerN+upperN+1);
word outletName(SLFMdict.lookup("outletName"));
labelList nIntervals (SLFMdict.lookup("detailedN"));
scalarField etaGrid(sum(nIntervals)+1, 0.0);
{
scalarList etas (SLFMdict.lookup("detailedEta"));
forAll(nIntervals, i)
{
const label itv = nIntervals[i];
const labelList::subList prev(nIntervals, i);
const label baseI = sum(prev);
const scalar low = etas[i];
const scalar upp = etas[i+1];
const scalar delta = (upp - low) / scalar(itv);
for (label j = 0; j < itv; j++)
{
etaGrid[baseI+j] = low + delta * j;
}
}
etaGrid.last() = etas.last();
}
Info << etaGrid << endl;
scalarField etaValue(etamax,0);
scalarField etaIndex(etamax,0);
scalarField deta_h(etamax,0);

View file

@ -53,12 +53,12 @@ for(label j=0 ; j<etamax ; j++)
scalar mfVar = varValue[v]*mf*(1.0-mf);
for(label n=0 ; n<NstList.size() ; n++)
{
Ttable[j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, Y_SLFM[n][Ysize]);
Ttable[j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, T_SLFM[n]);
Rtable[j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, Rgas_SLFM[n]);
forAll(postSpecieIndices, yi)
{
const label y = postSpecieIndices[yi];
Ytable[yi][j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, Y_SLFM[n][y]);
Ytable[yi][j][v][n] = bpdf.evaluate(mf, mfVar, etaValue, Y_SLFM[y][n]);
}
}
}

View file

@ -12,49 +12,15 @@ typedef List<scalarField> scalarFieldArray1d;
typedef List<scalarFieldArray1d> scalarFieldArray2d;
typedef List<scalarFieldArray2d> scalarFieldArray3d;
scalarFieldArray2d Y_SLFM //species mass frac. [-]
(
NstList.size(),
scalarFieldArray1d
(
Ysize+1,
scalarField(etamax,0)
)
);
scalarFieldArray2d W_SLFM //reaction rate [1/sec]
(
NstList.size(),
scalarFieldArray1d
(
Ysize+1,
scalarField(etamax,0)
)
);
scalarFieldArray1d T_SLFM //Temperature [-]
(
NstList.size(),
scalarField(etamax,0)
);
scalarFieldArray1d Q_SLFM //Heat source [1/sec]
(
NstList.size(),
scalarField(etamax,0)
);
scalarFieldArray1d rho_SLFM //density [g/cm3]
(
NstList.size(),
scalarField(etamax, 0)
);
scalarFieldArray1d h_SLFM //enthalpy [erg/gm]
(
NstList.size(),
scalarField(etamax, 0)
);
scalarFieldArray1d Rgas_SLFM //specific gas constant for meanMW
(
NstList.size(),
scalarField(etamax, 0)
);
CMC::FlameStructure slfmLibrary(SLFMdict, etaValue.size(), Y.size());
scalarFieldArray2d& Y_SLFM (slfmLibrary.Y());
scalarFieldArray2d& W_SLFM (slfmLibrary.W());
scalarFieldArray1d& T_SLFM (slfmLibrary.T());
scalarFieldArray1d& Q_SLFM (slfmLibrary.Q());
scalarFieldArray1d& rho_SLFM (slfmLibrary.rho());
scalarFieldArray1d& h_SLFM (slfmLibrary.h());
scalarFieldArray1d& Rgas_SLFM (slfmLibrary.Rgas());
for(label n=0 ; n<NstList.size() ; n++)
{
@ -122,7 +88,7 @@ for(label n=0 ; n<NstList.size() ; n++)
Y_temp[j] = max(0.0, Yj);
}
Y_SLFM[n][spI] = interpolateXY(etaValue, etaValue_SLFM, Y_temp);
Y_SLFM[spI][n] = interpolateXY(etaValue, etaValue_SLFM, Y_temp);
//read reaction rate (from SLFM library)
for(label j=0 ; j<etamax_SLFM ; j++)
@ -130,7 +96,7 @@ for(label n=0 ; n<NstList.size() ; n++)
fin>>W_temp[j];
}
W_SLFM[n][i] = interpolateXY(etaValue, etaValue_SLFM, W_temp);
W_SLFM[spI][n] = interpolateXY(etaValue, etaValue_SLFM, W_temp);
//blank line
fin.getLine(gbg);
@ -149,7 +115,7 @@ for(label n=0 ; n<NstList.size() ; n++)
Y_temp[j] = max(0.0, Yj);
}
Y_SLFM[n].last() = interpolateXY(etaValue, etaValue_SLFM, Y_temp);
T_SLFM[n] = interpolateXY(etaValue, etaValue_SLFM, Y_temp);
//read heat source
for(label j=0 ; j<etamax_SLFM ; j++)
@ -157,7 +123,7 @@ for(label n=0 ; n<NstList.size() ; n++)
fin>>W_temp[j];
}
W_SLFM[n].last() = interpolateXY(etaValue, etaValue_SLFM, W_temp);
Q_SLFM[n] = interpolateXY(etaValue, etaValue_SLFM, W_temp);
//blank line
fin.getLine(gbg);
@ -191,9 +157,9 @@ for(label n=0 ; n<NstList.size() ; n++)
h_SLFM[n] = interpolateXY(etaValue, etaValue_SLFM, h_temp);
for(label i=0 ; i<NoSpecies ; i++)
for(label i=0 ; i<Y.size() ; i++)
{
Rgas_SLFM[n] += Y_SLFM[n][i]/composition.W(i); // = 1/meanMW
Rgas_SLFM[n] += Y_SLFM[i][n]/composition.W(i); // = 1/meanMW
}
Rgas_SLFM[n] = 8314.46*Rgas_SLFM[n]; //universal gas constant = 8314.46 [J/K.Kmole]