FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

linearSpring.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::sixDoFRigidBodyMotionRestraints::linearSpring
00026 
00027 Description
00028     sixDoFRigidBodyMotionRestraints model.  Linear spring.
00029 
00030 SourceFiles
00031     linearSpring.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef linearSpring_H
00036 #define linearSpring_H
00037 
00038 #include <forces/sixDoFRigidBodyMotionRestraint.H>
00039 #include <OpenFOAM/point.H>
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 namespace sixDoFRigidBodyMotionRestraints
00047 {
00048 
00049 /*---------------------------------------------------------------------------*\
00050                           Class linearSpring Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 class linearSpring
00054 :
00055     public sixDoFRigidBodyMotionRestraint
00056 {
00057     // Private data
00058 
00059         //- Anchor point, where the spring is attached to an immovable
00060         //  object
00061         point anchor_;
00062 
00063         //- Reference point of attachment to the solid body
00064         point refAttachmentPt_;
00065 
00066         //- Spring stiffness coefficient (N/m)
00067         scalar stiffness_;
00068 
00069         //- Damping coefficient (Ns/m)
00070         scalar damping_;
00071 
00072         //- Rest length - length of spring when no forces are applied to it
00073         scalar restLength_;
00074 
00075 
00076 public:
00077 
00078     //- Runtime type information
00079     TypeName("linearSpring");
00080 
00081 
00082     // Constructors
00083 
00084         //- Construct from components
00085         linearSpring
00086         (
00087             const dictionary& sDoFRBMRDict
00088         );
00089 
00090         //- Construct and return a clone
00091         virtual autoPtr<sixDoFRigidBodyMotionRestraint> clone() const
00092         {
00093             return autoPtr<sixDoFRigidBodyMotionRestraint>
00094             (
00095                 new linearSpring(*this)
00096             );
00097         }
00098 
00099 
00100     // Destructor
00101 
00102         virtual ~linearSpring();
00103 
00104 
00105     // Member Functions
00106 
00107         //- Calculate the restraint position, force and moment.
00108         //  Global reference frame vectors.
00109         virtual void restrain
00110         (
00111             const sixDoFRigidBodyMotion& motion,
00112             vector& restraintPosition,
00113             vector& restraintForce,
00114             vector& restraintMoment
00115         ) const;
00116 
00117         //- Update properties from given dictionary
00118         virtual bool read(const dictionary& sDoFRBMRCoeff);
00119 
00120         //- Write
00121         virtual void write(Ostream&) const;
00122 };
00123 
00124 
00125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00126 
00127 } // End namespace solidBodyMotionFunctions
00128 } // End namespace Foam
00129 
00130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00131 
00132 #endif
00133 
00134 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines