sixDoFSolver.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) 2015-2020 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::sixDoFSolver
26 
27 Description
28 
29 SourceFiles
30  sixDoFSolver.C
31  sixDoFSolverNew.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef sixDoFSolver_H
36 #define sixDoFSolver_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 #include "sixDoFRigidBodyMotion.H"
41 #include "runTimeSelectionTables.H"
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class sixDoFSolver Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class sixDoFSolver
51 {
52 protected:
53 
54  // Protected data
55 
56  //- The rigid body
58 
59 
60  // Protected member functions
61 
62  //- Return the current centre of rotation
63  inline point& centreOfRotation();
64 
65  //- Return the orientation
66  inline tensor& Q();
67 
68  //- Return non-const access to vector
69  inline vector& v();
70 
71  //- Return non-const access to acceleration
72  inline vector& a();
73 
74  //- Return non-const access to angular momentum
75  inline vector& pi();
76 
77  //- Return non-const access to torque
78  inline vector& tau();
79 
80  //- Return the centre of rotation at previous time-step
81  inline const point& centreOfRotation0() const;
82 
83  //- Return the orientation at previous time-step
84  inline const tensor& Q0() const;
85 
86  //- Return the velocity at previous time-step
87  inline const vector& v0() const;
88 
89  //- Return the acceleration at previous time-step
90  inline const vector& a0() const;
91 
92  //- Return the angular momentum at previous time-step
93  inline const vector& pi0() const;
94 
95  //- Return the torque at previous time-step
96  inline const vector& tau0() const;
97 
98  //- Acceleration damping coefficient (for steady-state simulations)
99  inline scalar aDamp() const;
100 
101  //- Translational constraint tensor
102  inline tensor tConstraints() const;
103 
104  //- Rotational constraint tensor
105  inline tensor rConstraints() const;
106 
107  //- Apply rotation tensors to Q0 for the given torque (pi) and deltaT
108  // and return the rotated Q and pi as a tuple
110  (
111  const tensor& Q0,
112  const vector& pi,
113  const scalar deltaT
114  ) const;
115 
116  //- Update and relax accelerations from the force and torque
117  inline void updateAcceleration
118  (
119  const vector& fGlobal,
120  const vector& tauGlobal
121  );
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("sixDoFSolver");
128 
129 
130  // Declare runtime construction
131 
133  (
134  autoPtr,
135  sixDoFSolver,
136  dictionary,
137  (
138  const dictionary& dict,
140  ),
141  (dict, body)
142  );
143 
144 
145  // Constructors
146 
147  // Construct for given body
149 
150 
151  //- Destructor
152  virtual ~sixDoFSolver();
153 
154 
155  // Selectors
156 
158  (
159  const dictionary& dict,
161  );
162 
163 
164  // Member Functions
165 
166  //- Drag coefficient
167  virtual void solve
168  (
169  bool firstIter,
170  const vector& fGlobal,
171  const vector& tauGlobal,
172  scalar deltaT,
173  scalar deltaT0
174  ) = 0;
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #include "sixDoFSolverI.H"
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
sixDoFSolver(sixDoFRigidBodyMotion &body)
Definition: sixDoFSolver.C:39
vector & v()
Return non-const access to vector.
Definition: sixDoFSolverI.H:38
tensor tConstraints() const
Translational constraint tensor.
Definition: sixDoFSolverI.H:98
tensor rConstraints() const
Rotational constraint tensor.
dictionary dict
point & centreOfRotation()
Return the current centre of rotation.
Definition: sixDoFSolverI.H:28
TypeName("sixDoFSolver")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A 2-tuple for storing two objects of different types.
Definition: HashTable.H:65
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)=0
Drag coefficient.
virtual ~sixDoFSolver()
Destructor.
Definition: sixDoFSolver.C:47
const vector & pi0() const
Return the angular momentum at previous time-step.
Definition: sixDoFSolverI.H:82
tensor & Q()
Return the orientation.
Definition: sixDoFSolverI.H:33
Tuple2< tensor, vector > rotate(const tensor &Q0, const vector &pi, const scalar deltaT) const
Apply rotation tensors to Q0 for the given torque (pi) and deltaT.
declareRunTimeSelectionTable(autoPtr, sixDoFSolver, dictionary,(const dictionary &dict, sixDoFRigidBodyMotion &body),(dict, body))
vector & pi()
Return non-const access to angular momentum.
Definition: sixDoFSolverI.H:48
const tensor & Q0() const
Return the orientation at previous time-step.
Definition: sixDoFSolverI.H:64
void updateAcceleration(const vector &fGlobal, const vector &tauGlobal)
Update and relax accelerations from the force and torque.
sixDoFRigidBodyMotion & body_
The rigid body.
Definition: sixDoFSolver.H:56
const point & centreOfRotation0() const
Return the centre of rotation at previous time-step.
Definition: sixDoFSolverI.H:59
const vector & a0() const
Return the acceleration at previous time-step.
Definition: sixDoFSolverI.H:76
const vector & tau0() const
Return the torque at previous time-step.
Definition: sixDoFSolverI.H:88
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.
vector & a()
Return non-const access to acceleration.
Definition: sixDoFSolverI.H:43
static autoPtr< sixDoFSolver > New(const dictionary &dict, sixDoFRigidBodyMotion &body)
vector & tau()
Return non-const access to torque.
Definition: sixDoFSolverI.H:53
Namespace for OpenFOAM.
scalar aDamp() const
Acceleration damping coefficient (for steady-state simulations)
Definition: sixDoFSolverI.H:93
const vector & v0() const
Return the velocity at previous time-step.
Definition: sixDoFSolverI.H:70