sixDoFMotion: Adding restraints and constraints to the motion of objects.
[OpenFOAM-1.6.x.git] / src / postProcessing / functionObjects / forces / pointPatchFields / derived / sixDoFRigidBodyMotion / sixDoFRigidBodyMotionRestraint / linearSpring / linearSpring.H
bloba16893eb72d790eeddac64c7e0017b60ef8ce005
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::sixDoFRigidBodyMotionRestraints::linearSpring
28 Description
29     sixDoFRigidBodyMotionRestraints model.  Linear spring.
31 SourceFiles
32     linearSpring.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef linearSpring_H
37 #define linearSpring_H
39 #include "sixDoFRigidBodyMotionRestraint.H"
40 #include "point.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 namespace sixDoFRigidBodyMotionRestraints
50 /*---------------------------------------------------------------------------*\
51                           Class linearSpring Declaration
52 \*---------------------------------------------------------------------------*/
54 class linearSpring
56     public sixDoFRigidBodyMotionRestraint
58     // Private data
60         //- Anchor point, where the spring is attached to an immovable
61         //  object
62         point anchor_;
64         //- Reference point of attachment to the solid body
65         point refAttachmentPt_;
67         //- Spring stiffness coefficient (N/m)
68         scalar stiffness_;
70         //- Damping coefficient (Ns/m)
71         scalar damping_;
73         //- Rest length - length of spring when no forces are applied to it
74         scalar restLength_;
77 public:
79     //- Runtime type information
80     TypeName("linearSpring");
83     // Constructors
85         //- Construct from components
86         linearSpring
87         (
88             const dictionary& sDoFRBMRDict
89         );
91         //- Construct and return a clone
92         virtual autoPtr<sixDoFRigidBodyMotionRestraint> clone() const
93         {
94             return autoPtr<sixDoFRigidBodyMotionRestraint>
95             (
96                 new linearSpring(*this)
97             );
98         }
101     // Destructor
103         virtual ~linearSpring();
106     // Member Functions
108         //- Calculate the restraint position, force and moment.
109         //  Global reference frame vectors.
110         virtual void restrain
111         (
112             const sixDoFRigidBodyMotion& motion,
113             vector& restraintPosition,
114             vector& restraintForce,
115             vector& restraintMoment
116         ) const;
118         //- Update properties from given dictionary
119         virtual bool read(const dictionary& sDoFRBMRCoeff);
121         //- Write
122         virtual void write(Ostream&) const;
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 } // End namespace solidBodyMotionFunctions
129 } // End namespace Foam
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 #endif
135 // ************************************************************************* //