OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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