FreeFOAM The Cross-Platform CFD Toolkit
nonLinearWallFunctionsI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Global
25  nonLinearwallFunctions
26 
27 Description
28  Calculate wall generation and dissipation from wall-functions
29  for non-linear models.
30 
31 \*---------------------------------------------------------------------------*/
32 
33 {
34  labelList cellBoundaryFaceCount(epsilon_.size(), 0);
35 
36  scalar yPlusLam = this->yPlusLam(kappa_.value(), E_.value());
37 
38  const fvPatchList& patches = mesh_.boundary();
39 
40  //- Initialise the near-wall G and epsilon fields to zero
41  forAll(patches, patchi)
42  {
43  const fvPatch& curPatch = patches[patchi];
44 
45  if (isA<wallFvPatch>(curPatch))
46  {
47  forAll(curPatch, facei)
48  {
49  label faceCelli = curPatch.faceCells()[facei];
50 
51  epsilon_[faceCelli] = 0.0;
52  G[faceCelli] = 0.0;
53  }
54  }
55  }
56 
57  //- Accumulate the wall face contributions to epsilon and G
58  // Increment cellBoundaryFaceCount for each face for averaging
59  forAll(patches, patchi)
60  {
61  const fvPatch& curPatch = patches[patchi];
62 
63  if (isA<wallFvPatch>(curPatch))
64  {
66 
67  const scalarField& nuw = nu().boundaryField()[patchi];
68  const scalarField& nutw = nut_.boundaryField()[patchi];
69 
70  scalarField magFaceGradU = mag(U_.boundaryField()[patchi].snGrad());
71 
72  forAll(curPatch, facei)
73  {
74  label faceCelli = curPatch.faceCells()[facei];
75 
76  //- using local Cmu !
77  scalar Cmu25 = pow(Cmu_[faceCelli], 0.25);
78  scalar Cmu75 = pow(Cmu_[faceCelli], 0.75);
79 
80  scalar yPlus =
81  Cmu25*y_[patchi][facei]
82  *sqrt(k_[faceCelli])
83  /nuw[facei];
84 
85  // For corner cells (with two boundary or more faces),
86  // epsilon and G in the near-wall cell are calculated
87  // as an average
88 
89  cellBoundaryFaceCount[faceCelli]++;
90 
91  epsilon_[faceCelli] +=
92  Cmu75*pow(k_[faceCelli], 1.5)
93  /(kappa_.value()*y_[patchi][facei]);
94 
95  if (yPlus > yPlusLam)
96  {
97  G[faceCelli] +=
98  (nutw[facei] + nuw[facei])
99  *magFaceGradU[facei]
100  *Cmu25*sqrt(k_[faceCelli])
101  /(kappa_.value()*y_[patchi][facei])
102  - (nonlinearStress_[faceCelli] && gradU_[faceCelli]);
103  }
104  }
105  }
106  }
107 
108  // Perform the averaging
109 
110  forAll(patches, patchi)
111  {
112  const fvPatch& curPatch = patches[patchi];
113 
114  if (isA<wallFvPatch>(curPatch))
115  {
116  forAll(curPatch, facei)
117  {
118  label faceCelli = curPatch.faceCells()[facei];
119 
120  epsilon_[faceCelli] /= cellBoundaryFaceCount[faceCelli];
121  G[faceCelli] /= cellBoundaryFaceCount[faceCelli];
122  }
123  }
124  }
125 }
126 
127 
128 // ************************ vim: set sw=4 sts=4 et: ************************ //