Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / fvMotionSolver / pointPatchFields / derived / surfaceSlipDisplacement / surfaceSlipDisplacementPointPatchVectorField.H
blob456a31163d89a85e69515350d14fa09ee2e9389f
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::surfaceSlipDisplacementPointPatchVectorField
27 Description
28     Displacement follows a triSurface. Use in a displacement fvMotionSolver
29     as a bc on the pointDisplacement field.
30     Following is done by calculating the projection onto the surface according
31     to the projectMode
32     - NEAREST : nearest
33     - POINTNORMAL : intersection with point normal
34     - FIXEDNORMAL : intersection with fixed vector
36     Optionally (intersection only) removes a component ("wedgePlane") to
37     stay in 2D.
39     Needs:
40     - geometry : dictionary with searchableSurfaces. (usually
41       triSurfaceMeshes in constant/triSurface)
42     - projectMode : see above
43     - projectDirection : if projectMode = fixedNormal
44     - wedgePlane : -1 or component to knock out of intersection normal
45     - frozenPointsZone : empty or name of pointZone containing points
46                          that do not move
48 SourceFiles
49     surfaceSlipDisplacementPointPatchVectorField.C
51 \*---------------------------------------------------------------------------*/
53 #ifndef surfaceSlipDisplacementPointPatchVectorField_H
54 #define surfaceSlipDisplacementPointPatchVectorField_H
56 #include "pointPatchFields.H"
57 #include "searchableSurfaces.H"
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 namespace Foam
64 /*---------------------------------------------------------------------------*\
65           Class surfaceSlipDisplacementPointPatchVectorField Declaration
66 \*---------------------------------------------------------------------------*/
68 class surfaceSlipDisplacementPointPatchVectorField
70     public pointPatchVectorField
73 public:
75     // Public data types
77         enum projectMode
78         {
79             NEAREST,
80             POINTNORMAL,
81             FIXEDNORMAL
82         };
84 private:
86     // Private data
88         //- project mode names
89         static const NamedEnum<projectMode, 3> projectModeNames_;
91         //- names of surfaces
92         const dictionary surfacesDict_;
94         //- How to project/project onto surface
95         const projectMode projectMode_;
97         //- direction to project
98         const vector projectDir_;
100         //- plane for 2D wedge case or -1.
101         const label wedgePlane_;
103         //- pointZone with frozen points
104         const word frozenPointsZone_;
106         //- Demand driven: surface to project
107         mutable autoPtr<searchableSurfaces> surfacesPtr_;
110     // Private Member Functions
112         //- Calculate displacement (w.r.t. points0()) to project onto surface
113         void calcProjection(vectorField& displacement) const;
115         //- Disallow default bitwise assignment
116         void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
119 public:
121     //- Runtime type information
122     TypeName("surfaceSlipDisplacement");
125     // Constructors
127         //- Construct from patch and internal field
128         surfaceSlipDisplacementPointPatchVectorField
129         (
130             const pointPatch&,
131             const DimensionedField<vector, pointMesh>&
132         );
134         //- Construct from patch, internal field and dictionary
135         surfaceSlipDisplacementPointPatchVectorField
136         (
137             const pointPatch&,
138             const DimensionedField<vector, pointMesh>&,
139             const dictionary&
140         );
142         //- Construct by mapping given patchField<vector> onto a new patch
143         surfaceSlipDisplacementPointPatchVectorField
144         (
145             const surfaceSlipDisplacementPointPatchVectorField&,
146             const pointPatch&,
147             const DimensionedField<vector, pointMesh>&,
148             const pointPatchFieldMapper&
149         );
151         //- Construct as copy
152         surfaceSlipDisplacementPointPatchVectorField
153         (
154             const surfaceSlipDisplacementPointPatchVectorField&
155         );
157         //- Construct and return a clone
158         virtual autoPtr<pointPatchVectorField> clone() const
159         {
160             return autoPtr<pointPatchVectorField>
161             (
162                 new surfaceSlipDisplacementPointPatchVectorField
163                 (
164                     *this
165                 )
166             );
167         }
169         //- Construct as copy setting internal field reference
170         surfaceSlipDisplacementPointPatchVectorField
171         (
172             const surfaceSlipDisplacementPointPatchVectorField&,
173             const DimensionedField<vector, pointMesh>&
174         );
176         //- Construct and return a clone setting internal field reference
177         virtual autoPtr<pointPatchVectorField> clone
178         (
179             const DimensionedField<vector, pointMesh>& iF
180         ) const
181         {
182             return autoPtr<pointPatchVectorField>
183             (
184                 new surfaceSlipDisplacementPointPatchVectorField
185                 (
186                     *this,
187                     iF
188                 )
189             );
190         }
192     // Member Functions
194         //- Surface to follow. Demand loads surfaceNames.
195         const searchableSurfaces& surfaces() const;
197         //- Update the patch field
198         virtual void evaluate
199         (
200             const Pstream::commsTypes commsType=Pstream::blocking
201         );
203         //- Write
204         virtual void write(Ostream&) const;
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 } // End namespace Foam
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 #endif
216 // ************************************************************************* //