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

sixDoFRigidBodyDisplacementPointPatchVectorField.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::sixDoFRigidBodyDisplacementPointPatchVectorField
00026 
00027 Description
00028     Foam::sixDoFRigidBodyDisplacementPointPatchVectorField
00029 
00030 SourceFiles
00031     sixDoFRigidBodyDisplacementPointPatchVectorField.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef sixDoFRigidBodyDisplacementPointPatchVectorField_H
00036 #define sixDoFRigidBodyDisplacementPointPatchVectorField_H
00037 
00038 #include <OpenFOAM/fixedValuePointPatchField.H>
00039 #include <forces/sixDoFRigidBodyMotion.H>
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047         Class sixDoFRigidBodyDisplacementPointPatchVectorField Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 class sixDoFRigidBodyDisplacementPointPatchVectorField
00051 :
00052     public fixedValuePointPatchField<vector>
00053 {
00054     // Private data
00055 
00056         //- Six dof motion object
00057         sixDoFRigidBodyMotion motion_;
00058 
00059         //- Initial positions of points on the patch
00060         pointField initialPoints_;
00061 
00062         //- Reference density required by the forces object for
00063         //  incompressible calculations, required if rhoName == rhoInf
00064         scalar rhoInf_;
00065 
00066         //- Name of density field, optional unless used for an
00067         //  incompressible simulation, when this needs to be specified
00068         //  as rhoInf
00069         word rhoName_;
00070 
00071         //- State of gravity lookup:
00072         //  -1 = not determined yet, as the BC may be instantiated before g has
00073         //       been read into the db yet.  Determination deferred until first
00074         //       call to updateCoeffs.  A g keyword was not supplied to the
00075         //       dictionary.
00076         //  -2 = as for -1, but a gravity value was specified in the dictionary,
00077         //       specifying a value in the dictionary is considered a fatal
00078         //       error if g is available from the db.
00079         //   0 = Use this boundary condition's own value of gravity, as not
00080         //       available from the db.
00081         //   1 = Lookup gravity from db.
00082         label lookupGravity_;
00083 
00084         //- Gravity vector to store when not available from the db
00085         vector g_;
00086 
00087 
00088 public:
00089 
00090     //- Runtime type information
00091     TypeName("sixDoFRigidBodyDisplacement");
00092 
00093 
00094     // Constructors
00095 
00096         //- Construct from patch and internal field
00097         sixDoFRigidBodyDisplacementPointPatchVectorField
00098         (
00099             const pointPatch&,
00100             const DimensionedField<vector, pointMesh>&
00101         );
00102 
00103         //- Construct from patch, internal field and dictionary
00104         sixDoFRigidBodyDisplacementPointPatchVectorField
00105         (
00106             const pointPatch&,
00107             const DimensionedField<vector, pointMesh>&,
00108             const dictionary&
00109         );
00110 
00111         //- Construct by mapping given patchField<vector> onto a new patch
00112         sixDoFRigidBodyDisplacementPointPatchVectorField
00113         (
00114             const sixDoFRigidBodyDisplacementPointPatchVectorField&,
00115             const pointPatch&,
00116             const DimensionedField<vector, pointMesh>&,
00117             const pointPatchFieldMapper&
00118         );
00119 
00120         //- Construct and return a clone
00121         virtual autoPtr<pointPatchField<vector> > clone() const
00122         {
00123             return autoPtr<pointPatchField<vector> >
00124             (
00125                 new sixDoFRigidBodyDisplacementPointPatchVectorField
00126                 (
00127                     *this
00128                 )
00129             );
00130         }
00131 
00132         //- Construct as copy setting internal field reference
00133         sixDoFRigidBodyDisplacementPointPatchVectorField
00134         (
00135             const sixDoFRigidBodyDisplacementPointPatchVectorField&,
00136             const DimensionedField<vector, pointMesh>&
00137         );
00138 
00139         //- Construct and return a clone setting internal field reference
00140         virtual autoPtr<pointPatchField<vector> > clone
00141         (
00142             const DimensionedField<vector, pointMesh>& iF
00143         ) const
00144         {
00145             return autoPtr<pointPatchField<vector> >
00146             (
00147                 new sixDoFRigidBodyDisplacementPointPatchVectorField
00148                 (
00149                     *this,
00150                     iF
00151                 )
00152             );
00153         }
00154 
00155 
00156     // Member functions
00157 
00158         // Mapping functions
00159 
00160             //- Map (and resize as needed) from self given a mapping object
00161             virtual void autoMap
00162             (
00163                 const pointPatchFieldMapper&
00164             );
00165 
00166             //- Reverse map the given pointPatchField onto this pointPatchField
00167             virtual void rmap
00168             (
00169                 const pointPatchField<vector>&,
00170                 const labelList&
00171             );
00172 
00173 
00174         // Evaluation functions
00175 
00176             //- Update the coefficients associated with the patch field
00177             virtual void updateCoeffs();
00178 
00179 
00180         //- Write
00181         virtual void write(Ostream&) const;
00182 };
00183 
00184 
00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00186 
00187 } // End namespace Foam
00188 
00189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00190 
00191 #endif
00192 
00193 // ************************************************************************* //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines