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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::sixDoFSolver
28
29Group
30 grpSixDoFRigidBodySolvers
31
32Description
33
34SourceFiles
35 sixDoFSolver.C
36 newSixDoFSolver.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef sixDoFSolver_H
41#define sixDoFSolver_H
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class sixDoFSolver Declaration
53\*---------------------------------------------------------------------------*/
55class sixDoFSolver
56{
57protected:
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
132public:
133
134 //- Runtime type information
135 TypeName("sixDoFSolver");
136
137
138 // Declare runtime construction
141 (
142 autoPtr,
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// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: Tuple2.H:58
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Six degree of freedom motion for a rigid body.
virtual autoPtr< sixDoFSolver > clone() const =0
Construct and return a clone.
static autoPtr< sixDoFSolver > New(const dictionary &dict, sixDoFRigidBodyMotion &body)
tensor tConstraints() const
Translational constraint tensor.
void updateAcceleration(const vector &fGlobal, const vector &tauGlobal)
Update and relax accelerations from the force and torque.
const vector & tau0() const
Return the torque at previous time-step.
Definition: sixDoFSolverI.H:90
vector & pi()
Return non-const access to angular momentum.
Definition: sixDoFSolverI.H:50
point & centreOfRotation()
Return the current centre of rotation.
Definition: sixDoFSolverI.H:30
const point & centreOfRotation0() const
Return the centre of rotation at previous time-step.
Definition: sixDoFSolverI.H:61
dictionary dict_
Model dictionary.
Definition: sixDoFSolver.H:64
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))
sixDoFRigidBodyMotion & body_
The rigid body.
Definition: sixDoFSolver.H:61
virtual ~sixDoFSolver()
Destructor.
Definition: sixDoFSolver.C:60
tensor & Q()
Return the orientation.
Definition: sixDoFSolverI.H:35
scalar aDamp() const
Acceleration damping coefficient (for steady-state simulations)
Definition: sixDoFSolverI.H:95
const vector & v0() const
Return the velocity at previous time-step.
Definition: sixDoFSolverI.H:72
const vector & a0() const
Return the acceleration at previous time-step.
Definition: sixDoFSolverI.H:78
const vector & pi0() const
Return the angular momentum at previous time-step.
Definition: sixDoFSolverI.H:84
const tensor & Q0() const
Return the orientation at previous time-step.
Definition: sixDoFSolverI.H:66
TypeName("sixDoFSolver")
Runtime type information.
tensor rConstraints() const
Rotational constraint tensor.
vector & a()
Return non-const access to acceleration.
Definition: sixDoFSolverI.H:45
vector & tau()
Return non-const access to torque.
Definition: sixDoFSolverI.H:55
vector & v()
Return non-const access to vector.
Definition: sixDoFSolverI.H:40
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)=0
Drag coefficient.
Namespace for OpenFOAM.
runTime write()
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
CEqn solve()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73