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 | Copyright (C) 2015 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "polyMesh.H"
27 #include "transform.H"
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
31 // Update this with w2 if w2 nearer to pt.
32 template<class TrackingData>
34 (
35  const point& pt,
36  const transportData& w2,
37  const scalar tol,
38  TrackingData& td
39 )
40 {
41  scalar dist2 = magSqr(pt - w2.origin());
42 
43  if (valid(td))
44  {
45  scalar diff = distSqr() - dist2;
46 
47  if (diff < 0)
48  {
49  // Already nearer to pt
50  return false;
51  }
52 
53  if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol)))
54  {
55  // Don't propagate small changes
56  return false;
57  }
58  }
59 
60  // Either *this is not yet valid or w2 is closer
61  {
62  // current not yet set so use any value
63  distSqr() = dist2;
64  origin() = w2.origin();
65  data() = w2.data();
66 
67  if (distSqr() > sqr(0.25*data()))
68  {
69  // No need to transport gap data since too far away
70  return false;
71  }
72 
73  return true;
74  }
75 }
76 
77 
78 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
79 
81 :
82  wallPointData<scalar>()
83 {}
84 
85 
87 (
88  const point& origin,
89  const scalar gapSize,
90  const scalar distSqr
91 )
92 :
93  wallPointData<scalar>(origin, gapSize, distSqr)
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
99 template<class TrackingData>
101 (
102  const polyMesh& mesh,
103  const label cellI,
104  const label faceI,
105  const transportData& neighbourWallInfo,
106  const scalar tol,
107  TrackingData& td
108 )
109 {
110  if (td.surfaceIndex_[faceI] != -1)
111  {
112  return false;
113  }
114 
115  const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
116 
117  bool updated = update
118  (
119  cellCentres[cellI],
120  neighbourWallInfo,
121  tol,
122  td
123  );
124 
125  return updated;
126 }
127 
128 
129 template<class TrackingData>
131 (
132  const polyMesh& mesh,
133  const label thisFaceI,
134  const label neighbourCellI,
135  const transportData& neighbourWallInfo,
136  const scalar tol,
137  TrackingData& td
138 )
139 {
140  if (td.surfaceIndex_[thisFaceI] != -1)
141  {
142  return false;
143  }
144 
145  return update
146  (
147  mesh.faceCentres()[thisFaceI],
148  neighbourWallInfo,
149  tol,
150  td
151  );
152 }
153 
154 
155 template<class TrackingData>
157 (
158  const polyMesh& mesh,
159  const label thisFaceI,
160  const transportData& neighbourWallInfo,
161  const scalar tol,
162  TrackingData& td
163 )
164 {
165  if (td.surfaceIndex_[thisFaceI] != -1)
166  {
167  return false;
168  }
169 
170  return update
171  (
172  mesh.faceCentres()[thisFaceI],
173  neighbourWallInfo,
174  tol,
175  td
176  );
177 }
178 
179 
180 // ************************************************************************* //
Foam::transportData
Holds information (coordinate and distance). Walks out 0.5*distance.
Definition: transportData.H:52
Foam::transportData::updateCell
bool updateCell(const polyMesh &mesh, const label thisCellI, const label neighbourFaceI, const transportData &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: transportDataI.H:101
Foam::transportData::updateFace
bool updateFace(const polyMesh &mesh, const label thisFaceI, const label neighbourCellI, const transportData &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: transportDataI.H:131
Foam::wallPointData::data
const Type & data() const
Definition: wallPointDataI.H:103
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::diff
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
Definition: triad.C:407
Foam::transportData::transportData
transportData()
Construct null.
Definition: transportDataI.H:80
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::transportData::update
bool update(const point &, const transportData &w2, const scalar tol, TrackingData &td)
Evaluate distance to point. Update distSqr, origin from whomever.
Definition: transportDataI.H:34
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
Foam::Vector< scalar >
Foam::primitiveMesh::faceCentres
const vectorField & faceCentres() const
Definition: primitiveMeshFaceCentresAndAreas.C:130
Foam::wallPointData
Holds information (coordinate and normal) regarding nearest wall point.
Definition: wallPointData.H:48
transform.H
3D tensor transformation operations.
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
Foam::magSqr
dimensioned< scalar > magSqr(const dimensioned< Type > &)