Ra.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "Ra.H"
27 #include "rigidBodyModelState.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace RBD
35 {
36 namespace joints
37 {
39 
41  (
42  joint,
43  Ra,
44  dictionary
45  );
46 }
47 }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
54 :
55  joint(model, 1)
56 {
57  S_[0] = spatialVector(axis/mag(axis), Zero);
58 }
59 
60 
62 :
63  joint(model, 1)
64 {
65  vector axis(dict.lookup("axis"));
66  S_[0] = spatialVector(axis/mag(axis), Zero);
67 }
68 
69 
71 {
72  return autoPtr<joint>(new Ra(*this));
73 }
74 
75 
76 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
77 
79 {}
80 
81 
82 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
83 
85 (
86  joint::XSvc& J,
87  const rigidBodyModelState& state
88 ) const
89 {
90  J.X = Xr(S_[0].w(), state.q()[qIndex_]);
91  J.S1 = S_[0];
92  J.v = S_[0]*state.qDot()[qIndex_];
93  J.c = Zero;
94 }
95 
96 
98 {
99  joint::write(os);
100  os.writeKeyword("axis")
101  << S_[0].w() << token::END_STATEMENT << nl;
102 }
103 
104 
105 // ************************************************************************* //
Abstract base-class for all rigid-body joints.
Definition: joint.H:80
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
spatialVector v
The constrained joint velocity.
Definition: joint.H:137
spatialVector S1
The joint motion sub-space (1-DoF)
Definition: joint.H:134
label qIndex_
Index of this joints data in the rigidBodyModel state.
Definition: joint.H:97
defineTypeNameAndDebug(composite, 0)
addToRunTimeSelectionTable(joint, composite, dictionary)
spatialVector c
The constrained joint acceleration correction.
Definition: joint.H:141
Macros for easy insertion into run-time selection tables.
Holds the motion state of rigid-body model.
Joint state returned by jcalc.
Definition: joint.H:123
virtual void write(Ostream &) const
Write.
Definition: joint.C:82
Ra(const rigidBodyModel &model, const vector &axis)
Construct for given model and axis.
Definition: Ra.C:53
const scalarField & q() const
Return access to the joint position and orientation.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
Definition: spatialVector.H:47
const scalarField & qDot() const
Return access to the joint velocity.
spatialTransform Xr(const vector &a, const scalar omega)
Rotational spatial transformation tensor about axis a by omega radians.
static const zero Zero
Definition: zero.H:97
virtual ~Ra()
Destructor.
Definition: Ra.C:78
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual autoPtr< joint > clone() const
Clone this joint.
Definition: Ra.C:70
List< spatialVector > S_
Joint motion sub-space.
Definition: joint.H:91
static const char nl
Definition: Ostream.H:265
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:54
spatialTransform X
The joint transformation.
Definition: joint.H:128
virtual void write(Ostream &) const
Write.
Definition: Ra.C:97
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
tensor Ra(const vector &a, const scalar omega)
Rotational transformation tensor about axis a by omega radians.
Definition: transform.H:123
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints...
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576
virtual void jcalc(joint::XSvc &J, const rigidBodyModelState &state) const
Update the model state for this joint.
Definition: Ra.C:85