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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
31 // Update this with w2 if w2 nearer to pt.
32 template<class TrackingData>
33 inline bool Foam::wallPointYPlus::update
34 (
35  const point& pt,
36  const wallPointYPlus& w2,
37  const scalar tol,
38  TrackingData& td
39 )
40 {
41  const scalar dist2 = magSqr(pt - w2.origin());
42 
43  if (valid(td))
44  {
45  const scalar diff = distSqr() - dist2;
46 
47  if (diff < 0)
48  {
49  // already nearer to pt
50  return false;
51  }
52 
53  if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol)))
54  {
55  // don't propagate small changes
56  return false;
57  }
58  }
59 
60 
61  // Either *this is not yet valid or w2 is closer
62  {
63  // only propagate if interesting (i.e. y+ < 100)
64  const scalar yPlus = Foam::sqrt(dist2)/w2.data();
65 
66  if (yPlus < yPlusCutOff)
67  {
68  // update with new values
69  distSqr() = dist2;
70  origin() = w2.origin();
71  data() = w2.data();
72 
73  return true;
74  }
75  else
76  {
77  return false;
78  }
79  }
80 }
81 
82 
83 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
84 
86 :
87  wallPointData<scalar>()
88 {
89  // Important: value of yStar where meshWave does not come.
90  data() = 1.0;
91 }
92 
93 
95 (
96  const point& origin,
97  const scalar yStar,
98  const scalar distSqr
99 )
100 :
101  wallPointData<scalar>(origin, yStar, distSqr)
102 {}
103 
104 
105 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 
107 // Update this with w2 if w2 nearer to pt.
108 template<class TrackingData>
110 (
111  const polyMesh& mesh,
112  const label thisCelli,
113  const label neighbourFacei,
114  const wallPointYPlus& neighbourWallInfo,
115  const scalar tol,
116  TrackingData& td
117 )
118 {
119  const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
120 
121  return update
122  (
123  cellCentres[thisCelli],
124  neighbourWallInfo,
125  tol,
126  td
127  );
128 }
129 
130 
131 // Update this with w2 if w2 nearer to pt.
132 template<class TrackingData>
134 (
135  const polyMesh& mesh,
136  const label thisFacei,
137  const label neighbourCelli,
138  const wallPointYPlus& neighbourWallInfo,
139  const scalar tol,
140  TrackingData& td
141 )
142 {
143  const vectorField& faceCentres = mesh.faceCentres();
144 
145  return update
146  (
147  faceCentres[thisFacei],
148  neighbourWallInfo,
149  tol,
150  td
151  );
152 }
153 
154 
155 // Update this with w2 if w2 nearer to pt.
156 template<class TrackingData>
158 (
159  const polyMesh& mesh,
160  const label thisFacei,
161  const wallPointYPlus& neighbourWallInfo,
162  const scalar tol,
163  TrackingData& td
164 )
165 {
166  const vectorField& faceCentres = mesh.faceCentres();
167 
168  return update
169  (
170  faceCentres[thisFacei],
171  neighbourWallInfo,
172  tol,
173  td
174  );
175 }
176 
177 
178 // ************************************************************************* //
Foam::wallPointYPlus::updateCell
bool updateCell(const polyMesh &mesh, const label thisCelli, const label neighbourFacei, const wallPointYPlus &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: wallPointYPlusI.H:110
Foam::wallPointYPlus::yPlusCutOff
static scalar yPlusCutOff
The cut-off value for y+.
Definition: wallPointYPlus.H:84
update
mesh update()
Foam::wallPointYPlus::wallPointYPlus
wallPointYPlus()
Construct null.
Definition: wallPointYPlusI.H:85
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::diff
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
Definition: triad.C:378
Foam::Field< vector >
Foam::wallPointData< scalar >::data
const scalar & data() const
Definition: wallPointData.H:114
w2
#define w2
Definition: blockCreate.C:35
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::wallPointYPlus
Holds information (coordinate and yStar) regarding nearest wall point.
Definition: wallPointYPlus.H:60
Foam::wallPointYPlus::updateFace
bool updateFace(const polyMesh &mesh, const label thisFacei, const label neighbourCelli, const wallPointYPlus &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: wallPointYPlusI.H:134
Foam::Vector< scalar >
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::primitiveMesh::faceCentres
const vectorField & faceCentres() const
Definition: primitiveMeshFaceCentresAndAreas.C:77
Foam::wallPointData
Holds information (coordinate and normal) regarding nearest wall point.
Definition: wallPointData.H:52
yPlus
scalar yPlus
Definition: evaluateNearWall.H:16
Foam::point
vector point
Point is a vector.
Definition: point.H:43