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 \*---------------------------------------------------------------------------*/
28 #include "wallFvPatch.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace incompressible
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(RASModel, 0);
40 defineRunTimeSelectionTable(RASModel, dictionary);
42 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
44 void RASModel::printCoeffs()
48 Info<< type() << "Coeffs" << coeffDict_ << endl;;
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58 const volVectorField& U,
59 const surfaceScalarField& phi,
60 transportModel& lamTransportModel
80 transportModel_(lamTransportModel),
82 turbulence_(lookup("turbulence")),
83 printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
84 coeffDict_(subDict(type + "Coeffs")),
88 dimensioned<scalar>::lookupOrAddToDict
91 subDict("wallFunctionCoeffs"),
97 dimensioned<scalar>::lookupOrAddToDict
100 subDict("wallFunctionCoeffs"),
105 yPlusLam_(yPlusLam(kappa_.value(), E_.value())),
107 k0_("k0", dimVelocity*dimVelocity, SMALL),
108 epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL),
109 epsilonSmall_("epsilonSmall", epsilon0_.dimensions(), SMALL),
115 RASModel::~RASModel()
119 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 scalar RASModel::yPlusLam(const scalar kappa, const scalar E)
125 for (int i=0; i<10; i++)
127 ypl = log(E*ypl)/kappa;
134 tmp<scalarField> RASModel::yPlus(const label patchNo) const
136 const fvPatch& curPatch = mesh_.boundary()[patchNo];
138 tmp<scalarField> tYp(new scalarField(curPatch.size()));
139 scalarField& Yp = tYp();
141 if (typeid(curPatch) == typeid(wallFvPatch))
143 scalar Cmu(readScalar(coeffDict_.lookup("Cmu")));
145 Yp = pow(Cmu, 0.25)*y_[patchNo]
146 *sqrt(k()().boundaryField()[patchNo].patchInternalField())
147 /nu().boundaryField()[patchNo];
153 "tmp<scalarField> RASModel::yPlus(const label patchNo)"
154 ) << "const : " << endl
155 << "Patch " << patchNo << " is not a wall. Returning blank field"
165 void RASModel::correct()
167 if (mesh_.changing())
174 bool RASModel::read()
176 if (regIOobject::read())
178 lookup("turbulence") >> turbulence_;
179 coeffDict_ = subDict(type() + "Coeffs");
181 kappa_.readIfPresent(subDict("wallFunctionCoeffs"));
182 E_.readIfPresent(subDict("wallFunctionCoeffs"));
184 yPlusLam_ = yPlusLam(kappa_.value(), E_.value());
186 k0_.readIfPresent(*this);
187 epsilon0_.readIfPresent(*this);
188 epsilonSmall_.readIfPresent(*this);
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 } // End namespace incompressible
202 } // End namespace Foam
204 // ************************************************************************* //