Loading...
Searching...
No Matches
wallNormalInfoI.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,2025 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#include "polyMesh.H"
30
31// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33// Update this with w2 if not yet set.
34template<class TrackingData>
35inline bool Foam::wallNormalInfo::update
36(
37 const wallNormalInfo& w2,
38 TrackingData& td
39)
40{
41 if (!w2.valid(td))
42 {
44 << "Problem: w2 is not valid" << abort(FatalError);
45
46 return false;
47 }
48 else if (valid(td))
49 {
50 // our already set. Stop any transfer
51 return false;
52 }
53 else
54 {
55 normal_ = w2.normal();
56
57 return true;
58 }
59}
60
61
62// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65:
66 normal_(point::max)
67{}
68
69
71:
72 normal_(normal)
73{}
74
75
76// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77
78template<class TrackingData>
79inline bool Foam::wallNormalInfo::valid(TrackingData& td) const
81 return normal_ != point::max;
82}
83
84
85// No geometric data so never any problem on cyclics
86template<class TrackingData>
88(
89 const polyMesh&,
90 const wallNormalInfo& w2,
91 const scalar tol,
92 TrackingData& td
93) const
95 return true;
96}
97
98
99// No geometric data.
100template<class TrackingData>
102(
103 const polyMesh&,
104 const polyPatch& patch,
105 const label patchFacei,
106 const point& faceCentre,
107 TrackingData& td
108)
109{}
110
111
112// No geometric data.
113template<class TrackingData>
115(
116 const polyMesh&,
117 const tensor& rotTensor,
118 TrackingData& td
119)
120{}
121
122
123// No geometric data.
124template<class TrackingData>
126(
127 const polyMesh&,
128 const polyPatch& patch,
129 const label patchFacei,
130 const point& faceCentre,
131 TrackingData& td
132)
133{}
134
135
136// Update this with w2 if w2 nearer to pt.
137template<class TrackingData>
139(
140 const polyMesh&,
141 const label thisCelli,
142 const label neighbourFacei,
143 const wallNormalInfo& neighbourWallInfo,
144 const scalar tol,
145 TrackingData& td
146)
148 return update(neighbourWallInfo, td);
149}
150
151
152// Update this with w2 if w2 nearer to pt.
153template<class TrackingData>
155(
156 const polyMesh&,
157 const label thisFacei,
158 const label neighbourCelli,
159 const wallNormalInfo& neighbourWallInfo,
160 const scalar tol,
161 TrackingData& td
162)
164 return update(neighbourWallInfo, td);
165}
166
167
168// Update this with w2 if w2 nearer to pt.
169template<class TrackingData>
171(
172 const polyMesh&,
173 const label thisFacei,
174 const wallNormalInfo& neighbourWallInfo,
175 const scalar tol,
176 TrackingData& td
178{
179 return update(neighbourWallInfo, td);
180}
181
182
183template<class TrackingData>
185(
186 const wallNormalInfo& rhs,
187 TrackingData& td
188) const
189{
190 return operator==(rhs);
191}
192
193
194template<class TrackingData>
196(
197 const polyMesh&,
198 const point& pt,
199 const label i0,
200 const wallNormalInfo& f0,
201 const label i1,
202 const wallNormalInfo& f1,
203 const scalar weight,
204 const scalar tol,
205 TrackingData& td
206)
207{
208 if (f0.valid(td))
209 {
210 return update(f0, td);
211 }
212 if (f1.valid(td))
213 {
214 return update(f1, td);
215 }
216 else
217 {
218 return false;
219 }
220}
221
222
223// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
224
225inline bool Foam::wallNormalInfo::operator==
226(
228) const
229{
230 return normal_ == rhs.normal_;
231}
232
233
234inline bool Foam::wallNormalInfo::operator!=
235(
236 const wallNormalInfo& rhs
237) const
238{
239 return !(*this == rhs);
240}
241
242
243// ************************************************************************* //
#define w2
Definition blockCreate.C:28
static const Form max
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
Holds information regarding nearest wall point. Used in wall refinement.
wallNormalInfo()
Default construct.
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const wallNormalInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool sameGeometry(const polyMesh &, const wallNormalInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking).
bool interpolate(const polyMesh &, const point &pt, const label i0, const wallNormalInfo &f0, const label i1, const wallNormalInfo &f1, const scalar weight, const scalar tol, TrackingData &td)
Interpolate between two values (lerp). Returns true if causes changes. Not sure if needs to be specia...
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
const vector & normal() const
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const wallNormalInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
bool equal(const wallNormalInfo &, TrackingData &td) const
Test for equality, with TrackingData.
mesh update()
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
Tensor< scalar > tensor
Definition symmTensor.H:57
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
errorManip< error > abort(error &err)
Definition errorManip.H:139
vector point
Point is a vector.
Definition point.H:37
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
Vector< scalar > vector
Definition vector.H:57