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 | Copyright (C) 2011-2014 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::motionSolver
26 
27 Description
28  Virtual base class for mesh motion solver.
29 
30 SourceFiles
31  motionSolver.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef motionSolver_H
36 #define motionSolver_H
37 
38 #include "IOdictionary.H"
39 #include "pointField.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward class declarations
47 class polyMesh;
48 class mapPolyMesh;
49 
50 /*---------------------------------------------------------------------------*\
51  Class motionSolver Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class motionSolver
55 :
56  public IOdictionary
57 {
58 
59 private:
60 
61  // Private data
62 
63  //- Reference to mesh
64  const polyMesh& mesh_;
65 
66  //- Model coefficients dictionary
68 
69 
70 protected:
71 
72  // Protected Member Functions
73 
74  //- De-register object if registered and assign to current
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("motionSolver");
81 
82 
83  // Declare run-time constructor selection tables
84 
86  (
87  autoPtr,
89  dictionary,
90  (const polyMesh& mesh, const IOdictionary& dict),
91  (mesh, dict)
92  );
93 
94 
95  // Selectors
96 
97  //- Select constructed from polyMesh
98  static autoPtr<motionSolver> New(const polyMesh&);
99 
100  //- Select constructed from polyMesh and dictionary. If dictionary
101  // was registered this will 'steal' that registration.
102  static autoPtr<motionSolver> New(const polyMesh&, const IOdictionary&);
103 
104 
105  // Constructors
106 
107  //- Construct from polyMesh
108  motionSolver(const polyMesh& mesh);
109 
110  //- Construct from polyMesh and dictionary and type.
112  (
113  const polyMesh& mesh,
114  const IOdictionary&,
115  const word& type
116  );
117 
118 
119  //- Destructor
120  virtual ~motionSolver();
121 
122 
123  // Member Functions
124 
125  //- Return reference to mesh
126  const polyMesh& mesh() const
127  {
128  return mesh_;
129  }
130 
131  //- Const access to the coefficients dictionary
132  const dictionary& coeffDict() const
133  {
134  return coeffDict_;
135  }
136 
137  //- Provide new points for motion. Solves for motion
138  virtual tmp<pointField> newPoints();
139 
140  //- Provide current points for motion. Uses current motion field
141  virtual tmp<pointField> curPoints() const = 0;
142 
143  virtual void twoDCorrectPoints(pointField&) const;
144 
145  //- Solve for motion
146  virtual void solve() = 0;
147 
148  //- Update local data for geometry changes
149  virtual void movePoints(const pointField&) = 0;
150 
151  //- Update local data for topology changes
152  virtual void updateMesh(const mapPolyMesh&) = 0;
153 
154  //- Write state using given format, version and compression
155  virtual bool writeObject
156  (
160  ) const;
161 
162  //- Read dynamicMeshDict dictionary
163  virtual bool read();
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Foam::motionSolver::New
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
Definition: motionSolver.C:135
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::motionSolver::movePoints
virtual void movePoints(const pointField &)=0
Update local data for geometry changes.
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::motionSolver::mesh_
const polyMesh & mesh_
Reference to mesh.
Definition: motionSolver.H:63
Foam::IOstream::compressionType
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
Foam::motionSolver::twoDCorrectPoints
virtual void twoDCorrectPoints(pointField &) const
Definition: motionSolver.C:168
Foam::motionSolver::motionSolver
motionSolver(const polyMesh &mesh)
Construct from polyMesh.
Definition: motionSolver.C:62
Foam::motionSolver::TypeName
TypeName("motionSolver")
Runtime type information.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::motionSolver::solve
virtual void solve()=0
Solve for motion.
Foam::IOstream::versionNumber
Version number type.
Definition: IOstream.H:96
Foam::motionSolver::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, motionSolver, dictionary,(const polyMesh &mesh, const IOdictionary &dict),(mesh, dict))
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::motionSolver::coeffDict_
dictionary coeffDict_
Model coefficients dictionary.
Definition: motionSolver.H:66
Foam::motionSolver::curPoints
virtual tmp< pointField > curPoints() const =0
Provide current points for motion. Uses current motion field.
Foam::motionSolver::read
virtual bool read()
Read dynamicMeshDict dictionary.
Definition: motionSolver.C:189
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::motionSolver::coeffDict
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: motionSolver.H:131
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
pointField.H
IOdictionary.H
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::motionSolver
Virtual base class for mesh motion solver.
Definition: motionSolver.H:53
Foam::motionSolver::newPoints
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
Definition: motionSolver.C:161
Foam::motionSolver::stealRegistration
static IOobject stealRegistration(const IOdictionary &dict)
De-register object if registered and assign to current.
Definition: motionSolver.C:43
Foam::motionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)=0
Update local data for topology changes.
Definition: motionSolver.C:174
Foam::motionSolver::mesh
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:125
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::motionSolver::~motionSolver
virtual ~motionSolver()
Destructor.
Definition: motionSolver.C:155
Foam::motionSolver::writeObject
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write state using given format, version and compression.
Definition: motionSolver.C:179
Foam::IOstream::streamFormat
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86