rigidBodySolver.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-2018 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::rigidBodySolver
26 
27 Description
28 
29 SourceFiles
30  rigidBodySolver.C
31  newSixDoFSolver.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef RBD_rigidBodySolver_H
36 #define RBD_rigidBodySolver_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 #include "rigidBodyMotion.H"
41 #include "runTimeSelectionTables.H"
42 
43 namespace Foam
44 {
45 namespace RBD
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class rigidBodySolver Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class rigidBodySolver
53 {
54 protected:
55 
56  // Protected data
57 
58  //- The rigid-body model
60 
61 
62  //- Return the motion state
63  inline rigidBodyModelState& state();
64 
65  //- Return the current joint position and orientation
66  inline scalarField& q();
67 
68  //- Return the current joint quaternion
69 
70  //- Return the current joint velocity
71  inline scalarField& qDot();
72 
73  //- Return the current joint acceleration
74  inline scalarField& qDdot();
75 
76  //- Return the current time-step
77  inline scalar deltaT() const;
78 
79 
80  //- Return the previous motion state
81  inline const rigidBodyModelState& state0() const;
82 
83  //- Return the current joint position and orientation
84  inline const scalarField& q0() const;
85 
86  //- Return the current joint quaternion
87 
88  //- Return the current joint velocity
89  inline const scalarField& qDot0() const;
90 
91  //- Return the current joint acceleration
92  inline const scalarField& qDdot0() const;
93 
94  //- Return the previous time-step
95  inline scalar deltaT0() const;
96 
97  //- Correct the quaternion joints based on the current change in q
99 
100 
101 public:
102 
103  //- Runtime type information
104  TypeName("rigidBodySolver");
105 
106 
107  // Declare runtime construction
108 
110  (
111  autoPtr,
113  dictionary,
114  (
115  rigidBodyMotion& body,
116  const dictionary& dict
117  ),
118  (body, dict)
119  );
120 
121 
122  // Constructors
123 
124  // Construct for given body
126 
127 
128  //- Destructor
129  virtual ~rigidBodySolver();
130 
131 
132  // Selectors
133 
135  (
136  rigidBodyMotion& body,
137  const dictionary& dict
138  );
139 
140 
141  // Member Functions
142 
143  //- Integrate the rigid-body motion for one time-step
144  virtual void solve
145  (
146  const scalarField& tau,
147  const Field<spatialVector>& fx
148  ) = 0;
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace RBD
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #include "rigidBodySolverI.H"
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
rigidBodyMotion & model_
The rigid-body model.
dictionary dict
static autoPtr< rigidBodySolver > New(rigidBodyMotion &body, const dictionary &dict)
const rigidBodyModelState & state0() const
Return the previous motion state.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const scalarField & qDdot0() const
Return the current joint acceleration.
rigidBodyModelState & state()
Return the motion state.
scalar deltaT0() const
Return the previous time-step.
scalarField & q()
Return the current joint position and orientation.
Holds the motion state of rigid-body model.
scalar deltaT() const
Return the current time-step.
declareRunTimeSelectionTable(autoPtr, rigidBodySolver, dictionary,(rigidBodyMotion &body, const dictionary &dict),(body, dict))
const scalarField & q0() const
Return the current joint position and orientation.
Six degree of freedom motion for a rigid body.
TypeName("rigidBodySolver")
Runtime type information.
virtual void solve(const scalarField &tau, const Field< spatialVector > &fx)=0
Integrate the rigid-body motion for one time-step.
const scalarField & qDot0() const
Return the current joint quaternion.
rigidBodySolver(rigidBodyMotion &body)
scalarField & qDot()
Return the current joint quaternion.
scalarField & qDdot()
Return the current joint acceleration.
virtual ~rigidBodySolver()
Destructor.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
void correctQuaternionJoints()
Correct the quaternion joints based on the current change in q.
Namespace for OpenFOAM.