solidBodyFvGeometryScheme.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) 2021-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 Class
27  Foam::solidBodyFvGeometryScheme
28 
29 Description
30  Geometry calculation scheme that performs geometry updates only in regions
31  where the mesh has changed.
32 
33  Example usage in fvSchemes:
34 
35  \verbatim
36  geometry
37  {
38  type solidBody;
39 
40  // Optional entries
41 
42  // If set to false, update the entire mesh
43  partialUpdate yes;
44 
45  // Cache the motion addressing (changed points, faces, cells etc)
46  cacheMotion yes;
47  }
48  \endverbatim
49 
50 
51 SourceFiles
52  solidBodyFvGeometryScheme.C
53 
54 \*---------------------------------------------------------------------------*/
55 
56 #ifndef solidBodyFvGeometryScheme_H
57 #define solidBodyFvGeometryScheme_H
58 
59 #include "basicFvGeometryScheme.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class solidBodyFvGeometryScheme Declaration
68 \*---------------------------------------------------------------------------*/
69 
71 :
73 {
74  // Private Data
75 
76  //- Partial update flag
77  bool partialUpdate_;
78 
79  //- Cache mesh motion flag
80  bool cacheMotion_;
81 
82  //- Flag to indicate that the cache has been initialised
83  bool cacheInitialised_;
84 
85  //- Changed face IDs
86  labelList changedFaceIDs_;
87 
88  //- Changed patch IDs
89  labelList changedPatchIDs_;
90 
91  //- Changed cell IDs
92  labelList changedCellIDs_;
93 
94 
95  // Private Member Functions
96 
97  //- Detect what geometry has changed. Return true if anything has.
98  bool markChanges
99  (
100  const pointField& oldPoints,
101  const pointField& currPoints,
102  bitSet& isChangedPoint,
103  bitSet& isChangedFace,
104  bitSet& isChangedCell
105  ) const;
106 
107  //- Set the mesh motion data (point, face IDs)
108  void setMeshMotionData();
109 
110  //- No copy construct
112 
113  //- No copy assignment
114  void operator=(const solidBodyFvGeometryScheme&) = delete;
115 
116 
117 public:
118 
119  //- Runtime type information
120  TypeName("solidBody");
121 
122 
123  // Constructors
124 
125  //- Construct from mesh
127 
128 
129  //- Destructor
130  virtual ~solidBodyFvGeometryScheme() = default;
131 
132 
133  // Member Functions
134 
135  //- Do what is necessary if the mesh has moved
136  virtual void movePoints();
137 
138  //- Update mesh for topology changes
139  virtual void updateMesh(const mapPolyMesh& mpm);
140 
141  //- Calculate geometry quantities using mesh topology and provided
142  //- points. If oldPoints provided only does local update. Returns
143  //- true if anything changed, false otherwise
144  virtual bool updateGeom
145  (
146  const pointField& points,
147  const refPtr<pointField>& oldPoints, // optional old points
148  pointField& faceCentres,
149  vectorField& faceAreas,
150  pointField& cellCentres,
151  scalarField& cellVolumes
152  ) const;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
dictionary dict
virtual void movePoints()
Do what is necessary if the mesh has moved.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A class for managing references or pointers (no reference counting)
Definition: HashPtrTable.H:49
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Default geometry calculation scheme. Slight stabilisation for bad meshes.
const pointField & points
Geometry calculation scheme that performs geometry updates only in regions where the mesh has changed...
virtual ~solidBodyFvGeometryScheme()=default
Destructor.
const fvMesh & mesh() const
Return mesh reference.
virtual bool updateGeom(const pointField &points, const refPtr< pointField > &oldPoints, pointField &faceCentres, vectorField &faceAreas, pointField &cellCentres, scalarField &cellVolumes) const
Calculate geometry quantities using mesh topology and provided points. If oldPoints provided only doe...
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:59
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh for topology changes.
TypeName("solidBody")
Runtime type information.
Namespace for OpenFOAM.