surfaceSlipDisplacementPointPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 public:
73 
74  // Public data types
75 
76  enum projectMode
77  {
81  };
82 
83 private:
84 
85  // Private Data
86 
87  //- Project mode names
88  static const NamedEnum<projectMode, 3> projectModeNames_;
89 
90  //- Names of surfaces
91  const dictionary surfacesDict_;
92 
93  //- How to project/project onto surface
94  const projectMode projectMode_;
95 
96  //- Direction to project
97  const vector projectDir_;
98 
99  //- Plane for 2D wedge case or -1.
100  const label wedgePlane_;
101 
102  //- pointZone with frozen points
103  const word frozenPointsZone_;
104 
105  //- Demand driven: surface to project
106  mutable autoPtr<searchableSurfaces> surfacesPtr_;
107 
108 
109  // Private Member Functions
110 
111  //- Calculate displacement (w.r.t. points0()) to project onto surface
112  void calcProjection(vectorField& displacement) const;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("surfaceSlipDisplacement");
119 
120 
121  // Constructors
122 
123  //- Construct from patch and internal field
125  (
126  const pointPatch&,
128  );
129 
130  //- Construct from patch, internal field and dictionary
132  (
133  const pointPatch&,
135  const dictionary&
136  );
137 
138  //- Construct by mapping given patchField<vector> onto a new patch
140  (
142  const pointPatch&,
144  const pointPatchFieldMapper&
145  );
146 
147  //- Copy constructor
149  (
151  );
152 
153  //- Construct and return a clone
154  virtual autoPtr<pointPatchVectorField> clone() const
155  {
157  (
159  (
160  *this
161  )
162  );
163  }
164 
165  //- Copy constructor setting internal field reference
167  (
170  );
171 
172  //- Construct and return a clone setting internal field reference
174  (
176  ) const
177  {
179  (
181  (
182  *this,
183  iF
184  )
185  );
186  }
187 
188  // Member Functions
189 
190  //- Surface to follow. Demand loads surfaceNames.
191  const searchableSurfaces& surfaces() const;
192 
193  //- Update the patch field
194  virtual void evaluate
195  (
197  );
198 
199  //- Write
200  virtual void write(Ostream&) const;
201 
202 
203  // Member Operators
204 
205  //- Disallow default bitwise assignment
206  void operator=
207  (
208  const surfaceSlipDisplacementPointPatchVectorField&
209  ) = delete;
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
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:158
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Update the patch field.
commsTypes
Types of communications.
Definition: UPstream.H:64
Foam::pointPatchFieldMapper.
TypeName("surfaceSlipDisplacement")
Runtime type information.
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:54
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
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:52
surfaceSlipDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.