rigidBodyMeshMotion.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2016 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::rigidBodyMeshMotion
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  rigidBodyMeshMotion.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef rigidBodyMeshMotion_H
39 #define rigidBodyMeshMotion_H
40 
42 #include "rigidBodyMotion.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class rigidBodyMeshMotion Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
56 {
57  //- Class containing the patches and point motion weighting for each body
58  class bodyMesh
59  {
60  //- Name of the body
61  const word name_;
62 
63  //- ID of the body in the RBD::rigidBodyMotion
64  const label bodyID_;
65 
66  //- List of mesh patches associated with this body
67  const wordReList patches_;
68 
69  //- Patches to integrate forces
70  const labelHashSet patchSet_;
71 
72  //- Inner morphing distance (limit of solid-body region)
73  const scalar di_;
74 
75  //- Outer morphing distance (limit of linear interpolation region)
76  const scalar do_;
77 
78  //- Current interpolation weight
79  // (1 at patches and within di_, 0 at do_ and beyond)
80  pointScalarField weight_;
81 
82 
83  public:
84 
85  friend class rigidBodyMeshMotion;
86 
87  bodyMesh
88  (
89  const polyMesh& mesh,
90  const word& name,
91  const label bodyID,
92  const dictionary& dict
93  );
94  };
95 
96 
97  // Private data
98 
99  //- Rigid-body model
100  RBD::rigidBodyMotion model_;
101 
102  //- List of the bodyMeshes containing the patches and point motion
103  // weighting for each body
104  PtrList<bodyMesh> bodyMeshes_;
105 
106  //- Switch for test-mode in which only the
107  // gravitational body-force is applied
108  Switch test_;
109 
110  //- Reference density required by the forces object for
111  // incompressible calculations, required if rho == rhoInf
112  scalar rhoInf_;
113 
114  //- Name of density field, optional unless used for an
115  // incompressible simulation, when this needs to be specified
116  // as rhoInf
117  word rhoName_;
118 
119  //- Current time index (used for updating)
120  label curTimeIndex_;
121 
122 
123  // Private Member Functions
124 
125  //- Disallow default bitwise copy construct
127  (
128  const rigidBodyMeshMotion&
129  );
130 
131  //- Disallow default bitwise assignment
132  void operator=(const rigidBodyMeshMotion&);
133 
134 
135 public:
136 
137  //- Runtime type information
138  TypeName("rigidBodyMotion");
139 
140 
141  // Constructors
142 
143  //- Construct from polyMesh and IOdictionary
145  (
146  const polyMesh&,
147  const IOdictionary& dict
148  );
149 
150 
151  //- Destructor
153 
154 
155  // Member Functions
156 
157  //- Return point location obtained from the current motion field
158  virtual tmp<pointField> curPoints() const;
159 
160  //- Solve for motion
161  virtual void solve();
162 
163  //- Write state using given format, version and compression
164  virtual bool writeObject
165  (
169  ) const;
170 
171  //- Read dynamicMeshDict dictionary
172  virtual bool read();
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
dictionary dict
Virtual base class for displacement motion solver.
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:137
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.
Definition: Switch.H:60
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write state using given format, version and compression.
Rigid-body mesh motion solver for fvMesh.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
virtual bool read()
Read dynamicMeshDict dictionary.
Six degree of freedom motion for a rigid body.
virtual void solve()
Solve for motion.
A class for handling words, derived from string.
Definition: word.H:59
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:123
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86
const word & name() const
Name function is needed to disambiguate those inherited.
Definition: IOdictionary.C:181
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
Version number type.
Definition: IOstream.H:96
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:54
TypeName("rigidBodyMotion")
Runtime type information.
Namespace for OpenFOAM.