initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / fvMotionSolver / pointPatchFields / derived / surfaceSlipDisplacement / surfaceSlipDisplacementPointPatchVectorField.H
blob2b2b89819fd98faeefb5ad658c75813273fa59e2
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::surfaceSlipDisplacementPointPatchVectorField
28 Description
29     Displacement follows a triSurface. Use in a displacement fvMotionSolver
30     as a bc on the pointDisplacement field.
31     Following is done by calculating the projection onto the surface according
32     to the projectMode
33     - NEAREST : nearest
34     - POINTNORMAL : intersection with point normal
35     - FIXEDNORMAL : intersection with fixed vector
37     Optionally (intersection only) removes a component ("wedgePlane") to
38     stay in 2D.
40     Needs:
41     - geometry : dictionary with searchableSurfaces. (usually
42       triSurfaceMeshes in constant/triSurface)
43     - projectMode : see above
44     - projectDirection : if projectMode = fixedNormal
45     - wedgePlane : -1 or component to knock out of intersection normal
46     - frozenPointsZone : empty or name of pointZone containing points
47                          that do not move
49 SourceFiles
50     surfaceSlipDisplacementPointPatchVectorField.C
52 \*---------------------------------------------------------------------------*/
54 #ifndef surfaceSlipDisplacementPointPatchVectorField_H
55 #define surfaceSlipDisplacementPointPatchVectorField_H
57 #include "pointPatchFields.H"
58 #include "searchableSurfaces.H"
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 namespace Foam
65 /*---------------------------------------------------------------------------*\
66           Class surfaceSlipDisplacementPointPatchVectorField Declaration
67 \*---------------------------------------------------------------------------*/
69 class surfaceSlipDisplacementPointPatchVectorField
71     public pointPatchVectorField
74 public:
76     // Public data types
78         enum projectMode
79         {
80             NEAREST,
81             POINTNORMAL,
82             FIXEDNORMAL
83         };
85 private:
87     // Private data
89         //- project mode names
90         static const NamedEnum<projectMode, 3> projectModeNames_;
92         //- names of surfaces
93         const dictionary surfacesDict_;
95         //- How to project/project onto surface
96         const projectMode projectMode_;
98         //- direction to project
99         const vector projectDir_;
101         //- plane for 2D wedge case or -1.
102         const label wedgePlane_;
104         //- pointZone with frozen points
105         const word frozenPointsZone_;
107         //- Demand driven: surface to project
108         mutable autoPtr<searchableSurfaces> surfacesPtr_;
111     // Private Member Functions
113         //- Calculate displacement (w.r.t. points0()) to project onto surface
114         void calcProjection(vectorField& displacement) const;
116         //- Disallow default bitwise assignment
117         void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
120 public:
122     //- Runtime type information
123     TypeName("surfaceSlipDisplacement");
126     // Constructors
128         //- Construct from patch and internal field
129         surfaceSlipDisplacementPointPatchVectorField
130         (
131             const pointPatch&,
132             const DimensionedField<vector, pointMesh>&
133         );
135         //- Construct from patch, internal field and dictionary
136         surfaceSlipDisplacementPointPatchVectorField
137         (
138             const pointPatch&,
139             const DimensionedField<vector, pointMesh>&,
140             const dictionary&
141         );
143         //- Construct by mapping given patchField<vector> onto a new patch
144         surfaceSlipDisplacementPointPatchVectorField
145         (
146             const surfaceSlipDisplacementPointPatchVectorField&,
147             const pointPatch&,
148             const DimensionedField<vector, pointMesh>&,
149             const pointPatchFieldMapper&
150         );
152         //- Construct as copy
153         surfaceSlipDisplacementPointPatchVectorField
154         (
155             const surfaceSlipDisplacementPointPatchVectorField&
156         );
158         //- Construct and return a clone
159         virtual autoPtr<pointPatchVectorField> clone() const
160         {
161             return autoPtr<pointPatchVectorField>
162             (
163                 new surfaceSlipDisplacementPointPatchVectorField
164                 (
165                     *this
166                 )
167             );
168         }
170         //- Construct as copy setting internal field reference
171         surfaceSlipDisplacementPointPatchVectorField
172         (
173             const surfaceSlipDisplacementPointPatchVectorField&,
174             const DimensionedField<vector, pointMesh>&
175         );
177         //- Construct and return a clone setting internal field reference
178         virtual autoPtr<pointPatchVectorField> clone
179         (
180             const DimensionedField<vector, pointMesh>& iF
181         ) const
182         {
183             return autoPtr<pointPatchVectorField>
184             (
185                 new surfaceSlipDisplacementPointPatchVectorField
186                 (
187                     *this,
188                     iF
189                 )
190             );
191         }
193     // Member Functions
195         //- Surface to follow. Demand loads surfaceNames.
196         const searchableSurfaces& surfaces() const;
198         //- Update the patch field
199         virtual void evaluate
200         (
201             const Pstream::commsTypes commsType=Pstream::blocking
202         );
204         //- Write
205         virtual void write(Ostream&) const;
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 } // End namespace Foam
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 #endif
217 // ************************************************************************* //