1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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
26 nonLinearwallFunctions
29 Calculate wall generation and dissipation from wall-functions
30 for non-linear models.
32 \*---------------------------------------------------------------------------*/
35 labelList cellBoundaryFaceCount(epsilon_.size(), 0);
37 scalar yPlusLam = this->yPlusLam(kappa_.value(), E_.value());
39 const fvPatchList& patches = mesh_.boundary();
41 //- Initialise the near-wall G and epsilon fields 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& nuw = nu().boundaryField()[patchi];
69 const scalarField& nutw = nut_.boundaryField()[patchi];
71 scalarField magFaceGradU = mag(U_.boundaryField()[patchi].snGrad());
73 forAll(curPatch, facei)
75 label faceCelli = curPatch.faceCells()[facei];
78 scalar Cmu25 = pow(Cmu_[faceCelli], 0.25);
79 scalar Cmu75 = pow(Cmu_[faceCelli], 0.75);
82 Cmu25*y_[patchi][facei]
86 // For corner cells (with two boundary or more faces),
87 // epsilon and G in the near-wall cell are calculated
90 cellBoundaryFaceCount[faceCelli]++;
92 epsilon_[faceCelli] +=
93 Cmu75*pow(k_[faceCelli], 1.5)
94 /(kappa_.value()*y_[patchi][facei]);
99 (nutw[facei] + nuw[facei])
101 *Cmu25*sqrt(k_[faceCelli])
102 /(kappa_.value()*y_[patchi][facei])
103 - (nonlinearStress_[faceCelli] && gradU_[faceCelli]);
109 // Perform the averaging
111 forAll(patches, patchi)
113 const fvPatch& curPatch = patches[patchi];
115 if (isType<wallFvPatch>(curPatch))
117 forAll(curPatch, facei)
119 label faceCelli = curPatch.faceCells()[facei];
121 epsilon_[faceCelli] /= cellBoundaryFaceCount[faceCelli];
122 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
129 // ************************************************************************* //