surfaceSlipDisplacementPointPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::surfaceSlipDisplacementPointPatchVectorField
26 
27 Description
28  Displacement follows a triSurface. Use in a displacementMotionSolver
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
35 
36  Optionally (intersection only) removes a component ("wedgePlane") to
37  stay in 2D.
38 
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
47 
48 SourceFiles
49  surfaceSlipDisplacementPointPatchVectorField.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef surfaceSlipDisplacementPointPatchVectorField_H
54 #define surfaceSlipDisplacementPointPatchVectorField_H
55 
56 #include "pointPatchFields.H"
57 #include "searchableSurfaces.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class surfaceSlipDisplacementPointPatchVectorField Declaration
66 \*---------------------------------------------------------------------------*/
67 
69 :
71 {
72 
73 public:
74 
75  // Public data types
76 
77  enum projectMode
78  {
82  };
83 
84 private:
85 
86  // Private data
87 
88  //- Project mode names
89  static const NamedEnum<projectMode, 3> projectModeNames_;
90 
91  //- Names of surfaces
92  const dictionary surfacesDict_;
93 
94  //- How to project/project onto surface
95  const projectMode projectMode_;
96 
97  //- Direction to project
98  const vector projectDir_;
99 
100  //- Plane for 2D wedge case or -1.
101  const label wedgePlane_;
102 
103  //- pointZone with frozen points
104  const word frozenPointsZone_;
105 
106  //- Demand driven: surface to project
107  mutable autoPtr<searchableSurfaces> surfacesPtr_;
108 
109 
110  // Private Member Functions
111 
112  //- Calculate displacement (w.r.t. points0()) to project onto surface
113  void calcProjection(vectorField& displacement) const;
114 
115  //- Disallow default bitwise assignment
116  void operator=(const surfaceSlipDisplacementPointPatchVectorField&);
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("surfaceSlipDisplacement");
123 
124 
125  // Constructors
126 
127  //- Construct from patch and internal field
129  (
130  const pointPatch&,
132  );
133 
134  //- Construct from patch, internal field and dictionary
136  (
137  const pointPatch&,
139  const dictionary&
140  );
141 
142  //- Construct by mapping given patchField<vector> onto a new patch
144  (
146  const pointPatch&,
148  const pointPatchFieldMapper&
149  );
150 
151  //- Construct as copy
153  (
155  );
156 
157  //- Construct and return a clone
158  virtual autoPtr<pointPatchVectorField> clone() const
159  {
161  (
163  (
164  *this
165  )
166  );
167  }
168 
169  //- Construct as copy setting internal field reference
171  (
174  );
175 
176  //- Construct and return a clone setting internal field reference
178  (
180  ) const
181  {
183  (
185  (
186  *this,
187  iF
188  )
189  );
190  }
191 
192  // Member Functions
193 
194  //- Surface to follow. Demand loads surfaceNames.
195  const searchableSurfaces& surfaces() const;
196 
197  //- Update the patch field
198  virtual void evaluate
199  (
200  const Pstream::commsTypes commsType=Pstream::blocking
201  );
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Displacement follows a triSurface. Use in a displacementMotionSolver as a bc on the pointDisplacement...
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
commsTypes
Types of communications.
Definition: UPstream.H:64
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::blocking)
Update the patch field.
Foam::pointPatchFieldMapper.
TypeName("surfaceSlipDisplacement")
Runtime type information.
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
A class for handling words, derived from string.
Definition: word.H:59
Container for searchableSurfaces.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual autoPtr< pointPatchVectorField > clone() const
Construct and return a clone.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:56
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
surfaceSlipDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.