surfaceDisplacementPointPatchVectorField.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-2018 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::surfaceDisplacementPointPatchVectorField
26 
27 Description
28  Displacement fixed by projection onto triSurface.
29  Use in a displacementMotionSolver
30  as a bc on the pointDisplacement field.
31 
32  Calculates the projection onto the surface according
33  to the projectMode
34  - NEAREST : nearest
35  - POINTNORMAL : intersection with point normal
36  - FIXEDNORMAL : intersection with fixed vector
37 
38  This displacement is then clipped with the specified velocity * deltaT.
39 
40  Optionally (intersection only) removes a component ("wedgePlane") to
41  stay in 2D.
42 
43  Needs:
44  - geometry : dictionary with searchableSurfaces. (usually
45  triSurfaceMeshes in constant/triSurface)
46  - projectMode : see above
47  - projectDirection : if projectMode = fixedNormal
48  - wedgePlane : -1 or component to knock out of intersection normal
49  - frozenPointsZone : empty or name of pointZone containing points
50  that do not move
51 
52 SourceFiles
53  surfaceDisplacementPointPatchVectorField.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef surfaceDisplacementPointPatchVectorField_H
58 #define surfaceDisplacementPointPatchVectorField_H
59 
60 #include "pointPatchFields.H"
62 #include "searchableSurfaces.H"
63 #include "Switch.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class surfaceDisplacementPointPatchVectorField Declaration
72 \*---------------------------------------------------------------------------*/
73 
75 :
76  public fixedValuePointPatchVectorField
77 {
78 
79 public:
80 
81  // Public data types
82 
83  enum projectMode
84  {
88  };
89 
90 private:
91 
92  // Private data
93 
94  //- Project mode names
95  static const NamedEnum<projectMode, 3> projectModeNames_;
96 
97  //- Maximum velocity
98  const vector velocity_;
99 
100  //- Names of surfaces
101  const dictionary surfacesDict_;
102 
103  //- How to project/project onto surface
104  const projectMode projectMode_;
105 
106  //- Direction to project
107  const vector projectDir_;
108 
109  //- Plane for 2D wedge case or -1.
110  const label wedgePlane_;
111 
112  //- pointZone with frozen points
113  const word frozenPointsZone_;
114 
115  //- Demand driven: surface to project
116  mutable autoPtr<searchableSurfaces> surfacesPtr_;
117 
118 
119  // Private Member Functions
120 
121  //- Calculate displacement (w.r.t. points0()) to project onto surface
122  void calcProjection(vectorField& displacement) const;
123 
124 
125  //- Disallow default bitwise assignment
126  void operator=(const surfaceDisplacementPointPatchVectorField&);
127 
128 public:
129 
130  //- Runtime type information
131  TypeName("surfaceDisplacement");
132 
133 
134  // Constructors
135 
136  //- Construct from patch and internal field
138  (
139  const pointPatch&,
141  );
142 
143  //- Construct from patch, internal field and dictionary
145  (
146  const pointPatch&,
148  const dictionary&
149  );
150 
151  //- Construct by mapping given patchField<vector> onto a new patch
153  (
155  const pointPatch&,
157  const pointPatchFieldMapper&
158  );
159 
160  //- Construct as copy
162  (
164  );
165 
166  //- Construct and return a clone
167  virtual autoPtr<pointPatchVectorField> clone() const
168  {
170  (
172  (
173  *this
174  )
175  );
176  }
177 
178  //- Construct as copy setting internal field reference
180  (
183  );
184 
185  //- Construct and return a clone setting internal field reference
187  (
189  ) const
190  {
192  (
194  (
195  *this,
196  iF
197  )
198  );
199  }
200 
201  // Member Functions
202 
203  //- Surface to follow. Demand loads surfaceNames.
204  const searchableSurfaces& surfaces() const;
205 
206  //- Update the coefficients associated with the patch field
207  virtual void updateCoeffs();
208 
209  //- Write
210  virtual void write(Ostream&) const;
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
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
TypeName("surfaceDisplacement")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Foam::pointPatchFieldMapper.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
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.
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
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
virtual autoPtr< pointPatchVectorField > clone() const
Construct and return a clone.
Namespace for OpenFOAM.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.