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-------------------------------------------------------------------------------
11License
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.
32template<class TrackingData>
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.
108template<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.
132template<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.
156template<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// ************************************************************************* //
#define w2
Definition: blockCreate.C:35
virtual bool update()
Update the mesh for both mesh motion and topology change.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
const vectorField & faceCentres() const
Holds information (coordinate and normal) regarding nearest wall point.
Definition: wallPointData.H:66
const scalar & data() const
Holds information (coordinate and yStar) regarding nearest wall point.
bool updateFace(const polyMesh &mesh, const label thisFacei, const label neighbourCelli, const wallPointYPlus &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
wallPointYPlus()
Construct null.
static scalar yPlusCutOff
The cut-off value for y+.
bool updateCell(const polyMesh &mesh, const label thisCelli, const label neighbourFacei, const wallPointYPlus &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
const point & origin() const
Definition: wallPoint.H:106
scalar distSqr() const
Definition: wallPoint.H:115
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: wallPointI.H:105
mesh update()
dynamicFvMesh & mesh
scalar yPlus
dimensionedScalar sqrt(const dimensionedScalar &ds)
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
Definition: triad.C:378
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)