linearSpring.H
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) 2011-2020 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 Class
25  Foam::sixDoFRigidBodyMotionRestraints::linearSpring
26 
27 Description
28  sixDoFRigidBodyMotionRestraints model. Linear spring.
29 
30 SourceFiles
31  linearSpring.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef linearSpring_H
36 #define linearSpring_H
37 
39 #include "point.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 namespace sixDoFRigidBodyMotionRestraints
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class linearSpring Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class linearSpring
54 :
56 {
57  // Private Data
58 
59  //- Anchor point, where the spring is attached to an immovable
60  // object
61  point anchor_;
62 
63  //- Reference point of attachment to the solid body
64  point refAttachmentPt_;
65 
66  //- Spring stiffness coefficient (N/m)
67  scalar stiffness_;
68 
69  //- Damping coefficient (Ns/m)
70  scalar damping_;
71 
72  //- Rest length - length of spring when no forces are applied to it
73  scalar restLength_;
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("linearSpring");
80 
81 
82  // Constructors
83 
84  //- Construct from components
86  (
87  const word& name,
88  const dictionary& sDoFRBMRDict
89  );
90 
91  //- Construct and return a clone
93  {
95  (
96  new linearSpring(*this)
97  );
98  }
99 
100 
101  //- Destructor
102  virtual ~linearSpring();
103 
104 
105  // Member Functions
106 
107  //- Calculate the restraint position, force and moment.
108  // Global reference frame vectors.
109  virtual void restrain
110  (
111  const sixDoFRigidBodyMotion& motion,
112  vector& restraintPosition,
113  vector& restraintForce,
114  vector& restraintMoment
115  ) const;
116 
117  //- Update properties from given dictionary
118  virtual bool read(const dictionary& sDoFRBMRCoeff);
119 
120  //- Write
121  virtual void write(Ostream&) const;
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace solidBodyMotionFunctions
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
virtual void restrain(const sixDoFRigidBodyMotion &motion, vector &restraintPosition, vector &restraintForce, vector &restraintMoment) const
Calculate the restraint position, force and moment.
Definition: linearSpring.C:76
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Base class for defining restraints for sixDoF motions.
virtual bool read(const dictionary &sDoFRBMRCoeff)
Update properties from given dictionary.
Definition: linearSpring.C:107
linearSpring(const word &name, const dictionary &sDoFRBMRDict)
Construct from components.
Definition: linearSpring.C:51
virtual autoPtr< sixDoFRigidBodyMotionRestraint > clone() const
Construct and return a clone.
Definition: linearSpring.H:91
virtual void write(Ostream &) const
Write.
Definition: linearSpring.C:124
A class for handling words, derived from string.
Definition: word.H:59
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
TypeName("linearSpring")
Runtime type information.
const word & name() const
Return the name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
sixDoFRigidBodyMotionRestraints model. Linear spring.
Definition: linearSpring.H:52
Namespace for OpenFOAM.