diff --git a/solvers_post/FlameStructure/FlameStructure.C b/solvers_post/FlameStructure/FlameStructure.C new file mode 100644 index 0000000..25fefdb --- /dev/null +++ b/solvers_post/FlameStructure/FlameStructure.C @@ -0,0 +1,265 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "IFstream.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(word fileName) +: + names_(), + Y_(), + W_(), + T_(), + Q_(), + h_(), + rho_(), + Rgas_() +{ + IFstream slfmFile (fileName); + + word garbage; + word yname; + + // number of eta grids and species + label nEta(0); + label nY(0); + + slfmFile.getLine(garbage); //INPUT FILE FOR THE SR-CMC ROUTINES + slfmFile.getLine(garbage); //No.GRID POINTS No. SPECIES + slfmFile >> nEta >> nY; + + Y_.setSize(nY); + W_.setSize(nY); + + eta_.setSize(nEta); + + T_.setSize(nEta); + Q_.setSize(nEta); + h_.setSize(nEta); + rho_.setSize(nEta); + Rgas_.setSize(nEta); + + slfmFile.getLine(garbage); //blank line (trailing white spaces) + slfmFile.getLine(garbage); //PRESSURE(ATM) + slfmFile.getLine(garbage); //1.0 + slfmFile.getLine(garbage); //MIXTURE FRACTION GRID + + scalarField YTemp(nEta,0); + scalarField WTemp(nEta,0); + + + for(label j=0 ; j> eta_[j]; + } + + slfmFile.getLine(garbage); //blank line (trailing white spaces) + slfmFile.getLine(garbage); //INITIAL CONDITIONS + + + for(label i=0; i> yname; + names_.append(yname); + + //species mass fractions + for(label j=0 ; j> YTemp[j]; + } + Y_.set(i, new scalarField(YTemp)); + + //species production rates + for(label j=0 ; j> WTemp[j]; + } + W_.set(i, new scalarField(WTemp)); + + slfmFile.getLine(garbage); //blank line (trailing white spaces) + } + + + //read temperature + slfmFile >> yname; + + for(label j=0 ; j> T_[j]; + T_[j] = max(0.0, T_[j]); + } + + for(label j=0 ; j> Q_[j]; + } + + + /* + // calcuate rather than read + + //read density + slfmFile >> yname; + + for(label j=0 ; j> rho_[j]; + } + + + //read enthalpy + slfmFile >> yname; + + for(label j=0 ; j> Rgas_[j]; + } + */ + + + + + + + + + + + + + + /* + Interpolation(etaValue, eta, 1, nY+1, yi_temp, yi); + + for(label j = 0 ; j<=etamax ; j++) + { + for(label i = 0 ; icalculateRHOCMC(QiCMCin , Tin, Pin); + + QhCMC[j+k*(etamax+1)] = chemistry->calculateHCMC(QiCMCin , Tin, rhoCMC[ j+k*(etamax+1)], Pin); + + } + } + */ +} + + +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/FlameStructure/FlameStructure.H b/solvers_post/FlameStructure/FlameStructure.H new file mode 100644 index 0000000..7a72e3b --- /dev/null +++ b/solvers_post/FlameStructure/FlameStructure.H @@ -0,0 +1,242 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "scalarField.H" +#include "hashedWordList.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 + + //- Mixture fraction grid + scalarField eta_; + + //- Species name table + hashedWordList names_; + + //- Species mass fraction + PtrList Y_; + // scalarFieldArray2d Y_; + + //- Species production rate + PtrList W_; + //scalarFieldArray2d W_; + + //- Temperature + scalarField T_; + + //- Heat source + scalarField Q_; + + //- Enthalpy + scalarField h_; + + //- Density + scalarField rho_; + + //- Specific gas constant for mean W + scalarField 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(word fileName); + + //- 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 + scalarField& eta() {return eta_;} + + //- Select null constructed + hashedWordList& names() {return names_;} + + //- Select null constructed + PtrList& Y() {return Y_;} + + //- Select null constructed + PtrList& W() {return W_;} + + //- Select null constructed + scalarField& T() {return T_;} + + //- Select null constructed + scalarField& Q() {return Q_;} + + //- Select null constructed + scalarField& rho() {return rho_;} + + //- Select null constructed + scalarField& h() {return h_;} + + //- Select null constructed + scalarField& Rgas() {return Rgas_;} + + //- Select null constructed + const scalarField& eta() const {return eta_;} + + //- Select null constructed + const hashedWordList& names() const {return names_;} + + //- Select null constructed + const PtrList& Y() const {return Y_;} + + //- Select null constructed + const PtrList& W() const {return W_;} + + //- Select null constructed + const scalarField& T() const {return T_;} + + //- Select null constructed + const scalarField& Q() const {return Q_;} + + //- Select null constructed + const scalarField& rho() const {return rho_;} + + //- Select null constructed + const scalarField& h() const {return h_;} + + //- Select null constructed + const scalarField& Rgas() const {return Rgas_;} + /* + */ + + // Check + + // Edit + + // Write + + + // Member Operators + + // void operator=(const FlameStructure&); + + + // Friend Functions + + // Friend Operators + + // IOstream Operators + + friend Istream& ::Foam::operator>>(Istream&, FlameStructure&); + friend Ostream& ::Foam::operator<<(Ostream&, const FlameStructure&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace CMC +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "FlameStructureI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/solvers_post/FlameStructure/FlameStructureI.H b/solvers_post/FlameStructure/FlameStructureI.H new file mode 100644 index 0000000..eca8d9e --- /dev/null +++ b/solvers_post/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/FlameStructure/FlameStructureIO.C b/solvers_post/FlameStructure/FlameStructureIO.C new file mode 100644 index 0000000..6ef3b47 --- /dev/null +++ b/solvers_post/FlameStructure/FlameStructureIO.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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" +#include "error.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& fs) +{ + // Check state of Ostream + os.check + ( + "Foam::Ostream& Foam::operator<<(Foam::Ostream&, " + "const Foam::CMC::FlameStructure&)" + ); + + os << fs.names() + << fs.eta() + << fs.Y() + << fs.T() + << endl; + + return os; +} + + +// ************************************************************************* // diff --git a/solvers_post/LagrangianCMCFoam/LagrangianCMCFoam.C b/solvers_post/LagrangianCMCFoam/LagrangianCMCFoam.C index 3a48adc..ec7230d 100644 --- a/solvers_post/LagrangianCMCFoam/LagrangianCMCFoam.C +++ b/solvers_post/LagrangianCMCFoam/LagrangianCMCFoam.C @@ -51,6 +51,8 @@ Contact #include "LinearMesh.H" +#include "../FlameStructure/FlameStructure.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) diff --git a/solvers_post/LagrangianCMCFoam/Make/files b/solvers_post/LagrangianCMCFoam/Make/files index c011cf3..fb1569c 100644 --- a/solvers_post/LagrangianCMCFoam/Make/files +++ b/solvers_post/LagrangianCMCFoam/Make/files @@ -1,3 +1,5 @@ +../FlameStructure/FlameStructure.C +../FlameStructure/FlameStructureIO.C LagrangianCMCFoam.C EXE = $(FOAM_USER_APPBIN)/LagrangianCMCFoam diff --git a/solvers_post/LagrangianCMCFoam/QCMC_init.H b/solvers_post/LagrangianCMCFoam/QCMC_init.H index 21938ba..59cb888 100644 --- a/solvers_post/LagrangianCMCFoam/QCMC_init.H +++ b/solvers_post/LagrangianCMCFoam/QCMC_init.H @@ -1,4 +1,5 @@ IFstream slfmFile (SLFMinit); +CMC::FlameStructure test (SLFMinit); word garbage, yname; scalar neta(0), ny(0); @@ -26,7 +27,6 @@ slfmFile.getLine(garbage); //INITIAL for(label i=0; i>yname; - Info<>yi_temp[j*(ny+1)+i]; @@ -41,7 +41,6 @@ for(label i=0; i>yname; -Info<>yi_temp[j*(ny+1)+ny];