1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "sequential.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template<class CompType, class ThermoType>
32 Foam::sequential<CompType, ThermoType>::sequential
34 ODEChemistryModel<CompType, ThermoType>& model,
38 chemistrySolver<CompType, ThermoType>(model, modelName),
39 coeffsDict_(model.subDict(modelName + "Coeffs")),
40 cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
41 equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
45 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
47 template<class CompType, class ThermoType>
48 Foam::sequential<CompType, ThermoType>::~sequential()
52 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 template<class CompType, class ThermoType>
55 Foam::scalar Foam::sequential<CompType, ThermoType>::solve
64 scalar tChemInv = SMALL;
66 scalar pf, cf, pb, cb;
69 for (label i=0; i<this->model_.reactions().size(); i++)
71 const Reaction<ThermoType>& R = this->model_.reactions()[i];
73 scalar om0 = this->model_.omega
75 R, c, T, p, pf, cf, lRef, pb, cb, rRef
87 omeg = om0/(1.0 + pb*dt);
91 omeg = om0/(1.0 + pf*dt);
94 tChemInv = max(tChemInv, mag(omeg));
98 for (label s=0; s<R.lhs().size(); s++)
100 label si = R.lhs()[s].index;
101 scalar sl = R.lhs()[s].stoichCoeff;
103 c[si] = max(0.0, c[si]);
106 for (label s=0; s<R.rhs().size(); s++)
108 label si = R.rhs()[s].index;
109 scalar sr = R.rhs()[s].stoichCoeff;
111 c[si] = max(0.0, c[si]);
114 } // end for (label i...
116 return cTauChem_/tChemInv;
120 // ************************************************************************* //