linearAxialAngularSpring.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) 2016 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::RBD::restraints::linearAxialAngularSpring
28 
29 Group
30  grpRigidBodyDynamicsRestraints
31 
32 Description
33  Linear axial angular spring restraint.
34 
35 SourceFiles
36  linearAxialAngularSpring.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef linearAxialAngularSpring_H
41 #define linearAxialAngularSpring_H
42 
43 #include "rigidBodyRestraint.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace RBD
50 {
51 namespace restraints
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class linearAxialAngularSpring Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public restraint
61 {
62  // Private data
63 
64  //- Reference orientation where there is no moment
65  tensor refQ_;
66 
67  //- Global unit axis around which the motion is sprung
68  vector axis_;
69 
70  //- Spring stiffness coefficient [Nm/rad]
71  scalar stiffness_;
72 
73  //- Damping coefficient [Nms/rad]
74  scalar damping_;
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("linearAxialAngularSpring");
81 
82 
83  // Constructors
84 
85  //- Construct from components
87  (
88  const word& name,
89  const dictionary& dict,
90  const rigidBodyModel& model
91  );
92 
93  //- Construct and return a clone
94  virtual autoPtr<restraint> clone() const
95  {
96  return autoPtr<restraint>
97  (
98  new linearAxialAngularSpring(*this)
99  );
100  }
101 
102 
103  //- Destructor
104  virtual ~linearAxialAngularSpring();
105 
106 
107  // Member Functions
108 
109  //- Accumulate the restraint internal joint forces into the tau field and
110  // external forces into the fx field
111  virtual void restrain
112  (
113  scalarField& tau,
115  const rigidBodyModelState& state
116  ) const;
117 
118  //- Update properties from given dictionary
119  virtual bool read(const dictionary& dict);
120 
121  //- Write
122  virtual void write(Ostream&) const;
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace RBD
129 } // End namespace RBD
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #endif
135 
136 // ************************************************************************* //
Foam::RBD::restraint::name
const word & name() const
Return the name.
Definition: rigidBodyRestraint.H:152
Foam::Tensor< scalar >
Foam::RBD::rigidBodyModelState
Holds the motion state of rigid-body model.
Definition: rigidBodyModelState.H:67
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::RBD::restraints::linearAxialAngularSpring::linearAxialAngularSpring
linearAxialAngularSpring(const word &name, const dictionary &dict, const rigidBodyModel &model)
Construct from components.
Definition: linearAxialAngularSpring.C:57
Foam::RBD::restraints::linearAxialAngularSpring::~linearAxialAngularSpring
virtual ~linearAxialAngularSpring()
Destructor.
Definition: linearAxialAngularSpring.C:71
Foam::Field< scalar >
Foam::RBD::restraints::linearAxialAngularSpring::read
virtual bool read(const dictionary &dict)
Update properties from given dictionary.
Definition: linearAxialAngularSpring.C:145
Foam::RBD::restraints::linearAxialAngularSpring
Linear axial angular spring restraint.
Definition: linearAxialAngularSpring.H:57
Foam::RBD::restraints::linearAxialAngularSpring::clone
virtual autoPtr< restraint > clone() const
Construct and return a clone.
Definition: linearAxialAngularSpring.H:93
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::RBD::rigidBodyModel
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
Definition: rigidBodyModel.H:83
Foam::RBD::restraints::linearAxialAngularSpring::TypeName
TypeName("linearAxialAngularSpring")
Runtime type information.
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::RBD::restraints::linearAxialAngularSpring::write
virtual void write(Ostream &) const
Write.
Definition: linearAxialAngularSpring.C:185
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector< scalar >
Foam::RBD::restraint
Base class for defining restraints for rigid-body dynamics.
Definition: rigidBodyRestraint.H:68
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::RBD::restraints::linearAxialAngularSpring::restrain
virtual void restrain(scalarField &tau, Field< spatialVector > &fx, const rigidBodyModelState &state) const
Accumulate the restraint internal joint forces into the tau field and.
Definition: linearAxialAngularSpring.C:78
rigidBodyRestraint.H