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

sixDoFRigidBodyMotionConstraint.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 Namespace
00025     Foam::sixDoFRigidBodyMotionConstraints
00026 
00027 Description
00028     Namespace for six DoF motion constraints
00029 
00030 
00031 Class
00032     Foam::sixDoFRigidBodyMotionConstraint
00033 
00034 Description
00035     Base class for defining constraints for sixDoF motions
00036 
00037 SourceFiles
00038     sixDoFRigidBodyMotionConstraint.C
00039     newDynamicFvMesh.C
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef sixDoFRigidBodyMotionConstraint_H
00044 #define sixDoFRigidBodyMotionConstraint_H
00045 
00046 #include <OpenFOAM/Time.H>
00047 #include <OpenFOAM/dictionary.H>
00048 #include <OpenFOAM/autoPtr.H>
00049 #include <OpenFOAM/vector.H>
00050 #include <OpenFOAM/runTimeSelectionTables.H>
00051 
00052 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00053 
00054 namespace Foam
00055 {
00056 
00057 // Forward declaration of classes
00058 class sixDoFRigidBodyMotion;
00059 
00060 
00061 /*---------------------------------------------------------------------------*\
00062                 Class sixDoFRigidBodyMotionConstraint Declaration
00063 \*---------------------------------------------------------------------------*/
00064 
00065 class sixDoFRigidBodyMotionConstraint
00066 {
00067 
00068 protected:
00069 
00070     // Protected data
00071 
00072         //- Constraint model specific coefficient dictionary
00073         dictionary sDoFRBMCCoeffs_;
00074 
00075         //- Solution tolerance.  Meaning depends on model, usually an
00076         //  absolute distance or angle.
00077         scalar tolerance_;
00078 
00079         //- Relaxation factor for solution, default to one
00080         scalar relaxationFactor_;
00081 
00082 
00083 public:
00084 
00085     //- Runtime type information
00086     TypeName("sixDoFRigidBodyMotionConstraint");
00087 
00088 
00089     // Declare run-time constructor selection table
00090 
00091         declareRunTimeSelectionTable
00092         (
00093             autoPtr,
00094             sixDoFRigidBodyMotionConstraint,
00095             dictionary,
00096             (const dictionary& sDoFRBMCDict),
00097             (sDoFRBMCDict)
00098         );
00099 
00100 
00101     // Constructors
00102 
00103         //- Construct from the sDoFRBMCDict dictionary and Time
00104         sixDoFRigidBodyMotionConstraint
00105         (
00106             const dictionary& sDoFRBMCDict
00107         );
00108 
00109         //- Construct and return a clone
00110         virtual autoPtr<sixDoFRigidBodyMotionConstraint> clone() const = 0;
00111 
00112 
00113     // Selectors
00114 
00115         //- Select constructed from the sDoFRBMCDict dictionary and Time
00116         static autoPtr<sixDoFRigidBodyMotionConstraint> New
00117         (
00118             const dictionary& sDoFRBMCDict
00119         );
00120 
00121 
00122     // Destructor
00123 
00124         virtual ~sixDoFRigidBodyMotionConstraint();
00125 
00126 
00127     // Member Functions
00128 
00129         //- Calculate the constraint position, force and moment.
00130         //  Global reference frame vectors.  Returns boolean stating
00131         //  whether the constraint been converged to tolerance.
00132         virtual bool constrain
00133         (
00134             const sixDoFRigidBodyMotion& motion,
00135             const vector& existingConstraintForce,
00136             const vector& existingConstraintMoment,
00137             scalar deltaT,
00138             vector& constraintPosition,
00139             vector& constraintForceIncrement,
00140             vector& constraintMomentIncrement
00141         ) const = 0;
00142 
00143         //- Update properties from given dictionary
00144         virtual bool read(const dictionary& sDoFRBMCDict);
00145 
00146         // Access
00147 
00148             // Return access to sDoFRBMCCoeffs
00149             inline const dictionary& coeffDict() const
00150             {
00151                 return sDoFRBMCCoeffs_;
00152             }
00153 
00154             //- Return access to the tolerance
00155             inline scalar tolerance() const
00156             {
00157                 return tolerance_;
00158             }
00159 
00160             //- Return access to the relaxationFactor
00161             inline scalar relaxationFactor() const
00162             {
00163                 return relaxationFactor_;
00164             }
00165 
00166         //- Write
00167         virtual void write(Ostream&) const;
00168 };
00169 
00170 
00171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00172 
00173 } // End namespace Foam
00174 
00175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00176 
00177 #endif
00178 
00179 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines