transportDataI.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) 2015-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#include "polyMesh.H"
29#include "transform.H"
30
31// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33// Update this with w2 if w2 nearer to pt.
34template<class TrackingData>
36(
37 const point& pt,
38 const transportData& w2,
39 const scalar tol,
40 TrackingData& td
41)
42{
43 const scalar dist2 = magSqr(pt - w2.origin());
44
45 if (valid(td))
46 {
47 const scalar diff = distSqr() - dist2;
48
49 if (diff < 0)
50 {
51 // Already nearer to pt
52 return false;
53 }
54
55 if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol)))
56 {
57 // Don't propagate small changes
58 return false;
59 }
60 }
61
62 // Either *this is not yet valid or w2 is closer
63 {
64 // current not yet set so use any value
65 distSqr() = dist2;
66 origin() = w2.origin();
67 data() = w2.data();
68
69 if (distSqr() > sqr(0.25*data()))
70 {
71 // No need to transport gap data since too far away
72 return false;
73 }
74
75 return true;
76 }
77}
78
79
80// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
81
83:
84 wallPointData<scalar>()
85{}
86
87
89(
90 const point& origin,
91 const scalar gapSize,
92 const scalar distSqr
93)
94:
95 wallPointData<scalar>(origin, gapSize, distSqr)
96{}
97
98
99// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100
101template<class TrackingData>
103(
104 const polyMesh& mesh,
105 const label cellI,
106 const label faceI,
107 const transportData& neighbourWallInfo,
108 const scalar tol,
109 TrackingData& td
110)
111{
112 if (td.surfaceIndex_[faceI] != -1)
113 {
114 return false;
115 }
116
117 const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
118
119 bool updated = update
120 (
121 cellCentres[cellI],
122 neighbourWallInfo,
123 tol,
124 td
125 );
126
127 return updated;
128}
129
130
131template<class TrackingData>
133(
134 const polyMesh& mesh,
135 const label thisFaceI,
136 const label neighbourCellI,
137 const transportData& neighbourWallInfo,
138 const scalar tol,
139 TrackingData& td
140)
141{
142 if (td.surfaceIndex_[thisFaceI] != -1)
143 {
144 return false;
145 }
146
147 return update
148 (
149 mesh.faceCentres()[thisFaceI],
150 neighbourWallInfo,
151 tol,
152 td
153 );
154}
155
156
157template<class TrackingData>
159(
160 const polyMesh& mesh,
161 const label thisFaceI,
162 const transportData& neighbourWallInfo,
163 const scalar tol,
164 TrackingData& td
165)
166{
167 if (td.surfaceIndex_[thisFaceI] != -1)
168 {
169 return false;
170 }
171
172 return update
173 (
174 mesh.faceCentres()[thisFaceI],
175 neighbourWallInfo,
176 tol,
177 td
178 );
179}
180
181
182// ************************************************************************* //
#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 distance). Walks out 0.5*distance.
Definition: transportData.H:57
bool updateFace(const polyMesh &mesh, const label thisFaceI, const label neighbourCellI, const transportData &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
transportData()
Construct null.
bool updateCell(const polyMesh &mesh, const label thisCellI, const label neighbourFaceI, const transportData &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Holds information (coordinate and normal) regarding nearest wall point.
Definition: wallPointData.H:66
const scalar & data() const
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
dimensionedSymmTensor sqr(const dimensionedVector &dv)
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)
3D tensor transformation operations.