1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
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 \*---------------------------------------------------------------------------*/
27 #include "ODEChemistryModel.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template<class ODEChemistryType>
32 Foam::ode<ODEChemistryType>::ode
35 const word& ODEModelName,
36 const word& thermoType
39 chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
40 coeffsDict_(this->subDict("odeCoeffs")),
41 solverName_(coeffsDict_.lookup("solver")),
42 odeSolver_(ODESolver::New(solverName_, *this)),
43 eps_(readScalar(coeffsDict_.lookup("eps")))
47 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
49 template<class ODEChemistryType>
50 Foam::ode<ODEChemistryType>::~ode()
54 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
56 template<class ODEChemistryType>
57 Foam::scalar Foam::ode<ODEChemistryType>::solve
66 label nSpecie = this->nSpecie();
67 scalarField c1(this->nEqns(), 0.0);
69 // copy the concentration, T and P to the total solve-vector
70 for (label i = 0; i < nSpecie; i++)
91 c[i] = max(0.0, c1[i]);
98 // ************************************************************************* //