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-2022 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 #include "Function1.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class rigidBodyMeshMotionSolver Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public motionSolver,
58 {
59  //- Class containing the patches and point motion weighting for each body
60  class bodyMesh
61  {
62  //- Name of the body
63  const word name_;
64 
65  //- ID of the body in the RBD::rigidBodyMotion
66  const label bodyID_;
67 
68  //- List of mesh patches associated with this body
69  const wordReList patches_;
70 
71  //- Patches to integrate forces
72  const labelHashSet patchSet_;
73 
74 
75  public:
76 
77  friend class rigidBodyMeshMotionSolver;
78 
79  bodyMesh
80  (
81  const polyMesh& mesh,
82  const word& name,
83  const label bodyID,
84  const dictionary& dict
85  );
86  };
87 
88 
89  // Private Data
90 
91  //- List of the bodyMeshes containing the patches and point motion
92  // weighting for each body
93  PtrList<bodyMesh> bodyMeshes_;
94 
95  //- Switch for test-mode in which only the
96  // gravitational body-force is applied
97  Switch test_;
98 
99  //- Reference density required by the forces object for
100  // incompressible calculations, required if rho == rhoInf
101  scalar rhoInf_;
102 
103  //- Name of density field, optional unless used for an
104  // incompressible simulation, when this needs to be specified
105  // as rhoInf
106  word rhoName_;
107 
108  //- Ramp the forces according to the specified function and period
110 
111  //- Current time index (used for updating)
112  label curTimeIndex_;
113 
114  autoPtr<motionSolver> meshSolverPtr_;
115 
116  displacementMotionSolver& meshSolver_;
117 
118  //- To avoid warning from clang
120 
121 
122 public:
123 
124  //- Runtime type information
125  TypeName("rigidBodyMotionSolver");
126 
127 
128  // Constructors
129 
130  //- Construct from polyMesh and dictionary
132  (
133  const word& name,
134  const polyMesh&,
135  const dictionary& dict
136  );
137 
138  //- Disallow default bitwise copy construction
140  (
142  ) = delete;
143 
144 
145  //- Destructor
147 
148 
149  // Member Functions
150 
151  //- Return point location obtained from the current motion field
152  virtual tmp<pointField> curPoints() const;
153 
154  //- Solve for motion
155  virtual void solve();
156 
157  //- Update local data for geometry changes
158  virtual void movePoints(const pointField&);
159 
160  //- Update local data for topology changes
161  virtual void topoChange(const polyTopoChangeMap&);
162 
163  //- Update from another mesh using the given map
164  virtual void mapMesh(const polyMeshMap&);
165 
166  //- Update corresponding to the given distribution map
167  virtual void distribute(const polyDistributionMap&);
168 
169  //- Write motion state information for restart
170  virtual bool write() const;
171 
172 
173  // Member Operators
174 
175  //- Disallow default bitwise assignment
176  void operator=(const rigidBodyMeshMotionSolver&) = delete;
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
label bodyID(const word &name) const
Return the ID of the body with the given name.
Six degree of freedom motion for a rigid body.
virtual void write(Ostream &) const
Write.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
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 displacement motion solver.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:57
const word & name() const
Return name.
Definition: motionSolver.H:125
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:137
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.
Rigid-body mesh motion solver for fvMesh.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
TypeName("rigidBodyMotionSolver")
Runtime type information.
void operator=(const rigidBodyMeshMotionSolver &)=delete
Disallow default bitwise assignment.
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
rigidBodyMeshMotionSolver(const word &name, const polyMesh &, const dictionary &dict)
Construct from polyMesh and dictionary.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
virtual bool write() const
Write motion state information for restart.
virtual void solve()
Solve for motion.
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.
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
dictionary dict