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 // ************************************************************************* //
sixDoFSolverI.H
Foam::Tensor< scalar >
Foam::sixDoFSolver::rConstraints
tensor rConstraints() const
Rotational constraint tensor.
Definition: sixDoFSolverI.H:105
Foam::sixDoFSolver::Q
tensor & Q()
Return the orientation.
Definition: sixDoFSolverI.H:35
Foam::sixDoFSolver
Definition: sixDoFSolver.H:54
Foam::sixDoFSolver::write
void write(Ostream &) const
Write.
Definition: sixDoFSolver.C:53
Foam::sixDoFSolver::tau0
const vector & tau0() const
Return the torque at previous time-step.
Definition: sixDoFSolverI.H:90
Foam::sixDoFSolver::centreOfRotation
point & centreOfRotation()
Return the current centre of rotation.
Definition: sixDoFSolverI.H:30
Foam::sixDoFSolver::a
vector & a()
Return non-const access to acceleration.
Definition: sixDoFSolverI.H:45
Foam::sixDoFSolver::New
static autoPtr< sixDoFSolver > New(const dictionary &dict, sixDoFRigidBodyMotion &body)
Definition: sixDoFSolverNew.C:34
Foam::sixDoFSolver::v0
const vector & v0() const
Return the velocity at previous time-step.
Definition: sixDoFSolverI.H:72
sixDoFRigidBodyMotion.H
Foam::sixDoFSolver::v
vector & v()
Return non-const access to vector.
Definition: sixDoFSolverI.H:40
Foam::sixDoFSolver::Q0
const tensor & Q0() const
Return the orientation at previous time-step.
Definition: sixDoFSolverI.H:66
Foam::sixDoFSolver::sixDoFSolver
sixDoFSolver(const dictionary &dict, sixDoFRigidBodyMotion &body)
Definition: sixDoFSolver.C:43
Foam::sixDoFSolver::dict_
dictionary dict_
Model dictionary.
Definition: sixDoFSolver.H:64
Foam::sixDoFSolver::rotate
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.
Definition: sixDoFSolverI.H:113
Foam::sixDoFSolver::solve
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)=0
Drag coefficient.
Foam::sixDoFSolver::centreOfRotation0
const point & centreOfRotation0() const
Return the centre of rotation at previous time-step.
Definition: sixDoFSolverI.H:61
dict
dictionary dict
Definition: searchingEngine.H:14
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::sixDoFSolver::~sixDoFSolver
virtual ~sixDoFSolver()
Destructor.
Definition: sixDoFSolver.C:60
Foam::sixDoFSolver::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, sixDoFSolver, dictionary,(const dictionary &dict, sixDoFRigidBodyMotion &body),(dict, body))
Foam::sixDoFSolver::TypeName
TypeName("sixDoFSolver")
Runtime type information.
Foam::sixDoFSolver::pi
vector & pi()
Return non-const access to angular momentum.
Definition: sixDoFSolverI.H:50
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::sixDoFRigidBodyMotion
Six degree of freedom motion for a rigid body.
Definition: sixDoFRigidBodyMotion.H:69
Foam::sixDoFSolver::aDamp
scalar aDamp() const
Acceleration damping coefficient (for steady-state simulations)
Definition: sixDoFSolverI.H:95
Foam::sixDoFSolver::clone
virtual autoPtr< sixDoFSolver > clone() const =0
Construct and return a clone.
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::Vector< scalar >
Foam::sixDoFSolver::updateAcceleration
void updateAcceleration(const vector &fGlobal, const vector &tauGlobal)
Update and relax accelerations from the force and torque.
Definition: sixDoFSolverI.H:124
Foam::sixDoFSolver::tConstraints
tensor tConstraints() const
Translational constraint tensor.
Definition: sixDoFSolverI.H:100
Foam::sixDoFSolver::pi0
const vector & pi0() const
Return the angular momentum at previous time-step.
Definition: sixDoFSolverI.H:84
Foam::sixDoFSolver::tau
vector & tau()
Return non-const access to torque.
Definition: sixDoFSolverI.H:55
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::Tuple2
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: stringOps.H:60
Foam::sixDoFSolver::body_
sixDoFRigidBodyMotion & body_
The rigid body.
Definition: sixDoFSolver.H:61
Foam::sixDoFSolver::a0
const vector & a0() const
Return the acceleration at previous time-step.
Definition: sixDoFSolverI.H:78