1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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/>.
25 nonLinearwallFunctions
28 Calculate wall generation and dissipation from wall-functions
29 for non-linear models.
31 \*---------------------------------------------------------------------------*/
34 labelList cellBoundaryFaceCount(epsilon_.size(), 0);
36 scalar yPlusLam = this->yPlusLam(kappa_.value(), E_.value());
38 const fvPatchList& patches = mesh_.boundary();
40 //- Initialise the near-wall G and epsilon fields to zero
41 forAll(patches, patchi)
43 const fvPatch& curPatch = patches[patchi];
45 if (isA<wallFvPatch>(curPatch))
47 forAll(curPatch, facei)
49 label faceCelli = curPatch.faceCells()[facei];
51 epsilon_[faceCelli] = 0.0;
57 const volScalarField nuLam(this->nu());
59 //- Accumulate the wall face contributions to epsilon and G
60 // Increment cellBoundaryFaceCount for each face for averaging
61 forAll(patches, patchi)
63 const fvPatch& curPatch = patches[patchi];
65 if (isA<wallFvPatch>(curPatch))
67 #include "checkPatchFieldTypes.H"
69 const scalarField& nuw = nuLam.boundaryField()[patchi];
70 const scalarField& nutw = nut_.boundaryField()[patchi];
72 const scalarField magFaceGradU
74 mag(U_.boundaryField()[patchi].snGrad())
77 forAll(curPatch, facei)
79 label faceCelli = curPatch.faceCells()[facei];
82 scalar Cmu25 = pow025(Cmu_[faceCelli]);
83 scalar Cmu75 = pow(Cmu_[faceCelli], 0.75);
86 Cmu25*y_[patchi][facei]
90 // For corner cells (with two boundary or more faces),
91 // epsilon and G in the near-wall cell are calculated
94 cellBoundaryFaceCount[faceCelli]++;
96 epsilon_[faceCelli] +=
97 Cmu75*pow(k_[faceCelli], 1.5)
98 /(kappa_.value()*y_[patchi][facei]);
100 if (yPlus > yPlusLam)
103 (nutw[facei] + nuw[facei])
105 *Cmu25*sqrt(k_[faceCelli])
106 /(kappa_.value()*y_[patchi][facei])
107 - (nonlinearStress_[faceCelli] && gradU_[faceCelli]);
113 // Perform the averaging
115 forAll(patches, patchi)
117 const fvPatch& curPatch = patches[patchi];
119 if (isA<wallFvPatch>(curPatch))
121 forAll(curPatch, facei)
123 label faceCelli = curPatch.faceCells()[facei];
125 epsilon_[faceCelli] /= cellBoundaryFaceCount[faceCelli];
126 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
133 // ************************************************************************* //