prescribedRotation.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) 2021 OpenCFD Ltd.
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::RBD::restraints::prescribedRotation
28
29Group
30 grpRigidBodyDynamicsRestraints
31
32Description
33 Restraint setting angular velocity of the rigid body.
34 Developed from the linear axial angular spring restraint.
35
36 Adds a rotation along given axis to the body.
37 Used for a combination of 6DOF bodies where one is driven by 6DOF and
38 the other attached to it using specified rotation
39 in the local reference frame.
40
41Usage
42 \table
43 Property | Description | Required | Default value
44 referenceOrientation | Orientation | no | I
45 axis | Rotation axis (in reference) | yes |
46 omega | Angular velocity (rad/s) | yes |
47 relax | Relax moment with previous iter | yes
48 p | Propoptional corrector for PDI | yes
49 d | Differential corrector for PDI | yes
50 i | Integral corrector for PDI | yes
51 \endtable
52
53SourceFiles
54 prescribedRotation.C
55
56\*---------------------------------------------------------------------------*/
57
58#ifndef prescribedRotation_H
59#define prescribedRotation_H
60
61#include "rigidBodyRestraint.H"
62#include "Function1.H"
63
64// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65
66namespace Foam
67{
68namespace RBD
69{
70namespace restraints
71{
72
73/*---------------------------------------------------------------------------*\
74 Class prescribedRotation Declaration
75\*---------------------------------------------------------------------------*/
76
77class prescribedRotation
78:
79 public restraint
80{
81 // Private data
82
83 //- Reference orientation where there is no moment
84 tensor refQ_;
85
86 //- Global unit axis around which the motion is sprung
87 vector axis_;
88
89 //- Rotational velocity [rad/sec]
90 autoPtr<Function1<vector>> omegaSet_;
91
92 //- Cache omega
93 mutable vector omega_;
94
95 //- Cache previous momentum
96 mutable vector oldMom_;
97
98 //- Relax momentum
99 scalar relax_;
100
101 //- PID constants
102
103 mutable vector error0_;
104
105 mutable vector integral0_;
106
107 mutable scalar p_;
108
109 mutable scalar i_;
110
111 mutable scalar d_;
113public:
114
115 //- Runtime type information
116 TypeName("prescribedRotation");
117
118
119 // Constructors
120
121 //- Construct from components
123 (
124 const word& name,
125 const dictionary& dict,
126 const rigidBodyModel& model
127 );
128
129 //- Construct and return a clone
130 virtual autoPtr<restraint> clone() const
131 {
132 return autoPtr<restraint>
133 (
134 new prescribedRotation(*this)
135 );
136 }
137
138
139 //- Destructor
140 virtual ~prescribedRotation();
141
142
143 // Member Functions
144
145 //- Accumulate the retraint internal joint forces into the tau field and
146 // external forces into the fx field
147 virtual void restrain
148 (
149 scalarField& tau,
152 ) const;
153
154 //- Update properties from given dictionary
155 virtual bool read(const dictionary& dict);
156
157 //- Write
158 virtual void write(Ostream&) const;
159};
160
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164} // End namespace restraints
165} // End namespace RBD
166} // End namespace Foam
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170#endif
171
172// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Base class for defining restraints for rigid-body dynamics.
const word & name() const
Return the name.
Restraint setting angular velocity of the rigid body. Developed from the linear axial angular spring ...
virtual bool read(const dictionary &dict)
Update properties from given dictionary.
virtual void restrain(scalarField &tau, Field< spatialVector > &fx, const rigidBodyModelState &state) const
Accumulate the retraint internal joint forces into the tau field and.
virtual autoPtr< restraint > clone() const
Construct and return a clone.
TypeName("prescribedRotation")
Runtime type information.
Holds the motion state of rigid-body model.
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
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
Tensor of scalars, i.e. Tensor<scalar>.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73