OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

inhomogeneousMixture.C

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-2009 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 \*---------------------------------------------------------------------------*/
00026 
00027 #include "inhomogeneousMixture.H"
00028 #include "fvMesh.H"
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 template<class ThermoType>
00033 const char* Foam::inhomogeneousMixture<ThermoType>::specieNames_[2] =
00034     {"ft", "b"};
00035 
00036 
00037 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00038 
00039 template<class ThermoType>
00040 Foam::inhomogeneousMixture<ThermoType>::inhomogeneousMixture
00041 (
00042     const dictionary& thermoDict,
00043     const fvMesh& mesh
00044 )
00045 :
00046     basicMultiComponentMixture
00047     (
00048         thermoDict,
00049         speciesTable(nSpecies_, specieNames_),
00050         mesh
00051     ),
00052 
00053     stoicRatio_(thermoDict.lookup("stoichiometricAirFuelMassRatio")),
00054 
00055     fuel_(thermoDict.lookup("fuel")),
00056     oxidant_(thermoDict.lookup("oxidant")),
00057     products_(thermoDict.lookup("burntProducts")),
00058 
00059     mixture_("mixture", fuel_),
00060 
00061     ft_(Y("ft")),
00062     b_(Y("b"))
00063 {}
00064 
00065 
00066 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00067 
00068 template<class ThermoType>
00069 const ThermoType& Foam::inhomogeneousMixture<ThermoType>::mixture
00070 (
00071     const scalar ft,
00072     const scalar b
00073 ) const
00074 {
00075     if (ft < 0.0001)
00076     {
00077         return oxidant_;
00078     }
00079     else
00080     {
00081         scalar fu = b*ft + (1.0 - b)*fres(ft, stoicRatio().value());
00082         scalar ox = 1 - ft - (ft - fu)*stoicRatio().value();
00083         scalar pr = 1 - fu - ox;
00084 
00085         mixture_ = fu/fuel_.W()*fuel_;
00086         mixture_ += ox/oxidant_.W()*oxidant_;
00087         mixture_ += pr/products_.W()*products_;
00088 
00089         return mixture_;
00090     }
00091 }
00092 
00093 
00094 template<class ThermoType>
00095 void Foam::inhomogeneousMixture<ThermoType>::read(const dictionary& thermoDict)
00096 {
00097     stoicRatio_ = thermoDict.lookup("stoichiometricAirFuelMassRatio");
00098 
00099     fuel_ = ThermoType(thermoDict.lookup("fuel"));
00100     oxidant_ = ThermoType(thermoDict.lookup("oxidant"));
00101     products_ = ThermoType(thermoDict.lookup("burntProducts"));
00102 }
00103 
00104 
00105 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd