directionalWallPointDataI.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) 2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29
30namespace Foam
31{
32
33// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34
35// Update this with w2 if w2 nearer to pt.
36template<class Type>
37template<class TrackingData>
39(
40 const point& pt,
41 const directionalWallPointData<Type>& w2,
42 const scalar tol,
43 TrackingData& n
44)
45{
46 vector d(pt - w2.origin());
47 d.removeCollinear(n);
48
49 scalar dist2 = magSqr(d);
50
51 if (this->valid(n))
52 {
53 vector d(pt - this->origin());
54 d.removeCollinear(n);
55
56 scalar currentDistSqr(magSqr(d));
57
58 scalar diff = currentDistSqr - dist2;
59
60 if (diff < 0)
61 {
62 // already nearer to pt
63 return false;
64 }
65
66 if
67 (
68 (diff < SMALL)
69 || ((currentDistSqr > SMALL) && (diff/currentDistSqr < tol))
70 )
71 {
72 // don't propagate small changes
73 return false;
74 }
75 }
76
77 // Either *this is not yet valid or w2 is closer
78 {
79 // current not yet set so use any value
80 this->distSqr() = magSqr(pt - w2.origin());
81 this->origin() = w2.origin();
82 this->data() = w2.data();
83
84 return true;
85 }
86}
87
88
89// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
90
91// Null constructor
92template<class Type>
94:
95 wallPointData<Type>()
96{}
97
98
99// Construct from components
100template<class Type>
102(
103 const point& origin,
104 const Type& data,
105 const scalar distSqr
106)
107:
108 wallPointData<Type>(origin, data, distSqr)
109{}
110
111
112// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
113
114// Update this with w2 if w2 nearer to pt.
115template<class Type>
116template<class TrackingData>
118(
119 const polyMesh& mesh,
120 const label thisCelli,
121 const label,
122 const directionalWallPointData<Type>& neighbourWallInfo,
123 const scalar tol,
124 TrackingData& td
125)
126{
127 const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
128
129 return update
130 (
131 cellCentres[thisCelli],
132 neighbourWallInfo,
133 tol,
134 td
135 );
136}
137
138
139// Update this with w2 if w2 nearer to pt.
140template<class Type>
141template<class TrackingData>
143(
144 const polyMesh& mesh,
145 const label thisFacei,
146 const label,
147 const directionalWallPointData<Type>& neighbourWallInfo,
148 const scalar tol,
149 TrackingData& td
150)
151{
152 const vectorField& faceCentres = mesh.faceCentres();
153
154 return update
155 (
156 faceCentres[thisFacei],
157 neighbourWallInfo,
158 tol,
159 td
160 );
161}
162
163
164// Update this with w2 if w2 nearer to pt.
165template<class Type>
166template<class TrackingData>
168(
169 const polyMesh& mesh,
170 const label thisFacei,
171 const directionalWallPointData<Type>& neighbourWallInfo,
172 const scalar tol,
173 TrackingData& td
174)
175{
176 const vectorField& faceCentres = mesh.faceCentres();
177
178 return update
179 (
180 faceCentres[thisFacei],
181 neighbourWallInfo,
182 tol,
183 td
184 );
185}
186
187
188// ************************************************************************* //
189
190} // End namespace Foam
191
192// ************************************************************************* //
label n
#define w2
Definition: blockCreate.C:35
Database for solution data, solver performance and other reduced data.
Definition: data.H:58
Holds information (coordinate and normal) regarding the nearest wall point.
bool updateFace(const polyMesh &mesh, const label thisFacei, const label neighbourCelli, const directionalWallPointData< Type > &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool updateCell(const polyMesh &mesh, const label thisCelli, const label neighbourFacei, const directionalWallPointData< Type > &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
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
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Holds information (coordinate and normal) regarding nearest wall point.
Definition: wallPointData.H:66
mesh update()
dynamicFvMesh & mesh
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition: point.H:43
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)