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 -------------------------------------------------------------------------------
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::motionSolver
29 
30 Description
31  Virtual base class for mesh motion solver.
32 
33 SourceFiles
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 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class mapPolyMesh;
54 
55 /*---------------------------------------------------------------------------*\
56  Class motionSolver Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class 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 
72 protected:
73 
74  // Protected Member Functions
75 
76  //- De-register object if registered and assign to current
78 
79 
80 public:
81 
82  //- Runtime type information
83  TypeName("motionSolver");
84 
85 
86  // Declare run-time constructor selection tables
87 
89  (
90  autoPtr,
92  dictionary,
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 // ************************************************************************* //
Foam::motionSolver::New
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
Definition: motionSolver.C:150
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::motionSolver::movePoints
virtual void movePoints(const pointField &)=0
Update local data for geometry changes.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::motionSolver::twoDCorrectPoints
virtual void twoDCorrectPoints(pointField &) const
Definition: motionSolver.C:207
Foam::motionSolver::motionSolver
motionSolver(const polyMesh &mesh)
Construct from polyMesh.
Definition: motionSolver.C:65
Foam::motionSolver::~motionSolver
virtual ~motionSolver()=default
Destructor.
Foam::motionSolver::TypeName
TypeName("motionSolver")
Runtime type information.
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::motionSolver::iNew::operator()
autoPtr< motionSolver > operator()(Istream &is) const
Definition: motionSolver.C:175
Foam::motionSolver::solve
virtual void solve()=0
Solve for motion.
Foam::motionSolver::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, motionSolver, dictionary,(const polyMesh &mesh, const IOdictionary &dict),(mesh, dict))
Foam::motionSolver::iNew::iNew
iNew(const polyMesh &mesh)
Definition: motionSolver.C:168
Foam::Field< vector >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::motionSolver::curPoints
virtual tmp< pointField > curPoints() const =0
Provide current points for motion. Uses current motion field.
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::motionSolver::read
virtual bool read()
Read dynamicMeshDict dictionary.
Definition: motionSolver.C:227
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::motionSolver::coeffDict
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: motionSolver.H:150
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
pointField.H
IOdictionary.H
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::motionSolver
Virtual base class for mesh motion solver.
Definition: motionSolver.H:58
Foam::motionSolver::clone
virtual autoPtr< motionSolver > clone() const
Clone function.
Definition: motionSolver.C:95
Foam::motionSolver::newPoints
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
Definition: motionSolver.C:200
Foam::motionSolver::iNew
Class used for the construction of PtrLists of motionSolvers.
Definition: motionSolver.H:107
Foam::motionSolver::stealRegistration
static IOobject stealRegistration(const IOdictionary &dict)
De-register object if registered and assign to current.
Definition: motionSolver.C:47
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::motionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)=0
Update local data for topology changes.
Definition: motionSolver.C:213
Foam::motionSolver::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write state using stream options.
Definition: motionSolver.C:218
Foam::motionSolver::mesh
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:144
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161