1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 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
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 \*---------------------------------------------------------------------------*/
26 #include "basicXiSubXiEq.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(basicSubGrid, 0);
36 addToRunTimeSelectionTable(XiEqModel, basicSubGrid, dictionary);
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 Foam::XiEqModels::basicSubGrid::basicSubGrid
45 const dictionary& XiEqProperties,
46 const hhuCombustionThermo& thermo,
47 const compressible::RASModel& turbulence,
48 const volScalarField& Su
51 XiEqModel(XiEqProperties, thermo, turbulence, Su),
58 Su.mesh().facesInstance(),
66 XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su))
70 // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
72 Foam::XiEqModels::basicSubGrid::~basicSubGrid()
76 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
78 Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
80 const fvMesh& mesh = Su_.mesh();
81 const volVectorField& U = mesh.lookupObject<volVectorField>("U");
83 const volScalarField& Nv = mesh.lookupObject<volScalarField>("Nv");
84 const volSymmTensorField& nsv =
85 mesh.lookupObject<volSymmTensorField>("nsv");
87 volScalarField magU(mag(U));
90 U/(mag(U) + dimensionedScalar("Usmall", U.dimensions(), 1e-4))
93 const scalarField Cw = pow(mesh.V(), 2.0/3.0);
95 tmp<volScalarField> tN
102 mesh.time().constant(),
108 dimensionedScalar("zero", Nv.dimensions(), 0.0),
109 zeroGradientFvPatchVectorField::typeName
113 volScalarField& N = tN();
115 N.internalField() = Nv.internalField()*Cw;
117 tmp<volSymmTensorField> tns
119 new volSymmTensorField
124 U.mesh().time().timeName(),
130 dimensionedSymmTensor
134 pTraits<symmTensor>::zero
136 zeroGradientFvPatchSymmTensorField::typeName
140 volSymmTensorField& ns = tns();
142 ns.internalField() = nsv.internalField()*Cw;
144 volScalarField n(max(N - (Uhat & ns & Uhat), scalar(1e-4)));
146 volScalarField b((Uhat & B_ & Uhat)/sqrt(n));
148 volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));
150 volScalarField XiSubEq
153 + max(2.2*sqrt(b), min(0.34*magU/up*sqrt(b), scalar(1.6)))
157 return (XiSubEq*XiEqModel_->XiEq());
161 bool Foam::XiEqModels::basicSubGrid::read(const dictionary& XiEqProperties)
163 XiEqModel::read(XiEqProperties);
165 return XiEqModel_->read(XiEqModelCoeffs_);
169 // ************************************************************************* //