sixDoFSolver.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) 2015 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::sixDoFSolver
28 
29 Group
30  grpSixDoFRigidBodySolvers
31 
32 Description
33 
34 SourceFiles
35  sixDoFSolver.C
36  newSixDoFSolver.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef sixDoFSolver_H
41 #define sixDoFSolver_H
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 #include "sixDoFRigidBodyMotion.H"
46 #include "runTimeSelectionTables.H"
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class sixDoFSolver Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class sixDoFSolver
56 {
57 protected:
58 
59  // Protected data
60 
61  //- The rigid body
63 
64  //- Model dictionary
66 
67 
68  // Protected member functions
69 
70  //- Return the current centre of rotation
71  inline point& centreOfRotation();
72 
73  //- Return the orientation
74  inline tensor& Q();
75 
76  //- Return non-const access to vector
77  inline vector& v();
78 
79  //- Return non-const access to acceleration
80  inline vector& a();
81 
82  //- Return non-const access to angular momentum
83  inline vector& pi();
84 
85  //- Return non-const access to torque
86  inline vector& tau();
87 
88  //- Return the centre of rotation at previous time-step
89  inline const point& centreOfRotation0() const;
90 
91  //- Return the orientation at previous time-step
92  inline const tensor& Q0() const;
93 
94  //- Return the velocity at previous time-step
95  inline const vector& v0() const;
96 
97  //- Return the acceleration at previous time-step
98  inline const vector& a0() const;
99 
100  //- Return the angular momentum at previous time-step
101  inline const vector& pi0() const;
102 
103  //- Return the torque at previous time-step
104  inline const vector& tau0() const;
105 
106  //- Acceleration damping coefficient (for steady-state simulations)
107  inline scalar aDamp() const;
108 
109  //- Translational constraint tensor
110  inline tensor tConstraints() const;
111 
112  //- Rotational constraint tensor
113  inline tensor rConstraints() const;
114 
115  //- Apply rotation tensors to Q0 for the given torque (pi) and deltaT
116  // and return the rotated Q and pi as a tuple
118  (
119  const tensor& Q0,
120  const vector& pi,
121  const scalar deltaT
122  ) const;
123 
124  //- Update and relax accelerations from the force and torque
125  inline void updateAcceleration
126  (
127  const vector& fGlobal,
128  const vector& tauGlobal
129  );
130 
131 
132 public:
133 
134  //- Runtime type information
135  TypeName("sixDoFSolver");
136 
137 
138  // Declare runtime construction
139 
141  (
142  autoPtr,
143  sixDoFSolver,
144  dictionary,
145  (
146  const dictionary& dict,
148  ),
149  (dict, body)
150  );
151 
152 
153  // Constructors
154 
155  // Construct for given body
157 
158  //- Construct and return a clone
159  virtual autoPtr<sixDoFSolver> clone() const = 0;
160 
161 
162  //- Destructor
163  virtual ~sixDoFSolver();
164 
165 
166  // Selectors
167 
169  (
170  const dictionary& dict,
172  );
173 
174 
175  // Member Functions
176 
177  //- Drag coefficient
178  virtual void solve
179  (
180  bool firstIter,
181  const vector& fGlobal,
182  const vector& tauGlobal,
183  scalar deltaT,
184  scalar deltaT0
185  ) = 0;
186 
187 
188  //- Write
189  void write(Ostream&) const;
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #include "sixDoFSolverI.H"
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
vector & v()
Return non-const access to vector.
Definition: sixDoFSolverI.H:33
tensor tConstraints() const
Translational constraint tensor.
Definition: sixDoFSolverI.H:93
tensor rConstraints() const
Rotational constraint tensor.
Definition: sixDoFSolverI.H:98
dictionary dict
point & centreOfRotation()
Return the current centre of rotation.
Definition: sixDoFSolverI.H:23
TypeName("sixDoFSolver")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: stringOps.H:55
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)=0
Drag coefficient.
virtual ~sixDoFSolver()
Destructor.
Definition: sixDoFSolver.C:53
dictionary dict_
Model dictionary.
Definition: sixDoFSolver.H:64
const vector & pi0() const
Return the angular momentum at previous time-step.
Definition: sixDoFSolverI.H:77
tensor & Q()
Return the orientation.
Definition: sixDoFSolverI.H:28
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:43
virtual autoPtr< sixDoFSolver > clone() const =0
Construct and return a clone.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
sixDoFSolver(const dictionary &dict, sixDoFRigidBodyMotion &body)
Definition: sixDoFSolver.C:36
const tensor & Q0() const
Return the orientation at previous time-step.
Definition: sixDoFSolverI.H:59
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:59
const point & centreOfRotation0() const
Return the centre of rotation at previous time-step.
Definition: sixDoFSolverI.H:54
const vector & a0() const
Return the acceleration at previous time-step.
Definition: sixDoFSolverI.H:71
void write(Ostream &) const
Write.
Definition: sixDoFSolver.C:46
const vector & tau0() const
Return the torque at previous time-step.
Definition: sixDoFSolverI.H:83
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Macros to ease declaration of run-time selection tables.
vector & a()
Return non-const access to acceleration.
Definition: sixDoFSolverI.H:38
static autoPtr< sixDoFSolver > New(const dictionary &dict, sixDoFRigidBodyMotion &body)
Tensor of scalars, i.e. Tensor<scalar>.
vector & tau()
Return non-const access to torque.
Definition: sixDoFSolverI.H:48
Namespace for OpenFOAM.
scalar aDamp() const
Acceleration damping coefficient (for steady-state simulations)
Definition: sixDoFSolverI.H:88
const vector & v0() const
Return the velocity at previous time-step.
Definition: sixDoFSolverI.H:65