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
29 Calculate wall dissipation from wall-functions.
31 \*---------------------------------------------------------------------------*/
34 labelList cellBoundaryFaceCount(epsilon_.size(), 0);
36 scalar Cmu25 = pow(Cmu_.value(), 0.25);
37 scalar Cmu75 = pow(Cmu_.value(), 0.75);
39 const fvPatchList& patches = mesh_.boundary();
41 //- Initialise the near-wall G field to zero
42 forAll(patches, patchi)
44 const fvPatch& curPatch = patches[patchi];
46 if (isType<wallFvPatch>(curPatch))
48 forAll(curPatch, facei)
50 label faceCelli = curPatch.faceCells()[facei];
52 epsilon_[faceCelli] = 0.0;
58 //- Accumulate the wall face contributions to epsilon and G
59 // Increment cellBoundaryFaceCount for each face for averaging
60 forAll(patches, patchi)
62 const fvPatch& curPatch = patches[patchi];
64 if (isType<wallFvPatch>(curPatch))
66 # include "checkPatchFieldTypes.H"
68 const scalarField& rhow = rho_.boundaryField()[patchi];
70 const scalarField& muw = mu().boundaryField()[patchi];
71 const scalarField& mutw = mut_.boundaryField()[patchi];
73 scalarField magFaceGradU =
74 mag(U_.boundaryField()[patchi].snGrad());
76 forAll(curPatch, facei)
78 label faceCelli = curPatch.faceCells()[facei];
81 Cmu25*RASModel::y_[patchi][facei]
83 /(muw[facei]/rhow[facei]);
85 // For corner cells (with two boundary or more faces),
86 // epsilon and G in the near-wall cell are calculated
89 cellBoundaryFaceCount[faceCelli]++;
91 epsilon_[faceCelli] +=
92 Cmu75*pow(k_[faceCelli], 1.5)
93 /(kappa_.value()*RASModel::y_[patchi][facei]);
95 if (yPlus > yPlusLam_)
98 (mutw[facei] + muw[facei])
100 *Cmu25*sqrt(k_[faceCelli])
101 /(kappa_.value()*RASModel::y_[patchi][facei]);
108 // Perform the averaging
110 forAll(patches, patchi)
112 const fvPatch& curPatch = patches[patchi];
114 if (isType<wallFvPatch>(curPatch))
116 forAll(curPatch, facei)
118 label faceCelli = curPatch.faceCells()[facei];
120 epsilon_[faceCelli] /= cellBoundaryFaceCount[faceCelli];
121 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
128 // ************************************************************************* //