1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "sequential.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 defineTypeNameAndDebug(sequential, 0);
35 addToRunTimeSelectionTable
44 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
46 // Construct from components
47 Foam::sequential::sequential
49 const Foam::dictionary& dict,
50 Foam::chemistryModel& chemistry
53 chemistrySolver(dict, chemistry),
54 coeffsDict_(dict.subDict(typeName + "Coeffs")),
55 cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
56 equil_(coeffsDict_.lookup("equilibriumRateLimiter"))
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
62 Foam::sequential::~sequential()
66 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68 Foam::scalar Foam::sequential::solve
77 scalar tChemInv = SMALL;
79 scalar pf, cf, pb, cb;
82 for(label i=0; i<chemistry_.reactions().size(); i++)
84 const chemistryModel::reaction& R = chemistry_.reactions()[i];
86 scalar om0 = chemistry_.omega
88 R, c, T, p, pf, cf, lRef, pb, cb, rRef
100 omeg = om0/(1.0 + pb*dt);
104 omeg = om0/(1.0 + pf*dt);
107 tChemInv = max(tChemInv, mag(omeg));
111 for(label s=0; s<R.lhs().size(); s++)
113 label si = R.lhs()[s].index;
114 scalar sl = R.lhs()[s].stoichCoeff;
116 c[si] = max(0.0, c[si]);
119 for(label s=0; s<R.rhs().size(); s++)
121 label si = R.rhs()[s].index;
122 scalar sr = R.rhs()[s].stoichCoeff;
124 c[si] = max(0.0, c[si]);
127 } // end for(label i...
129 return cTauChem_/tChemInv;
133 // ************************************************************************* //