rigidBodyMotion.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-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::RBD::rigidBodyMotion
26 
27 Description
28  Six degree of freedom motion for a rigid body.
29 
30  Angular momentum stored in body fixed reference frame. Reference
31  orientation of the body (where Q = I) must align with the cartesian axes
32  such that the Inertia tensor is in principle component form. Can add
33  restraints (e.g. a spring) and constraints (e.g. motion may only be on a
34  plane).
35 
36  The time-integrator for the motion is run-time selectable with options for
37  symplectic (explicit), Crank-Nicolson and Newmark schemes.
38 
39 SourceFiles
40  rigidBodyMotionI.H
41  rigidBodyMotion.C
42  rigidBodyMotionIO.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef rigidBodyMotion_H
47 #define rigidBodyMotion_H
48 
49 #include "rigidBodyModel.H"
50 #include "rigidBodyModelState.H"
51 #include "pointField.H"
52 #include "Switch.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 namespace RBD
59 {
60 
61 // Forward declarations
62 class rigidBodySolver;
63 
64 /*---------------------------------------------------------------------------*\
65  Class rigidBodyMotion Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class rigidBodyMotion
69 :
70  public rigidBodyModel
71 {
72  friend class rigidBodySolver;
73 
74  // Private Data
75 
76  //- Motion state data object
77  rigidBodyModelState motionState_;
78 
79  //- Motion state data object for previous time-step
80  rigidBodyModelState motionState0_;
81 
82  //- Initial transform for external forces to the bodies reference frame
84 
85  //- Acceleration relaxation coefficient
86  scalar aRelax_;
87 
88  //- Acceleration damping coefficient (for steady-state simulations)
89  scalar aDamp_;
90 
91  //- Switch to turn reporting of motion data on and off
92  Switch report_;
93 
94  //- Motion solver
96 
97 
98  // Private Member Functions
99 
100  //- Initialise the body-state
101  void initialise();
102 
103 
104 public:
105 
106  // Constructors
107 
108  //- Construct null
109  rigidBodyMotion();
110 
111  //- Construct from dictionary
113  (
114  const dictionary& dict
115  );
116 
117  //- Construct from constant and state dictionaries
119  (
120  const dictionary& dict,
121  const dictionary& stateDict
122  );
123 
124  //- Disallow default bitwise copy construction
125  rigidBodyMotion(const rigidBodyMotion&) = delete;
126 
127 
128  //- Destructor
130 
131 
132  // Member Functions
133 
134  // Access
135 
136  //- Return the report Switch
137  inline bool report() const;
138 
139  //- Return the motion state
140  inline const rigidBodyModelState& state() const;
141 
142  //- Return the motion state for modification
143  inline rigidBodyModelState& state();
144 
145  //- Return the initial transform to the global frame for the
146  // given body
147  spatialTransform X00(const label bodyId) const;
148 
149 
150  // Edit
151 
152  //- Store the motion state at the beginning of the time-step
153  inline void newTime();
154 
155 
156  // Update state
157 
158  //- Calculate and optionally relax the joint acceleration qDdot from
159  // the joint state q, velocity qDot, internal force tau (in the
160  // joint frame) and external force fx (in the global frame)
161  void forwardDynamics
162  (
164  const scalarField& tau,
165  const Field<spatialVector>& fx
166  ) const;
167 
168  //- Integrate velocities, orientation and position
169  // for the given time and time-step
170  void solve
171  (
172  const scalar t,
173  const scalar deltaT,
174  const scalarField& tau,
175  const Field<spatialVector>& fx
176  );
177 
178  //- Report the status of the motion of the given body
179  void status(const label bodyID) const;
180 
181 
182  // Transformations
183 
184  //- Return the transformation of bodyID relative to the initial time
186 
187 
188  //- Write
189  virtual void write(Ostream&) const;
190 
191  //- Read coefficients dictionary and update system parameters,
192  // constraints and restraints but not the current state
193  bool read(const dictionary& dict);
194 
195 
196  // Member Operators
197 
198  //- Disallow default bitwise assignment
199  void operator=(const rigidBodyMotion&) = delete;
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace RBD
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #include "rigidBodyMotionI.H"
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Holds the motion state of rigid-body model.
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
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.
void newTime()
Store the motion state at the beginning of the time-step.
spatialTransform X00(const label bodyId) const
Return the initial transform to the global frame for the.
bool report() const
Return the report Switch.
virtual void write(Ostream &) const
Write.
const rigidBodyModelState & state() const
Return the motion state.
bool read(const dictionary &dict)
Read coefficients dictionary and update system parameters,.
void operator=(const rigidBodyMotion &)=delete
Disallow default bitwise assignment.
void status(const label bodyID) const
Report the status of the motion of the given body.
rigidBodyMotion()
Construct null.
spatialTransform transform0(const label bodyID) const
Return the transformation of bodyID relative to the initial time.
void forwardDynamics(rigidBodyModelState &state, const scalarField &tau, const Field< spatialVector > &fx) const
Calculate and optionally relax the joint acceleration qDdot from.
void solve(const scalar t, const scalar deltaT, const scalarField &tau, const Field< spatialVector > &fx)
Integrate velocities, orientation and position.
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
Compact representation of the Plücker spatial transformation tensor in terms of the rotation tensor E...
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