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

surfaceSlipDisplacementPointPatchVectorField.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::surfaceSlipDisplacementPointPatchVectorField
00026 
00027 Description
00028     Displacement follows a triSurface. Use in a displacement fvMotionSolver
00029     as a bc on the pointDisplacement field.
00030     Following is done by calculating the projection onto the surface according
00031     to the projectMode
00032     - NEAREST : nearest
00033     - POINTNORMAL : intersection with point normal
00034     - FIXEDNORMAL : intersection with fixed vector
00035 
00036     Optionally (intersection only) removes a component ("wedgePlane") to
00037     stay in 2D.
00038 
00039     Needs:
00040     - geometry : dictionary with searchableSurfaces. (usually
00041       triSurfaceMeshes in constant/triSurface)
00042     - projectMode : see above
00043     - projectDirection : if projectMode = fixedNormal
00044     - wedgePlane : -1 or component to knock out of intersection normal
00045     - frozenPointsZone : empty or name of pointZone containing points
00046                          that do not move
00047 
00048 SourceFiles
00049     surfaceSlipDisplacementPointPatchVectorField.C
00050 
00051 \*---------------------------------------------------------------------------*/
00052 
00053 #ifndef surfaceSlipDisplacementPointPatchVectorField_H
00054 #define surfaceSlipDisplacementPointPatchVectorField_H
00055 
00056 #include <OpenFOAM/pointPatchFields.H>
00057 #include <meshTools/searchableSurfaces.H>
00058 
00059 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00060 
00061 namespace Foam
00062 {
00063 
00064 /*---------------------------------------------------------------------------*\
00065           Class surfaceSlipDisplacementPointPatchVectorField Declaration
00066 \*---------------------------------------------------------------------------*/
00067 
00068 class surfaceSlipDisplacementPointPatchVectorField
00069 :
00070     public pointPatchVectorField
00071 {
00072 
00073 public:
00074 
00075     // Public data types
00076 
00077         enum projectMode
00078         {
00079             NEAREST,
00080             POINTNORMAL,
00081             FIXEDNORMAL
00082         };
00083 
00084 private:
00085 
00086     // Private data
00087 
00088         //- project mode names
00089         static const NamedEnum<projectMode, 3> projectModeNames_;
00090 
00091         //- names of surfaces
00092         const dictionary surfacesDict_;
00093 
00094         //- How to project/project onto surface
00095         const projectMode projectMode_;
00096 
00097         //- direction to project
00098         const vector projectDir_;
00099 
00100         //- plane for 2D wedge case or -1.
00101         const label wedgePlane_;
00102 
00103         //- pointZone with frozen points
00104         const word frozenPointsZone_;
00105 
00106         //- Demand driven: surface to project
00107         mutable autoPtr<searchableSurfaces> surfacesPtr_;
00108 
00109 
00110     // Private Member Functions
00111 
00112         //- Calculate displacement (w.r.t. points0()) to project onto surface
00113         void calcProjection(vectorField& displacement) const;
00114 
00115         //- Disallow default bitwise assignment
00116         void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
00117 
00118 
00119 public:
00120 
00121     //- Runtime type information
00122     TypeName("surfaceSlipDisplacement");
00123 
00124 
00125     // Constructors
00126 
00127         //- Construct from patch and internal field
00128         surfaceSlipDisplacementPointPatchVectorField
00129         (
00130             const pointPatch&,
00131             const DimensionedField<vector, pointMesh>&
00132         );
00133 
00134         //- Construct from patch, internal field and dictionary
00135         surfaceSlipDisplacementPointPatchVectorField
00136         (
00137             const pointPatch&,
00138             const DimensionedField<vector, pointMesh>&,
00139             const dictionary&
00140         );
00141 
00142         //- Construct by mapping given patchField<vector> onto a new patch
00143         surfaceSlipDisplacementPointPatchVectorField
00144         (
00145             const surfaceSlipDisplacementPointPatchVectorField&,
00146             const pointPatch&,
00147             const DimensionedField<vector, pointMesh>&,
00148             const pointPatchFieldMapper&
00149         );
00150 
00151         //- Construct as copy
00152         surfaceSlipDisplacementPointPatchVectorField
00153         (
00154             const surfaceSlipDisplacementPointPatchVectorField&
00155         );
00156 
00157         //- Construct and return a clone
00158         virtual autoPtr<pointPatchVectorField> clone() const
00159         {
00160             return autoPtr<pointPatchVectorField>
00161             (
00162                 new surfaceSlipDisplacementPointPatchVectorField
00163                 (
00164                     *this
00165                 )
00166             );
00167         }
00168 
00169         //- Construct as copy setting internal field reference
00170         surfaceSlipDisplacementPointPatchVectorField
00171         (
00172             const surfaceSlipDisplacementPointPatchVectorField&,
00173             const DimensionedField<vector, pointMesh>&
00174         );
00175 
00176         //- Construct and return a clone setting internal field reference
00177         virtual autoPtr<pointPatchVectorField> clone
00178         (
00179             const DimensionedField<vector, pointMesh>& iF
00180         ) const
00181         {
00182             return autoPtr<pointPatchVectorField>
00183             (
00184                 new surfaceSlipDisplacementPointPatchVectorField
00185                 (
00186                     *this,
00187                     iF
00188                 )
00189             );
00190         }
00191 
00192     // Member Functions
00193 
00194         //- Surface to follow. Demand loads surfaceNames.
00195         const searchableSurfaces& surfaces() const;
00196 
00197         //- Update the patch field
00198         virtual void evaluate
00199         (
00200             const Pstream::commsTypes commsType=Pstream::blocking
00201         );
00202 
00203         //- Write
00204         virtual void write(Ostream&) const;
00205 };
00206 
00207 
00208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00209 
00210 } // End namespace Foam
00211 
00212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00213 
00214 #endif
00215 
00216 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines