dynamicFvMesh.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-2017 OpenFOAM Foundation
9  Copyright (C) 2018-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 Class
28  Foam::dynamicFvMesh
29 
30 Description
31  Abstract base class for geometry and/or topology changing fvMesh.
32 
33  Supports optional update controls that may be used by custom solvers:
34  \table
35  Property | Description | Required | Default
36  updateControl | See time controls below | no | timeStep
37  updateInterval | Steps/time between update phases | no | 1
38  \endtable
39 
40 See also
41  Foam::timeControl
42 
43 SourceFiles
44  dynamicFvMesh.C
45  dynamicFvMeshNew.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef dynamicFvMesh_H
50 #define dynamicFvMesh_H
51 
52 #include "fvMesh.H"
53 #include "timeControl.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class dynamicFvMesh Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class dynamicFvMesh
65 :
66  public fvMesh
67 {
68  // Private Data
69 
70  //- Optional update control
71  timeControl timeControl_;
72 
73 
74  // Private Member Functions
75 
76  //- Read the updateControl/updateInterval from dynamicMeshDict
77  void readDict();
78 
79  //- No copy construct
80  dynamicFvMesh(const dynamicFvMesh&) = delete;
81 
82  //- No copy assignment
83  void operator=(const dynamicFvMesh&) = delete;
84 
85 
86 public:
87 
88  //- Runtime type information
89  TypeName("dynamicFvMesh");
90 
91 
92  // Declare run-time constructor selection table
93 
95  (
96  autoPtr,
98  IOobject,
99  (const IOobject& io),
100  (io)
101  );
102 
104  (
105  autoPtr,
107  doInit,
108  (
109  const IOobject& io,
110  const bool doInit
111  ),
112  (io, doInit)
113  );
114 
115 
116  // Constructors
117 
118  //- Construct from an IOobject
119  explicit dynamicFvMesh(const IOobject& io, const bool doInit=true);
120 
121  //- Construct from components without boundary.
122  // Boundary is added using addFvPatches() member function
123  dynamicFvMesh(const IOobject& io, const zero, const bool syncPar=true);
124 
125  //- Construct from components without boundary.
126  // Boundary is added using addFvPatches() member function
128  (
129  const IOobject& io,
130  pointField&& points,
131  faceList&& faces,
132  labelList&& allOwner,
133  labelList&& allNeighbour,
134  const bool syncPar = true
135  );
136 
137  //- Construct without boundary from cells rather than owner/neighbour.
138  // Boundary is added using addPatches() member function
140  (
141  const IOobject& io,
142  pointField&& points,
143  faceList&& faces,
144  cellList&& cells,
145  const bool syncPar = true
146  );
147 
148 
149  // Selectors
150 
151  //- Select, construct and return the dynamicFvMesh
152  // If the constant/dynamicMeshDict does not exist
153  // a staticFvMesh is returned
154  static autoPtr<dynamicFvMesh> New(const IOobject& io);
155 
156 
157  //- Select, construct and return the dynamicFvMesh
158  // If the constant/dynamicMeshDict does not exist
159  // a staticFvMesh is returned
161  (
162  const argList& args,
163  const Time& runTime
164  );
165 
166 
167  //- Destructor
168  virtual ~dynamicFvMesh() = default;
169 
170 
171  // Member Functions
172 
173  //- Initialise all non-demand-driven data
174  virtual bool init(const bool doInit);
175 
176  //- Is mesh dynamic
177  virtual bool dynamic() const
178  {
179  return true;
180  }
181 
182  //- Update the mesh if controller permits
183  virtual bool controlledUpdate();
184 
185  //- Update the mesh for both mesh motion and topology change
186  virtual bool update() = 0;
187 };
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
Foam::dynamicFvMesh::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, dynamicFvMesh, IOobject,(const IOobject &io),(io))
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1069
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::dynamicFvMesh::New
static autoPtr< dynamicFvMesh > New(const IOobject &io)
Select, construct and return the dynamicFvMesh.
Definition: dynamicFvMeshNew.C:35
Foam::dynamicFvMesh::update
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
Foam::dynamicFvMesh::~dynamicFvMesh
virtual ~dynamicFvMesh()=default
Destructor.
Foam::primitiveMesh::cells
const cellList & cells() const
Definition: primitiveMeshCells.C:138
Foam::dynamicFvMesh::init
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
Definition: dynamicFvMesh.C:90
Foam::dynamicFvMesh
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:78
Foam::argList
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:123
Foam::dynamicFvMesh::dynamic
virtual bool dynamic() const
Is mesh dynamic.
Definition: dynamicFvMesh.H:191
timeControl.H
Foam::Field< vector >
Foam::timeControl
General time dependent execution controller. The execution parameters are given by the "Control" and ...
Definition: timeControl.H:61
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::dynamicFvMesh::controlledUpdate
virtual bool controlledUpdate()
Update the mesh if controller permits.
Definition: dynamicFvMesh.C:166
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1094
Foam::List< face >
Foam::dynamicFvMesh::TypeName
TypeName("dynamicFvMesh")
Runtime type information.
args
Foam::argList args(argc, argv)
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62