initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / solvers / combustion / PDRFoam / PDRModels / XiGModels / basicXiSubG / basicXiSubG.C
blob4bfa4cc2df3247578bb2cc40824701dfd79f1d58
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 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 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
19     for more details.
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 "basicXiSubG.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 namespace Foam
34 namespace XiGModels
36     defineTypeNameAndDebug(basicSubGrid, 0);
37     addToRunTimeSelectionTable(XiGModel, basicSubGrid, dictionary);
42 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
44 Foam::XiGModels::basicSubGrid::basicSubGrid
46     const dictionary& XiGProperties,
47     const hhuCombustionThermo& thermo,
48     const compressible::RASModel& turbulence,
49     const volScalarField& Su
52     XiGModel(XiGProperties, thermo, turbulence, Su),
53     k1(readScalar(XiGModelCoeffs_.lookup("k1"))),
54     XiGModel_(XiGModel::New(XiGModelCoeffs_, thermo, turbulence, Su))
58 // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
60 Foam::XiGModels::basicSubGrid::~basicSubGrid()
64 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
66 Foam::tmp<Foam::volScalarField> Foam::XiGModels::basicSubGrid::G() const
68     const objectRegistry& db = Su_.db();
69     const volVectorField& U = db.lookupObject<volVectorField>("U");
70     const volScalarField& N = db.lookupObject<volScalarField>("N");
71     const volScalarField& Lobs = db.lookupObject<volScalarField>("Lobs");
73     tmp<volScalarField> tGtot = XiGModel_->G();
74     volScalarField& Gtot = tGtot();
76     forAll(N, celli)
77     {
78         if (N[celli] > 1e-3)
79         {
80             Gtot[celli] += k1*mag(U[celli])/Lobs[celli];
81         }
82     }
84     return tGtot;
88 Foam::tmp<Foam::volScalarField> Foam::XiGModels::basicSubGrid::Db() const
90     const objectRegistry& db = Su_.db();
91     const volScalarField& Xi = db.lookupObject<volScalarField>("Xi");
92     const volScalarField& rho = db.lookupObject<volScalarField>("rho");
93     const volScalarField& mgb = db.lookupObject<volScalarField>("mgb");
94     const volScalarField& Lobs = db.lookupObject<volScalarField>("Lobs");
96     return XiGModel_->Db()
97         + rho*Su_*(Xi - 1.0)*mgb*(0.5*Lobs)*Lobs/(mgb*Lobs + 1.0);
101 bool Foam::XiGModels::basicSubGrid::read(const dictionary& XiGProperties)
103     XiGModel::read(XiGProperties);
105     XiGModelCoeffs_.lookup("k1") >> k1;
107     return true;
111 // ************************************************************************* //