rigidBodyMeshMotionSolver.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) 2016-2019 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::rigidBodyMeshMotionSolver
26 
27 Description
28  Rigid-body mesh motion solver for fvMesh.
29 
30  Applies septernion interpolation of movement as function of distance to the
31  object surface.
32 
33 SourceFiles
34  rigidBodyMeshMotionSolver.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef rigidBodyMeshMotionSolver_H
39 #define rigidBodyMeshMotionSolver_H
40 
42 #include "rigidBodyMotion.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class rigidBodyMeshMotionSolver Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public motionSolver,
57 {
58  //- Class containing the patches and point motion weighting for each body
59  class bodyMesh
60  {
61  //- Name of the body
62  const word name_;
63 
64  //- ID of the body in the RBD::rigidBodyMotion
65  const label bodyID_;
66 
67  //- List of mesh patches associated with this body
68  const wordReList patches_;
69 
70  //- Patches to integrate forces
71  const labelHashSet patchSet_;
72 
73 
74  public:
75 
76  friend class rigidBodyMeshMotionSolver;
77 
78  bodyMesh
79  (
80  const polyMesh& mesh,
81  const word& name,
82  const label bodyID,
83  const dictionary& dict
84  );
85  };
86 
87 
88  // Private Data
89 
90  //- List of the bodyMeshes containing the patches and point motion
91  // weighting for each body
92  PtrList<bodyMesh> bodyMeshes_;
93 
94  //- Switch for test-mode in which only the
95  // gravitational body-force is applied
96  Switch test_;
97 
98  //- Reference density required by the forces object for
99  // incompressible calculations, required if rho == rhoInf
100  scalar rhoInf_;
101 
102  //- Name of density field, optional unless used for an
103  // incompressible simulation, when this needs to be specified
104  // as rhoInf
105  word rhoName_;
106 
107  //- Current time index (used for updating)
108  label curTimeIndex_;
109 
110  autoPtr<motionSolver> meshSolverPtr_;
111 
112  displacementMotionSolver& meshSolver_;
113 
114  //- To avoid warning from clang
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("rigidBodyMotionSolver");
122 
123 
124  // Constructors
125 
126  //- Construct from polyMesh and dictionary
128  (
129  const polyMesh&,
130  const dictionary& dict
131  );
132 
133  //- Disallow default bitwise copy construction
135  (
137  );
138 
139 
140  //- Destructor
142 
143 
144  // Member Functions
145 
146  //- Return point location obtained from the current motion field
147  virtual tmp<pointField> curPoints() const;
148 
149  //- Solve for motion
150  virtual void solve();
151 
152  //- Update local data for geometry changes
153  virtual void movePoints(const pointField&);
154 
155  //- Update local data for topology changes
156  virtual void updateMesh(const mapPolyMesh&);
157 
158  //- Write motion state information for restart
159  virtual bool write() const;
160 
161 
162  // Member Operators
163 
164  //- Disallow default bitwise assignment
165  void operator=(const rigidBodyMeshMotionSolver&) = delete;
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
dictionary dict
Virtual base class for displacement motion solver.
virtual bool write() const
Write motion state information for restart.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
rigidBodyMeshMotionSolver(const polyMesh &, const dictionary &dict)
Construct from polyMesh and dictionary.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
Virtual base class for mesh motion solver.
Definition: motionSolver.H:55
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
virtual void write(Ostream &) const
Write.
Six degree of freedom motion for a rigid body.
A class for handling words, derived from string.
Definition: word.H:59
TypeName("rigidBodyMotionSolver")
Runtime type information.
const word & name(const label bodyID) const
Return the name of body with the given ID.
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Rigid-body mesh motion solver for fvMesh.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
label bodyID(const word &name) const
Return the ID of the body with the given name.
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
virtual void solve()
Solve for motion.
void operator=(const rigidBodyMeshMotionSolver &)=delete
Disallow default bitwise assignment.
Namespace for OpenFOAM.