wallPointYPlusI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 namespace Foam
29 {
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 // Update this with w2 if w2 nearer to pt.
34 template<class TrackingData>
35 inline bool wallPointYPlus::update
36 (
37  const point& pt,
38  const wallPointYPlus& w2,
39  const scalar tol,
40  TrackingData& td
41 )
42 {
43  scalar dist2 = magSqr(pt - w2.origin());
44 
45  if (valid(td))
46  {
47  scalar diff = distSqr() - dist2;
48 
49  if (diff < 0)
50  {
51  // already nearer to pt
52  return false;
53  }
54 
55  if ((diff < small) || ((distSqr() > small) && (diff/distSqr() < tol)))
56  {
57  // don't propagate small changes
58  return false;
59  }
60  }
61 
62 
63  // Either *this is not yet valid or w2 is closer
64  {
65  // only propagate if interesting (i.e. y+ < 100)
66  scalar yPlus = Foam::sqrt(dist2)/w2.data();
67 
68  if (yPlus < yPlusCutOff)
69  {
70  // update with new values
71  distSqr() = dist2;
72  origin() = w2.origin();
73  data() = w2.data();
74 
75  return true;
76  }
77  else
78  {
79  return false;
80  }
81  }
82 }
83 
84 
85 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
86 
87 // Null constructor
89 :
90  wallPointData<scalar>()
91 {
92  // Important: value of yStar where meshWave does not come.
93  data() = 1.0;
94 }
95 
96 
97 // Construct from components
99 (
100  const point& origin,
101  const scalar yStar,
102  const scalar distSqr
103 )
104 :
106 {}
107 
108 
109 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110 
111 // Update this with w2 if w2 nearer to pt.
112 template<class TrackingData>
113 inline bool wallPointYPlus::updateCell
114 (
115  const polyMesh& mesh,
116  const label thisCelli,
117  const label neighbourFacei,
118  const wallPointYPlus& neighbourWallInfo,
119  const scalar tol,
120  TrackingData& td
121 )
122 {
123  const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
124 
125  return update
126  (
127  cellCentres[thisCelli],
128  neighbourWallInfo,
129  tol,
130  td
131  );
132 }
133 
134 
135 // Update this with w2 if w2 nearer to pt.
136 template<class TrackingData>
137 inline bool wallPointYPlus::updateFace
138 (
139  const polyMesh& mesh,
140  const label thisFacei,
141  const label neighbourCelli,
142  const wallPointYPlus& neighbourWallInfo,
143  const scalar tol,
144  TrackingData& td
145 )
146 {
147  const vectorField& faceCentres = mesh.faceCentres();
148 
149  return update
150  (
151  faceCentres[thisFacei],
152  neighbourWallInfo,
153  tol,
154  td
155  );
156 }
157 
158 
159 // Update this with w2 if w2 nearer to pt.
160 template<class TrackingData>
161 inline bool wallPointYPlus::updateFace
162 (
163  const polyMesh& mesh,
164  const label thisFacei,
165  const wallPointYPlus& neighbourWallInfo,
166  const scalar tol,
167  TrackingData& td
168 )
169 {
170  const vectorField& faceCentres = mesh.faceCentres();
171 
172  return update
173  (
174  faceCentres[thisFacei],
175  neighbourWallInfo,
176  tol,
177  td
178  );
179 }
180 
181 
182 // ************************************************************************* //
183 
184 } // End namespace Foam
185 
186 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dimensionedScalar sqrt(const dimensionedScalar &ds)
const scalar & data() const
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: wallPointI.H:126
bool updateCell(const polyMesh &mesh, const label thisCelli, const label neighbourFacei, const wallPointYPlus &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
wallPointYPlus()
Construct null.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const vectorField & faceCentres() const
Holds information (coordinate and normal) regarding nearest wall point.
Definition: wallPointData.H:48
const point & origin() const
Definition: wallPointI.H:101
vector point
Point is a vector.
Definition: point.H:41
scalar distSqr() const
Definition: wallPointI.H:113
static scalar yPlusCutOff
cut-off value for y+
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Holds information (coordinate and yStar) regarding nearest wall point.
Namespace for OpenFOAM.
bool updateFace(const polyMesh &mesh, const label thisFacei, const label neighbourCelli, const wallPointYPlus &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.