FreeFOAM The Cross-Platform CFD Toolkit
combustionModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "combustionModel.H"
27 #include <finiteVolume/fvm.H>
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(combustionModel, 0);
34  defineRunTimeSelectionTable(combustionModel, dictionary);
35 };
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
40 Foam::combustionModel::combustionModel
41 (
42  const dictionary& combustionProperties,
43  const hsCombustionThermo& thermo,
44  const compressible::turbulenceModel& turbulence,
45  const surfaceScalarField& phi,
46  const volScalarField& rho
47 )
48 :
49  combustionModelCoeffs_
50  (
51  combustionProperties.subDict
52  (
53  word(combustionProperties.lookup("combustionModel")) + "Coeffs"
54  )
55  ),
56  thermo_(thermo),
57  turbulence_(turbulence),
58  mesh_(phi.mesh()),
59  phi_(phi),
60  rho_(rho),
61  stoicRatio_(thermo.lookup("stoichiometricAirFuelMassRatio")),
62  s_(thermo.lookup("stoichiometricOxygenFuelMassRatio")),
63  qFuel_(thermo_.lookup("qFuel")),
64  composition_(thermo.composition())
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
69 
71 {}
72 
73 
74 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
75 
77 Foam::combustionModel::combustionModel::R(volScalarField& fu) const
78 {
79  const basicMultiComponentMixture& composition = thermo_.composition();
80  const volScalarField& ft = composition.Y("ft");
81  volScalarField fres = composition.fres(ft, stoicRatio_.value());
82  volScalarField wFuelNorm = this->wFuelNorm()*pos(fu - fres);
83 
84  return wFuelNorm*fres - fvm::Sp(wFuelNorm, fu);
85 }
86 
87 
88 Foam::tmp<Foam::volScalarField> Foam::combustionModel::combustionModel::dQ
89 (
90  const fvScalarMatrix& Rfu
91 ) const
92 {
93  const basicMultiComponentMixture& composition = thermo_.composition();
94  const volScalarField& fu = composition.Y("fu");
95 
96  return (-qFuel_)*(Rfu & fu);
97 }
98 
99 
101 {
102  combustionModelCoeffs_ = combustionProperties.subDict(type() + "Coeffs");
103 
104  return true;
105 }
106 
107 
108 // ************************************************************************* //