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-2023 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  //- Model coefficients dictionary
68  dictionary coeffDict_;
69 
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("motionSolver");
75 
76 
77  // Declare run-time constructor selection tables
78 
80  (
81  autoPtr,
83  dictionary,
84  (
85  const word& name,
86  const polyMesh& mesh,
87  const dictionary& dict
88  ),
89  (name, mesh, dict)
90  );
91 
92 
93  // Selectors
94 
95  //- Select constructed from polyMesh and dictionary
97  (
98  const word& name,
99  const polyMesh&,
100  const dictionary&
101  );
102 
103 
104  // Constructors
105 
106  //- Construct from polyMesh and dictionary and type.
108  (
109  const word& name,
110  const polyMesh& mesh,
111  const dictionary&,
112  const word& type
113  );
114 
115  //- Clone function
116  virtual autoPtr<motionSolver> clone() const;
117 
118 
119  //- Destructor
120  virtual ~motionSolver();
121 
122 
123  // Member Functions
124 
125  //- Return name
126  const word& name() const
127  {
128  return name_;
129  }
130 
131  //- Return keyword
132  const word& keyword() const
133  {
134  return name();
135  }
136 
137  //- Return reference to mesh
138  const polyMesh& mesh() const
139  {
140  return mesh_;
141  }
142 
143  //- Const access to the coefficients dictionary
144  const dictionary& coeffDict() const
145  {
146  return coeffDict_;
147  }
148 
149  //- Provide new points for motion. Solves for motion
150  virtual tmp<pointField> newPoints();
151 
152  //- Provide current points for motion. Uses current motion field
153  virtual tmp<pointField> curPoints() const = 0;
154 
155  //- Correct point field for reduced-dimensionality cases
156  virtual void twoDCorrectPoints(pointField&) const;
157 
158  //- Is the motion solid body? I.e., are the volumes and area magnitudes
159  // unchanged? Defaults to false. Set to true by
160  // motionSolvers::solidBody.
161  virtual bool solidBody() const
162  {
163  return false;
164  }
165 
166  //- Solve for motion
167  virtual void solve() = 0;
168 
169  //- Update local data for geometry changes
170  virtual void movePoints(const pointField&) = 0;
171 
172  //- Update local data for topology changes
173  virtual void topoChange(const polyTopoChangeMap&) = 0;
174 
175  //- Update corresponding to the given distribution map
176  virtual void distribute(const polyDistributionMap&) = 0;
177 
178  //- Update from another mesh using the given map
179  virtual void mapMesh(const polyMeshMap&) = 0;
180 
181  //- Optionally write motion state information for restart
182  virtual bool write() const;
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
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 keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
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:109
const word & keyword() const
Return keyword.
Definition: motionSolver.H:131
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:115
virtual bool solidBody() const
Is the motion solid body? I.e., are the volumes and area magnitudes.
Definition: motionSolver.H:160
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:122
static autoPtr< motionSolver > New(const word &name, const polyMesh &, const dictionary &)
Select constructed from polyMesh and dictionary.
Definition: motionSolver.C:66
const word & name() const
Return name.
Definition: motionSolver.H:125
TypeName("motionSolver")
Runtime type information.
virtual bool write() const
Optionally write motion state information for restart.
Definition: motionSolver.C:128
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: motionSolver.H:143
virtual autoPtr< motionSolver > clone() const
Clone function.
Definition: motionSolver.C:56
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:137
motionSolver(const word &name, const polyMesh &mesh, const dictionary &, const word &type)
Construct from polyMesh and dictionary and type.
Definition: motionSolver.C:43
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