meshPhiCorrectInfo.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
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 Class
25  Foam::meshPhiCorrectInfo
26 
27 SourceFiles
28  meshPhiCorrectInfoI.H
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef meshPhiCorrectInfo_H
33 #define meshPhiCorrectInfo_H
34 
35 #include "meshPhiPreCorrectInfo.H"
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41 
42 // Forward declaration of classes
43 class fvPatch;
44 class fvMesh;
45 class transformer;
46 
47 // Forward declaration of friend functions and operators
48 class meshPhiCorrectInfo;
49 Ostream& operator<<(Ostream&, const meshPhiCorrectInfo&);
50 Istream& operator>>(Istream&, meshPhiCorrectInfo&);
51 
52 /*---------------------------------------------------------------------------*\
53  Class meshPhiCorrectInfo Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 {
58 public:
59 
60  // Public Classes
61 
62  //- Enumeration to define the mesh shape the info applies to
63  enum class shape
64  {
65  invalid,
66  face,
67  cell
68  };
69 
70 
71  //- Tracking data. Mostly just a collection of references to the
72  // pre-correct info.
73  class trackData
74  {
75  public:
76 
81 
82  trackData
83  (
84  const List<meshPhiPreCorrectInfo>& internalFacePci,
85  const List<List<meshPhiPreCorrectInfo>>& patchFacePci,
86  const List<meshPhiPreCorrectInfo>& cellPci,
87  const DimensionedField<scalar, volMesh>& dVdtError
88  )
89  :
90  internalFacePci_(internalFacePci),
91  patchFacePci_(patchFacePci),
92  cellPci_(cellPci),
93  dVdtError_(dVdtError)
94  {}
95  };
96 
97 
98 private:
99 
100  // Private Data
101 
102  //- The primitive shape that this info applies to
103  shape shape_;
104 
105  //- Flux correction (if on a face) or volume conservation correction
106  // (if in a cell)
107  scalar delta_;
108 
109 
110  // Private Member Functions
111 
112  //- Throw an error if this is not a face
113  void validateFace() const;
114 
115  //- Throw an error if this is not a cell
116  void validateCell() const;
117 
118 
119 public:
120 
121  // Constructors
122 
123  //- Construct null
124  inline meshPhiCorrectInfo();
125 
126  //- Construct for given shape
127  inline meshPhiCorrectInfo(const shape& s);
128 
129 
130  // Member Functions
131 
132  // Access
133 
134  //- Return the flux correction
135  inline scalar deltaPhi() const;
136 
137  //- Access the flux correction
138  inline scalar& deltaPhi();
139 
140  //- Return the volume change rate error correction
141  inline scalar deltaDVdtError() const;
142 
143  //- Access the volume change rate error correction
144  inline scalar& deltaDVdtError();
145 
146 
147  // Needed by FaceCellWave
148 
149  //- Check whether the meshPhiCorrectInfo has been changed at all
150  // or still contains original (invalid) value.
151  template<class TrackingData>
152  inline bool valid(TrackingData& td) const;
153 
154  //- Check for identical geometrical data. Used for checking
155  // consistency across cyclics.
156  template<class TrackingData>
157  inline bool sameGeometry
158  (
159  const fvMesh& mesh,
160  const meshPhiCorrectInfo&,
161  const scalar,
162  TrackingData& td
163  ) const;
164 
165  //- Transform across an interface
166  template<class TrackingData>
167  inline void transform
168  (
169  const fvPatch& patch,
170  const label patchFacei,
171  const transformer& transform,
172  TrackingData& td
173  );
174 
175  //- Influence of neighbouring face
176  template<class TrackingData>
177  inline bool updateCell
178  (
179  const fvMesh& mesh,
180  const label thisCelli,
181  const labelPair& neighbourPatchAndFacei,
182  const meshPhiCorrectInfo& neighbourInfo,
183  const scalar tol,
184  TrackingData& td
185  );
186 
187  //- Influence of neighbouring cell
188  template<class TrackingData>
189  inline bool updateFace
190  (
191  const fvMesh& mesh,
192  const labelPair& thisPatchAndFacei,
193  const label neighbourCelli,
194  const meshPhiCorrectInfo& neighbourInfo,
195  const scalar tol,
196  TrackingData& td
197  );
198 
199  //- Influence of different value on same face
200  template<class TrackingData>
201  inline bool updateFace
202  (
203  const fvMesh& mesh,
204  const labelPair& thisPatchAndFacei,
205  const meshPhiCorrectInfo& neighbourInfo,
206  const scalar tol,
207  TrackingData& td
208  );
209 
210  //- Test equality
211  template<class TrackingData>
212  inline bool equal
213  (
214  const meshPhiCorrectInfo&,
215  TrackingData& td
216  ) const;
217 
218 
219  // Member Operators
220 
221  inline bool operator==(const meshPhiCorrectInfo&) const;
222  inline bool operator!=(const meshPhiCorrectInfo&) const;
223 
224 
225  // IOstream Operators
226 
229 };
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #include "meshPhiCorrectInfoI.H"
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Tracking data. Mostly just a collection of references to the.
const List< meshPhiPreCorrectInfo > & cellPci_
const List< List< meshPhiPreCorrectInfo > > & patchFacePci_
const List< meshPhiPreCorrectInfo > & internalFacePci_
const DimensionedField< scalar, volMesh > & dVdtError_
trackData(const List< meshPhiPreCorrectInfo > &internalFacePci, const List< List< meshPhiPreCorrectInfo >> &patchFacePci, const List< meshPhiPreCorrectInfo > &cellPci, const DimensionedField< scalar, volMesh > &dVdtError)
bool updateCell(const fvMesh &mesh, const label thisCelli, const labelPair &neighbourPatchAndFacei, const meshPhiCorrectInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
friend Ostream & operator<<(Ostream &, const meshPhiCorrectInfo &)
bool updateFace(const fvMesh &mesh, const labelPair &thisPatchAndFacei, const label neighbourCelli, const meshPhiCorrectInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
scalar deltaPhi() const
Return the flux correction.
shape
Enumeration to define the mesh shape the info applies to.
meshPhiCorrectInfo()
Construct null.
bool operator==(const meshPhiCorrectInfo &) const
bool operator!=(const meshPhiCorrectInfo &) const
bool equal(const meshPhiCorrectInfo &, TrackingData &td) const
Test equality.
friend Istream & operator>>(Istream &, meshPhiCorrectInfo &)
bool sameGeometry(const fvMesh &mesh, const meshPhiCorrectInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for checking.
scalar deltaDVdtError() const
Return the volume change rate error correction.
bool valid(TrackingData &td) const
Check whether the meshPhiCorrectInfo has been changed at all.
void transform(const fvPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
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
Istream & operator>>(Istream &, directionInfo &)
Ostream & operator<<(Ostream &, const ensightPart &)