FreeFOAM The Cross-Platform CFD Toolkit
wallPointYPlusI.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 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 
35 
36 // Update this with w2 if w2 nearer to pt.
37 inline bool wallPointYPlus::update
38 (
39  const point& pt,
40  const wallPointYPlus& w2,
41  const scalar tol
42 )
43 {
44  scalar dist2 = magSqr(pt - w2.origin());
45 
46  scalar diff = distSqr() - dist2;
47 
48  if (diff < 0)
49  {
50  // already nearer to pt
51  return false;
52  }
53 
54  if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol)))
55  {
56  // don't propagate small changes
57  return false;
58  }
59  else
60  {
61  // only propagate if interesting (i.e. y+ < 100)
62  scalar yPlus = Foam::sqrt(dist2)/w2.data();
63 
64 
65  if (yPlus < yPlusCutOff)
66  {
67  // update with new values
68  distSqr() = dist2;
69  origin() = w2.origin();
70  data() = w2.data();
71 
72  return true;
73  }
74  else
75  {
76  return false;
77  }
78  }
79 }
80 
81 
82 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
83 
84 // Null constructor
86 :
87  wallPointData<scalar>()
88 {
89  // Important: value of yStar where meshWave does not come.
90  data() = 1.0;
91 }
92 
93 
94 // Construct from components
96 (
97  const point& origin,
98  const scalar yStar,
99  const scalar distSqr
100 )
101 :
102  wallPointData<scalar>(origin, yStar, distSqr)
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107 
108 // Update this with w2 if w2 nearer to pt.
109 inline bool wallPointYPlus::updateCell
110 (
111  const polyMesh& mesh,
112  const label thisCellI,
113  const label neighbourFaceI,
114  const wallPointYPlus& neighbourWallInfo,
115  const scalar tol
116 )
117 {
118  const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
119 
120  return update
121  (
122  cellCentres[thisCellI],
123  neighbourWallInfo,
124  tol
125  );
126 }
127 
128 
129 // Update this with w2 if w2 nearer to pt.
130 inline bool wallPointYPlus::updateFace
131 (
132  const polyMesh& mesh,
133  const label thisFaceI,
134  const label neighbourCellI,
135  const wallPointYPlus& neighbourWallInfo,
136  const scalar tol
137 )
138 {
139  const vectorField& faceCentres = mesh.faceCentres();
140 
141  return update
142  (
143  faceCentres[thisFaceI],
144  neighbourWallInfo,
145  tol
146  );
147 }
148 
149 
150 // Update this with w2 if w2 nearer to pt.
151 inline bool wallPointYPlus::updateFace
152 (
153  const polyMesh& mesh,
154  const label thisFaceI,
155  const wallPointYPlus& neighbourWallInfo,
156  const scalar tol
157 )
158 {
159  const vectorField& faceCentres = mesh.faceCentres();
160 
161  return update
162  (
163  faceCentres[thisFaceI],
164  neighbourWallInfo,
165  tol
166  );
167 }
168 
169 } // End namespace Foam
170 
171 // ************************ vim: set sw=4 sts=4 et: ************************ //