OpenFOAM logo
Open Source CFD Toolkit

combustionMixture.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     combustionMixture
00027 
00028 Description
00029 
00030 SourceFiles
00031     combustionMixture.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef combustionMixture_H
00036 #define combustionMixture_H
00037 
00038 #include "volFields.H"
00039 #include "PtrList.H"
00040 #include "speciesTable.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                            Class combustionMixture Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 class combustionMixture
00052 {
00053 
00054 protected:
00055 
00056     // Protected data
00057 
00058         //- The table of species
00059         speciesTable species_;
00060 
00061         //- Species mass fractions
00062         PtrList<volScalarField> Y_;
00063 
00064 
00065 public:
00066 
00067     // Constructors
00068 
00069         //- Construct from dictionary and mesh
00070         combustionMixture
00071         (
00072             const dictionary&,
00073             const wordList& specieNames,
00074             const fvMesh&
00075         );
00076 
00077 
00078     // Member functions
00079 
00080         //- Return the mass-fraction fields
00081         PtrList<volScalarField>& Y()
00082         {
00083             return Y_;
00084         }
00085 
00086         //- Return the const mass-fraction fields
00087         const PtrList<volScalarField>& Y() const
00088         {
00089             return Y_;
00090         }
00091 
00092         //- Return the mass-fraction field for a specie given by index
00093         volScalarField& Y(const label i)
00094         {
00095             return Y_[i];
00096         }
00097 
00098         //- Return the const mass-fraction field for a specie given by index
00099         const volScalarField& Y(const label i) const
00100         {
00101             return Y_[i];
00102         }
00103 
00104         //- Return the mass-fraction field for a specie given by name
00105         volScalarField& Y(const word& specieName)
00106         {
00107             return Y_[species_[specieName]];
00108         }
00109 
00110         //- Return the const mass-fraction field for a specie given by name
00111         const volScalarField& Y(const word& specieName) const
00112         {
00113             return Y_[species_[specieName]];
00114         }
00115 
00116         //- does the mixture include this specie
00117         bool contains(const word& specieName) const
00118         {
00119             return species_.contains(specieName);
00120         }
00121 
00122         scalar fres(const scalar ft, const scalar stoicRatio) const
00123         {
00124             return max(ft - (1.0 - ft)/stoicRatio, 0.0);
00125         }
00126 
00127         tmp<volScalarField> fres
00128         (
00129             const volScalarField& ft,
00130             const dimensionedScalar& stoicRatio
00131         ) const
00132         {
00133             return max(ft - (scalar(1) - ft)/stoicRatio.value(), scalar(0));
00134         }
00135 };
00136 
00137 
00138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00139 
00140 } // End namespace Foam
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 #endif
00145 
00146 // ************************************************************************* //
For further information go to www.openfoam.org