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

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