wallPointDataI.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 Type>
33template<class TrackingData>
35(
36 const point& pt,
37 const wallPointData<Type>& w2,
38 const scalar tol,
39 TrackingData& td
40)
41{
42 const scalar dist2 = magSqr(pt - w2.origin());
43
44 if (valid(td))
45 {
46 const 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 }
60
61 // Either *this is not yet valid or w2 is closer
62 {
63 // current not yet set so use any value
64 distSqr() = dist2;
65 origin() = w2.origin();
66 data_ = w2.data();
67
68 return true;
69 }
70}
71
72
73// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
74
75template<class Type>
77:
78 wallPoint(),
79 data_()
80{}
81
82
83template<class Type>
85(
86 const point& origin,
87 const Type& data,
88 const scalar distSqr
89)
90:
91 wallPoint(origin, distSqr),
92 data_(data)
93{}
94
95
96// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97
98// Update this with w2 if w2 nearer to pt.
99template<class Type>
100template<class TrackingData>
103 const polyMesh& mesh,
104 const label thisCelli,
105 const label,
106 const wallPointData<Type>& neighbourWallInfo,
107 const scalar tol,
108 TrackingData& td
109)
110{
111 const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
112
113 return update
114 (
115 cellCentres[thisCelli],
116 neighbourWallInfo,
117 tol,
118 td
119 );
120}
121
122
123// Update this with w2 if w2 nearer to pt.
124template<class Type>
125template<class TrackingData>
127(
128 const polyMesh& mesh,
129 const label thisFacei,
130 const label,
131 const wallPointData<Type>& neighbourWallInfo,
132 const scalar tol,
133 TrackingData& td
134)
135{
136 const vectorField& faceCentres = mesh.faceCentres();
137
138 return update
139 (
140 faceCentres[thisFacei],
141 neighbourWallInfo,
142 tol,
143 td
144 );
145}
146
147
148// Update this with w2 if w2 nearer to pt.
149template<class Type>
150template<class TrackingData>
152(
153 const polyMesh& mesh,
154 const label thisFacei,
155 const wallPointData<Type>& neighbourWallInfo,
156 const scalar tol,
157 TrackingData& td
158)
159{
160 const vectorField& faceCentres = mesh.faceCentres();
161
162 return update
163 (
164 faceCentres[thisFacei],
165 neighbourWallInfo,
166 tol,
167 td
168 );
169}
170
171
172// ************************************************************************* //
#define w2
Definition: blockCreate.C:35
Database for solution data, solver performance and other reduced data.
Definition: data.H:58
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
bool updateCell(const polyMesh &mesh, const label thisCelli, const label neighbourFacei, const wallPointData< Type > &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
wallPointData()
Default construct.
bool updateFace(const polyMesh &mesh, const label thisFacei, const label neighbourCelli, const wallPointData< Type > &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition: wallPoint.H:66
mesh update()
dynamicFvMesh & mesh
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)