motionSolver.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 "pointField.H"
39 #include "Time.H"
40 #include "polyMesh.H"
41 #include "dictionaryEntry.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward class declarations
49 class polyMesh;
50 class mapPolyMesh;
51 
52 /*---------------------------------------------------------------------------*\
53  Class motionSolver Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class motionSolver
57 {
58  // Private Data
59 
60  //- Reference to mesh
61  const polyMesh& mesh_;
62 
63  //- Model coefficients dictionary
64  dictionary coeffDict_;
65 
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("motionSolver");
71 
72 
73  // Declare run-time constructor selection tables
74 
76  (
77  autoPtr,
79  dictionary,
80  (const polyMesh& mesh, const dictionary& dict),
81  (mesh, dict)
82  );
83 
84 
85  // Selectors
86 
87  //- Select constructed from polyMesh and dictionary
88  static autoPtr<motionSolver> New(const polyMesh&, const dictionary&);
89 
90  //- Class used for the construction of PtrLists of motionSolvers
91  class iNew
92  {
93  const polyMesh& mesh_;
94 
95  public:
96 
97  iNew(const polyMesh& mesh);
98 
100  };
101 
102 
103  // Constructors
104 
105  //- Construct from polyMesh and dictionary and type.
107  (
108  const polyMesh& mesh,
109  const dictionary&,
110  const word& type
111  );
112 
113  //- Clone function
114  virtual autoPtr<motionSolver> clone() const;
115 
116 
117  //- Destructor
118  virtual ~motionSolver();
119 
120 
121  // Member Functions
122 
123  //- Return reference to mesh
124  const polyMesh& mesh() const
125  {
126  return mesh_;
127  }
128 
129  //- Const access to the coefficients dictionary
130  const dictionary& coeffDict() const
131  {
132  return coeffDict_;
133  }
134 
135  //- Provide new points for motion. Solves for motion
136  virtual tmp<pointField> newPoints();
137 
138  //- Provide current points for motion. Uses current motion field
139  virtual tmp<pointField> curPoints() const = 0;
140 
141  virtual void twoDCorrectPoints(pointField&) const;
142 
143  //- Solve for motion
144  virtual void solve() = 0;
145 
146  //- Update local data for geometry changes
147  virtual void movePoints(const pointField&) = 0;
148 
149  //- Update local data for topology changes
150  virtual void updateMesh(const mapPolyMesh&) = 0;
151 
152  //- Optionally write motion state information for restart
153  virtual bool write() const;
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
Class used for the construction of PtrLists of motionSolvers.
Definition: motionSolver.H:90
dictionary dict
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
Definition: motionSolver.C:134
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
autoPtr< motionSolver > operator()(Istream &is) const
Definition: motionSolver.C:116
virtual bool write() const
Optionally write motion state information for restart.
Definition: motionSolver.C:151
static autoPtr< motionSolver > New(const polyMesh &, const dictionary &)
Select constructed from polyMesh and dictionary.
Definition: motionSolver.C:62
Virtual base class for mesh motion solver.
Definition: motionSolver.H:55
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: motionSolver.H:129
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
virtual void updateMesh(const mapPolyMesh &)=0
Update local data for topology changes.
Definition: motionSolver.C:147
iNew(const polyMesh &mesh)
Definition: motionSolver.C:109
virtual void movePoints(const pointField &)=0
Update local data for geometry changes.
A class for handling words, derived from string.
Definition: word.H:59
virtual ~motionSolver()
Destructor.
Definition: motionSolver.C:128
virtual void solve()=0
Solve for motion.
declareRunTimeSelectionTable(autoPtr, motionSolver, dictionary,(const polyMesh &mesh, const dictionary &dict),(mesh, dict))
virtual tmp< pointField > curPoints() const =0
Provide current points for motion. Uses current motion field.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:123
A class for managing temporary objects.
Definition: PtrList.H:53
TypeName("motionSolver")
Runtime type information.
virtual autoPtr< motionSolver > clone() const
Clone function.
Definition: motionSolver.C:52
motionSolver(const polyMesh &mesh, const dictionary &, const word &type)
Construct from polyMesh and dictionary and type.
Definition: motionSolver.C:41
virtual void twoDCorrectPoints(pointField &) const
Definition: motionSolver.C:141
Namespace for OpenFOAM.