motionSolver.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) 2016-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::motionSolver
29
30Description
31 Virtual base class for mesh motion solver.
32
33SourceFiles
34 motionSolver.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef motionSolver_H
39#define motionSolver_H
40
41#include "IOdictionary.H"
42#include "pointField.H"
43
44#include "Time.H"
45#include "polyMesh.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// Forward Declarations
53class mapPolyMesh;
54
55/*---------------------------------------------------------------------------*\
56 Class motionSolver Declaration
57\*---------------------------------------------------------------------------*/
59class motionSolver
60:
61 public IOdictionary
62{
63 // Private Data
64
65 //- Reference to mesh
66 const polyMesh& mesh_;
67
68 //- Model coefficients dictionary
69 dictionary coeffDict_;
70
71
72protected:
73
74 // Protected Member Functions
75
76 //- De-register object if registered and assign to current
78
79
80public:
81
82 //- Runtime type information
83 TypeName("motionSolver");
84
85
86 // Declare run-time constructor selection tables
89 (
90 autoPtr,
93 (const polyMesh& mesh, const IOdictionary& dict),
94 (mesh, dict)
95 );
96
97
98 // Selectors
99
100 //- Select constructed from polyMesh
101 static autoPtr<motionSolver> New(const polyMesh&);
102
103 //- Select constructed from polyMesh and dictionary. If dictionary
104 // was registered this will 'steal' that registration.
105 static autoPtr<motionSolver> New(const polyMesh&, const IOdictionary&);
106
107 //- Class used for the construction of PtrLists of motionSolvers
108 class iNew
109 {
110 const polyMesh& mesh_;
111
112 public:
113
114 iNew(const polyMesh& mesh);
115
117 };
118
119
120
121 // Constructors
122
123 //- Construct from polyMesh
124 motionSolver(const polyMesh& mesh);
125
126 //- Construct from polyMesh and dictionary and type.
128 (
129 const polyMesh& mesh,
130 const IOdictionary&,
131 const word& type
132 );
133
134 //- Clone function
135 virtual autoPtr<motionSolver> clone() const;
136
137
138 //- Destructor
139 virtual ~motionSolver() = default;
140
141
142 // Member Functions
143
144 //- Return reference to mesh
145 const polyMesh& mesh() const
146 {
147 return mesh_;
148 }
149
150 //- Const access to the coefficients dictionary
151 const dictionary& coeffDict() const
152 {
153 return coeffDict_;
154 }
155
156 //- Provide new points for motion. Solves for motion
157 virtual tmp<pointField> newPoints();
158
159 //- Provide current points for motion. Uses current motion field
160 virtual tmp<pointField> curPoints() const = 0;
161
162 virtual void twoDCorrectPoints(pointField&) const;
163
164 //- Solve for motion
165 virtual void solve() = 0;
166
167 //- Update local data for geometry changes
168 virtual void movePoints(const pointField&) = 0;
169
170 //- Update local data for topology changes
171 virtual void updateMesh(const mapPolyMesh&) = 0;
172
173 //- Write state using stream options
174 virtual bool writeObject
175 (
176 IOstreamOption streamOpt,
177 const bool valid
178 ) const;
179
180 //- Read dynamicMeshDict dictionary
181 virtual bool read();
182};
183
184
185// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187} // End namespace Foam
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191#endif
192
193// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
The IOstreamOption is a simple container for options an IOstream can normally have.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Class used for the construction of PtrLists of motionSolvers.
Definition: motionSolver.H:108
autoPtr< motionSolver > operator()(Istream &is) const
Definition: motionSolver.C:175
Virtual base class for mesh motion solver.
Definition: motionSolver.H:61
virtual ~motionSolver()=default
Destructor.
virtual void updateMesh(const mapPolyMesh &)=0
Update local data for topology changes.
Definition: motionSolver.C:213
static IOobject stealRegistration(const IOdictionary &dict)
De-register object if registered and assign to current.
Definition: motionSolver.C:47
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:144
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
Definition: motionSolver.C:150
virtual void movePoints(const pointField &)=0
Update local data for geometry changes.
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
Definition: motionSolver.C:200
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write state using stream options.
Definition: motionSolver.C:218
virtual tmp< pointField > curPoints() const =0
Provide current points for motion. Uses current motion field.
virtual void solve()=0
Solve for motion.
virtual void twoDCorrectPoints(pointField &) const
Definition: motionSolver.C:207
declareRunTimeSelectionTable(autoPtr, motionSolver, dictionary,(const polyMesh &mesh, const IOdictionary &dict),(mesh, dict))
TypeName("motionSolver")
Runtime type information.
virtual autoPtr< motionSolver > clone() const
Clone function.
Definition: motionSolver.C:95
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: motionSolver.H:150
virtual bool read()
Read dynamicMeshDict dictionary.
Definition: motionSolver.C:227
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73