rigidBodySolver.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::RBD::rigidBodySolver
28 
29 Description
30 
31 SourceFiles
32  rigidBodySolver.C
33  newSixDoFSolver.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef RBD_rigidBodySolver_H
38 #define RBD_rigidBodySolver_H
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 #include "rigidBodyMotion.H"
43 #include "runTimeSelectionTables.H"
44 
45 namespace Foam
46 {
47 namespace RBD
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class rigidBodySolver Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class rigidBodySolver
55 {
56 protected:
57 
58  // Protected data
59 
60  //- The rigid-body model
62 
63 
64  //- Return the motion state
65  inline rigidBodyModelState& state();
66 
67  //- Return the current joint position and orientation
68  inline scalarField& q();
69 
70  //- Return the current joint quaternion
71 
72  //- Return the current joint velocity
73  inline scalarField& qDot();
74 
75  //- Return the current joint acceleration
76  inline scalarField& qDdot();
77 
78  //- Return the current time-step
79  inline scalar deltaT() const;
80 
81 
82  //- Return the previous motion state
83  inline const rigidBodyModelState& state0() const;
84 
85  //- Return the current joint position and orientation
86  inline const scalarField& q0() const;
87 
88  //- Return the current joint quaternion
89 
90  //- Return the current joint velocity
91  inline const scalarField& qDot0() const;
92 
93  //- Return the current joint acceleration
94  inline const scalarField& qDdot0() const;
95 
96  //- Return the previous time-step
97  inline scalar deltaT0() const;
98 
99  //- Correct the quaternion joints based on the current change in q
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("rigidBodySolver");
107 
108 
109  // Declare runtime construction
110 
112  (
113  autoPtr,
115  dictionary,
116  (
117  rigidBodyMotion& body,
118  const dictionary& dict
119  ),
120  (body, dict)
121  );
122 
123 
124  // Constructors
125 
126  // Construct for given body
128 
129 
130  //- Destructor
131  virtual ~rigidBodySolver();
132 
133 
134  // Selectors
135 
137  (
138  rigidBodyMotion& body,
139  const dictionary& dict
140  );
141 
142 
143  // Member Functions
144 
145  //- Integrate the rigid-body motion for one time-step
146  virtual void solve
147  (
148  const scalarField& tau,
149  const Field<spatialVector>& fx
150  ) = 0;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace RBD
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #include "rigidBodySolverI.H"
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
Foam::RBD::rigidBodyModelState
Holds the motion state of rigid-body model.
Definition: rigidBodyModelState.H:67
Foam::RBD::rigidBodySolver::qDdot
scalarField & qDdot()
Return the current joint acceleration.
Definition: rigidBodySolverI.H:48
rigidBodySolverI.H
Foam::RBD::rigidBodyMotion
Six degree of freedom motion for a rigid body.
Definition: rigidBodyMotion.H:75
Foam::RBD::rigidBodySolver::state0
const rigidBodyModelState & state0() const
Return the previous motion state.
Definition: rigidBodySolverI.H:61
Foam::RBD::rigidBodySolver::rigidBodySolver
rigidBodySolver(rigidBodyMotion &body)
Definition: rigidBodySolver.C:45
Foam::RBD::rigidBodySolver::New
static autoPtr< rigidBodySolver > New(rigidBodyMotion &body, const dictionary &dict)
Definition: rigidBodySolverNew.C:34
Foam::RBD::rigidBodySolver::solve
virtual void solve(const scalarField &tau, const Field< spatialVector > &fx)=0
Integrate the rigid-body motion for one time-step.
Foam::Field< scalar >
Foam::RBD::rigidBodySolver::correctQuaternionJoints
void correctQuaternionJoints()
Correct the quaternion joints based on the current change in q.
Definition: rigidBodySolver.C:59
Foam::RBD::rigidBodySolver::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, rigidBodySolver, dictionary,(rigidBodyMotion &body, const dictionary &dict),(body, dict))
Foam::RBD::rigidBodySolver::q0
const scalarField & q0() const
Return the current joint position and orientation.
Definition: rigidBodySolverI.H:66
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::RBD::rigidBodySolver::qDot
scalarField & qDot()
Return the current joint quaternion.
Definition: rigidBodySolverI.H:42
rigidBodyMotion.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::RBD::rigidBodySolver::deltaT
scalar deltaT() const
Return the current time-step.
Definition: rigidBodySolverI.H:54
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::RBD::rigidBodySolver::deltaT0
scalar deltaT0() const
Return the previous time-step.
Definition: rigidBodySolverI.H:84
Foam::RBD::rigidBodySolver::q
scalarField & q()
Return the current joint position and orientation.
Definition: rigidBodySolverI.H:36
Foam::RBD::rigidBodySolver::qDot0
const scalarField & qDot0() const
Return the current joint quaternion.
Definition: rigidBodySolverI.H:72
Foam::RBD::rigidBodySolver
Definition: rigidBodySolver.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::RBD::rigidBodySolver::model_
rigidBodyMotion & model_
The rigid-body model.
Definition: rigidBodySolver.H:60
Foam::RBD::rigidBodySolver::TypeName
TypeName("rigidBodySolver")
Runtime type information.
Foam::RBD::rigidBodySolver::~rigidBodySolver
virtual ~rigidBodySolver()
Destructor.
Definition: rigidBodySolver.C:53
Foam::RBD::rigidBodySolver::qDdot0
const scalarField & qDdot0() const
Return the current joint acceleration.
Definition: rigidBodySolverI.H:78
Foam::RBD::rigidBodySolver::state
rigidBodyModelState & state()
Return the motion state.
Definition: rigidBodySolverI.H:30