1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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 (curPatch.isWall())
47 forAll(curPatch, facei)
49 label faceCelli = curPatch.faceCells()[facei];
51 epsilon_[faceCelli] = 0.0;
57 //- Accumulate the wall face contributions to epsilon and G
58 // Increment cellBoundaryFaceCount for each face for averaging
59 forAll(patches, patchi)
61 const fvPatch& curPatch = patches[patchi];
63 if (curPatch.isWall())
65 #include "checkPatchFieldTypes.H"
67 const scalarField& nuw = nu().boundaryField()[patchi];
68 const scalarField& nutw = nut_.boundaryField()[patchi];
70 scalarField magFaceGradU = mag(U_.boundaryField()[patchi].snGrad());
72 forAll(curPatch, facei)
74 label faceCelli = curPatch.faceCells()[facei];
77 scalar Cmu25 = pow(Cmu_[faceCelli], 0.25);
78 scalar Cmu75 = pow(Cmu_[faceCelli], 0.75);
81 Cmu25*y_[patchi][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()*y_[patchi][facei]);
98 (nutw[facei] + nuw[facei])
100 *Cmu25*sqrt(k_[faceCelli])
101 /(kappa_.value()*y_[patchi][facei])
102 - (nonlinearStress_[faceCelli] && gradU_[faceCelli]);
108 // Perform the averaging
110 forAll(patches, patchi)
112 const fvPatch& curPatch = patches[patchi];
114 if (curPatch.isWall())
116 forAll(curPatch, facei)
118 label faceCelli = curPatch.faceCells()[facei];
120 epsilon_[faceCelli] /= cellBoundaryFaceCount[faceCelli];
121 G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
128 // ************************************************************************* //