diff --git a/solvers_post/SLFMFoam/FlameStructure/FlameStructure.C b/solvers_post/SLFMFoam/FlameStructure/FlameStructure.C new file mode 100644 index 0000000..57d5e39 --- /dev/null +++ b/solvers_post/SLFMFoam/FlameStructure/FlameStructure.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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::New() +{ + return autoPtr(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 * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/solvers_post/SLFMFoam/FlameStructure/FlameStructure.H b/solvers_post/SLFMFoam/FlameStructure/FlameStructure.H new file mode 100644 index 0000000..864f257 --- /dev/null +++ b/solvers_post/SLFMFoam/FlameStructure/FlameStructure.H @@ -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 . + +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 scalarFieldArray1d; + + typedef List scalarFieldArray2d; + + typedef List 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 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 + +// ************************************************************************* // diff --git a/solvers_post/SLFMFoam/FlameStructure/FlameStructureI.H b/solvers_post/SLFMFoam/FlameStructure/FlameStructureI.H new file mode 100644 index 0000000..eca8d9e --- /dev/null +++ b/solvers_post/SLFMFoam/FlameStructure/FlameStructureI.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/solvers_post/SLFMFoam/FlameStructure/FlameStructureIO.C b/solvers_post/SLFMFoam/FlameStructure/FlameStructureIO.C new file mode 100644 index 0000000..12dbe5c --- /dev/null +++ b/solvers_post/SLFMFoam/FlameStructure/FlameStructureIO.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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; +} + + +// ************************************************************************* // diff --git a/solvers_post/SLFMFoam/Make/files b/solvers_post/SLFMFoam/Make/files index 87521bd..93044ed 100644 --- a/solvers_post/SLFMFoam/Make/files +++ b/solvers_post/SLFMFoam/Make/files @@ -1,3 +1,5 @@ +FlameStructure/FlameStructure.C +FlameStructure/FlameStructureIO.C SLFMFoam.C EXE = $(FOAM_USER_APPBIN)/SLFMFoam diff --git a/solvers_post/SLFMFoam/SLFMFoam.C b/solvers_post/SLFMFoam/SLFMFoam.C index d434ede..cb505aa 100644 --- a/solvers_post/SLFMFoam/SLFMFoam.C +++ b/solvers_post/SLFMFoam/SLFMFoam.C @@ -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) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/solvers_post/SLFMFoam/createFields.H b/solvers_post/SLFMFoam/createFields.H index f8b700b..8443f0a 100644 --- a/solvers_post/SLFMFoam/createFields.H +++ b/solvers_post/SLFMFoam/createFields.H @@ -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); diff --git a/solvers_post/SLFMFoam/preIntegration.H b/solvers_post/SLFMFoam/preIntegration.H index 8394d0d..8930a49 100644 --- a/solvers_post/SLFMFoam/preIntegration.H +++ b/solvers_post/SLFMFoam/preIntegration.H @@ -53,12 +53,12 @@ for(label j=0 ; j scalarFieldArray1d; typedef List scalarFieldArray2d; typedef List 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>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>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