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-2024 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 "dictionary.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward class declarations
48 class polyMesh;
49 class polyTopoChangeMap;
50 class polyMeshMap;
51 class polyDistributionMap;
52 
53 /*---------------------------------------------------------------------------*\
54  Class motionSolver Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class motionSolver
58 {
59  // Private Data
60 
61  //- Name of coordinate system
62  word name_;
63 
64  //- Reference to mesh
65  const polyMesh& mesh_;
66 
67 
68 public:
69 
70  //- Runtime type information
71  TypeName("motionSolver");
72 
73 
74  // Declare run-time constructor selection tables
75 
77  (
78  autoPtr,
80  dictionary,
81  (
82  const word& name,
83  const polyMesh& mesh,
84  const dictionary& dict
85  ),
86  (name, mesh, dict)
87  );
88 
89 
90  // Selectors
91 
92  //- Select constructed from polyMesh and dictionary
94  (
95  const word& name,
96  const polyMesh&,
97  const dictionary&
98  );
99 
100 
101  // Constructors
102 
103  //- Construct from polyMesh and dictionary and type.
105  (
106  const word& name,
107  const polyMesh& mesh,
108  const word& type
109  );
110 
111  //- Clone function
112  virtual autoPtr<motionSolver> clone() const;
113 
114 
115  //- Destructor
116  virtual ~motionSolver();
117 
118 
119  // Member Functions
120 
121  //- Return name
122  const word& name() const
123  {
124  return name_;
125  }
126 
127  //- Return keyword
128  const word& keyword() const
129  {
130  return name();
131  }
132 
133  //- Return reference to mesh
134  const polyMesh& mesh() const
135  {
136  return mesh_;
137  }
138 
139  //- Provide new points for motion. Solves for motion
140  virtual tmp<pointField> newPoints();
141 
142  //- Provide current points for motion. Uses current motion field
143  virtual tmp<pointField> curPoints() const = 0;
144 
145  //- Correct point field for reduced-dimensionality cases
146  virtual void twoDCorrectPoints(pointField&) const;
147 
148  //- Is the motion solid body? I.e., are the volumes and area magnitudes
149  // unchanged? Defaults to false. Set to true by
150  // motionSolvers::solidBody.
151  virtual bool solidBody() const
152  {
153  return false;
154  }
155 
156  //- Solve for motion
157  virtual void solve() = 0;
158 
159  //- Update local data for geometry changes
160  virtual void movePoints(const pointField&) = 0;
161 
162  //- Update local data for topology changes
163  virtual void topoChange(const polyTopoChangeMap&) = 0;
164 
165  //- Update corresponding to the given distribution map
166  virtual void distribute(const polyDistributionMap&) = 0;
167 
168  //- Update from another mesh using the given map
169  virtual void mapMesh(const polyMeshMap&) = 0;
170 
171  //- Optionally write motion state information for restart
172  virtual bool write() const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Virtual base class for mesh motion solver.
Definition: motionSolver.H:57
virtual void mapMesh(const polyMeshMap &)=0
Update from another mesh using the given map.
declareRunTimeSelectionTable(autoPtr, motionSolver, dictionary,(const word &name, const polyMesh &mesh, const dictionary &dict),(name, mesh, dict))
virtual void distribute(const polyDistributionMap &)=0
Update corresponding to the given distribution map.
virtual ~motionSolver()
Destructor.
Definition: motionSolver.C:115
const word & keyword() const
Return keyword.
Definition: motionSolver.H:127
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:121
motionSolver(const word &name, const polyMesh &mesh, const word &type)
Construct from polyMesh and dictionary and type.
Definition: motionSolver.C:43
virtual bool solidBody() const
Is the motion solid body? I.e., are the volumes and area magnitudes.
Definition: motionSolver.H:150
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
Correct point field for reduced-dimensionality cases.
Definition: motionSolver.C:128
static autoPtr< motionSolver > New(const word &name, const polyMesh &, const dictionary &)
Select constructed from polyMesh and dictionary.
Definition: motionSolver.C:64
const word & name() const
Return name.
Definition: motionSolver.H:121
TypeName("motionSolver")
Runtime type information.
virtual bool write() const
Optionally write motion state information for restart.
Definition: motionSolver.C:134
virtual autoPtr< motionSolver > clone() const
Clone function.
Definition: motionSolver.C:54
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:133
virtual void topoChange(const polyTopoChangeMap &)=0
Update local data for topology changes.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
dictionary dict