Loading...
Searching...
No Matches
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 Copyright (C) 2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::sixDoFSolver
29
30Group
31 grpSixDoFRigidBodySolvers
32
33Description
34
35SourceFiles
36 sixDoFSolver.C
37 newSixDoFSolver.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef sixDoFSolver_H
42#define sixDoFSolver_H
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
48
49namespace Foam
50{
52/*---------------------------------------------------------------------------*\
53 Class sixDoFSolver Declaration
54\*---------------------------------------------------------------------------*/
55
56class sixDoFSolver
57{
58protected:
59
60 // Protected data
61
62 //- The rigid body
64
65 //- Model dictionary
67
68
69 // Protected member functions
70
71 //- Return the current centre of rotation
72 inline point& centreOfRotation();
73
74 //- Return the orientation
75 inline tensor& Q();
76
77 //- Return non-const access to vector
78 inline vector& v();
79
80 //- Return non-const access to acceleration
81 inline vector& a();
82
83 //- Return non-const access to angular momentum
84 inline vector& pi();
85
86 //- Return non-const access to torque
87 inline vector& tau();
88
89 //- Return the centre of rotation at previous time-step
90 inline const point& centreOfRotation0() const;
91
92 //- Return the orientation at previous time-step
93 inline const tensor& Q0() const;
94
95 //- Return the velocity at previous time-step
96 inline const vector& v0() const;
97
98 //- Return the acceleration at previous time-step
99 inline const vector& a0() const;
100
101 //- Return the angular momentum at previous time-step
102 inline const vector& pi0() const;
103
104 //- Return the torque at previous time-step
105 inline const vector& tau0() const;
106
107 //- Acceleration damping coefficient (for steady-state simulations)
108 inline scalar aDamp() const;
109
110 //- Translational constraint tensor
111 inline tensor tConstraints() const;
112
113 //- Rotational constraint tensor
114 inline tensor rConstraints() const;
115
116 //- Apply rotation tensors to Q0 for the given torque (pi) and deltaT
117 // and return the rotated Q and pi as a tuple
119 (
120 const tensor& Q0,
121 const vector& pi,
122 const scalar deltaT
123 ) const;
124
125 //- Update and relax accelerations from the force and torque
126 inline void updateAcceleration
127 (
128 const vector& fGlobal,
129 const vector& tauGlobal
130 );
131
132 //- Update the constraints to the object
133 inline void updateConstraints();
134
135
136public:
137
138 //- Runtime type information
139 TypeName("sixDoFSolver");
140
141
142 // Declare runtime construction
143
145 (
146 autoPtr,
149 (
150 const dictionary& dict,
152 ),
153 (dict, body)
154 );
155
156
157 // Constructors
158
159 // Construct for given body
161
162 //- Construct and return a clone
163 virtual autoPtr<sixDoFSolver> clone() const = 0;
164
165
166 //- Destructor
167 virtual ~sixDoFSolver();
168
169
170 // Selectors
171
173 (
174 const dictionary& dict,
176 );
178
179 // Member Functions
180
181 //- Drag coefficient
182 virtual void solve
183 (
184 bool firstIter,
185 const vector& fGlobal,
186 const vector& tauGlobal,
187 scalar deltaT,
188 scalar deltaT0
189 ) = 0;
190
191
192 //- Write
193 void write(Ostream&) const;
194};
195
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199} // End namespace Foam
200
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202
204
205// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207#endif
208
209// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition Tuple2.H:51
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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.
vector & pi()
Return non-const access to angular momentum.
sixDoFSolver(const dictionary &dict, sixDoFRigidBodyMotion &body)
point & centreOfRotation()
Return the current centre of rotation.
const point & centreOfRotation0() const
Return the centre of rotation at previous time-step.
dictionary dict_
Model dictionary.
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.
void updateConstraints()
Update the constraints to the object.
virtual ~sixDoFSolver()
Destructor.
tensor & Q()
Return the orientation.
scalar aDamp() const
Acceleration damping coefficient (for steady-state simulations).
const vector & v0() const
Return the velocity at previous time-step.
const vector & a0() const
Return the acceleration at previous time-step.
const vector & pi0() const
Return the angular momentum at previous time-step.
const tensor & Q0() const
Return the orientation at previous time-step.
TypeName("sixDoFSolver")
Runtime type information.
tensor rConstraints() const
Rotational constraint tensor.
vector & a()
Return non-const access to acceleration.
vector & tau()
Return non-const access to torque.
vector & v()
Return non-const access to vector.
virtual void solve(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)=0
Drag coefficient.
Namespace for OpenFOAM.
Tensor< scalar > tensor
Definition symmTensor.H:57
vector point
Point is a vector.
Definition point.H:37
Vector< scalar > vector
Definition vector.H:57
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:68