Loading...
Searching...
No Matches
smoothDataI.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-2013 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// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30
31template<class TrackingData>
32inline bool Foam::smoothData::update
33(
34 const smoothData& svf,
35 const scalar scale,
36 const scalar tol,
37 TrackingData& td
38)
39{
40 if (!valid(td) || (value_ < VSMALL))
41 {
42 // My value not set - take over neighbour
43 value_ = svf.value()/scale;
44
45 // Something changed - let caller know
46 return true;
47 }
48 else if (svf.value() > (1 + tol)*scale*value_)
49 {
50 // Neighbour is too big for me - Up my value
51 value_ = svf.value()/scale;
52
53 // Something changed - let caller know
54 return true;
55 }
56 else
57 {
58 // Neighbour is not too big for me or change is too small
59 // Nothing changed
60 return false;
61 }
62}
63
64
65// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
68:
69 value_(-GREAT)
70{}
71
72
73inline Foam::smoothData::smoothData(const scalar value)
74:
75 value_(value)
76{}
77
78
79// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80
81template<class TrackingData>
82inline bool Foam::smoothData::valid(TrackingData& td) const
83{
84 return value_ > -SMALL;
85}
86
87
88template<class TrackingData>
90(
91 const polyMesh&,
92 const smoothData&,
93 const scalar,
94 TrackingData& td
95) const
96{
97 return true;
98}
99
100
101template<class TrackingData>
103(
104 const polyMesh&,
105 const polyPatch&,
106 const label,
107 const point&,
108 TrackingData& td
109)
110{}
111
112
113template<class TrackingData>
115(
116 const polyMesh&,
117 const tensor&,
118 TrackingData& td
119)
120{}
121
122
123template<class TrackingData>
125(
126 const polyMesh&,
127 const polyPatch&,
128 const label,
129 const point&,
130 TrackingData& td
131)
132{}
133
134
135template<class TrackingData>
137(
138 const polyMesh&,
139 const label,
140 const label,
141 const smoothData& svf,
142 const scalar tol,
143 TrackingData& td
144)
146 // Take over info from face if more than deltaRatio larger
147 return update(svf, td.maxRatio, tol, td);
148}
149
150
151template<class TrackingData>
153(
154 const polyMesh&,
155 const label,
156 const label,
157 const smoothData& svf,
158 const scalar tol,
159 TrackingData& td
160)
161{
162 // Take over information from cell without any scaling (scale = 1.0)
163 return update(svf, 1.0, tol, td);
164}
165
166
167// Update this (face) with coupled face information.
168template<class TrackingData>
170(
171 const polyMesh&,
172 const label,
173 const smoothData& svf,
174 const scalar tol,
175 TrackingData& td
176)
178 // Take over information from coupled face without any scaling (scale = 1.0)
179 return update(svf, 1.0, tol, td);
180}
181
182
183template<class TrackingData>
184inline bool Foam::smoothData::equal
185(
186 const smoothData& 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 smoothData& f0,
201 const label i1,
202 const smoothData& f1,
203 const scalar weight,
204 const scalar tol,
205 TrackingData& td
206)
207{
208 // TBD. What to interpolate? Do we have a position? cell/face centre?
209
210 if (!valid(td))
211 {
212 if (f0.valid(td))
213 {
214 operator=(f0);
215 }
216 else
217 {
218 operator=(f1);
219 }
220 }
221 else if (f0.valid(td))
222 {
223 operator=(f0);
224 }
225 else
226 {
227 operator=(f1);
229 return true;
230}
231
232
233// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
234
235inline bool Foam::smoothData::operator==
236(
238) const
239{
240 return value_ == rhs.value_;
241}
242
243
244inline bool Foam::smoothData::operator!=
245(
246 const smoothData& rhs
247) const
248{
249 return !(*this == rhs);
250}
251
252
253// ************************************************************************* //
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
Helper class used by the fvc::smooth and fvc::spread functions.
Definition smoothData.H:53
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
bool interpolate(const polyMesh &, const point &pt, const label i0, const smoothData &f0, const label i1, const smoothData &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...
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const smoothData &svf, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const smoothData &svf, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool sameGeometry(const polyMesh &, const smoothData &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking).
Definition smoothDataI.H:83
scalar value() const
Return value.
Definition smoothData.H:124
smoothData(const smoothData &)=default
Copy construct.
bool equal(const smoothData &, TrackingData &td) const
Test for equality, with TrackingData.
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition smoothDataI.H:75
smoothData()
Default construct.
Definition smoothDataI.H:60
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face centre.
Definition smoothDataI.H:96
smoothData & operator=(const smoothData &)=default
Copy assignment.
mesh update()
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Tensor< scalar > tensor
Definition symmTensor.H:57
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
vector point
Point is a vector.
Definition point.H:37
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)