ENH: patchCloud: return pTraits<Type>::max for unfound points
[OpenFOAM-1.7.x.git] / applications / solvers / combustion / fireFoam / combustionModels / combustionModel / combustionModel.C
blobddfecc74b03a299911002ca18226130ec48bff96
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.
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.
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.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "combustionModel.H"
27 #include "fvm.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 namespace Foam
33     defineTypeNameAndDebug(combustionModel, 0);
34     defineRunTimeSelectionTable(combustionModel, dictionary);
38 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
40 Foam::combustionModel::combustionModel
42     const dictionary& combustionProperties,
43     const hsCombustionThermo& thermo,
44     const compressible::turbulenceModel& turbulence,
45     const surfaceScalarField& phi,
46     const volScalarField& rho
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())
68 // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
70 Foam::combustionModel::~combustionModel()
74 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
76 Foam::tmp<Foam::fvScalarMatrix>
77 Foam::combustionModel::combustionModel::R(volScalarField& fu) const
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);
84     return wFuelNorm*fres - fvm::Sp(wFuelNorm, fu);
88 Foam::tmp<Foam::volScalarField> Foam::combustionModel::combustionModel::dQ
90     const fvScalarMatrix& Rfu
91 ) const
93     const basicMultiComponentMixture& composition = thermo_.composition();
94     const volScalarField& fu = composition.Y("fu");
96     return (-qFuel_)*(Rfu & fu);
100 bool Foam::combustionModel::read(const dictionary& combustionProperties)
102     combustionModelCoeffs_ = combustionProperties.subDict(type() + "Coeffs");
104     return true;
108 // ************************************************************************* //