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-2020 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 public:
79 
80  // Public data types
81 
82  enum projectMode
83  {
87  };
88 
89 private:
90 
91  // Private Data
92 
93  //- Project mode names
94  static const NamedEnum<projectMode, 3> projectModeNames_;
95 
96  //- Maximum velocity
97  const vector velocity_;
98 
99  //- Names of surfaces
100  const dictionary surfacesDict_;
101 
102  //- How to project/project onto surface
103  const projectMode projectMode_;
104 
105  //- Direction to project
106  const vector projectDir_;
107 
108  //- Plane for 2D wedge case or -1.
109  const label wedgePlane_;
110 
111  //- pointZone with frozen points
112  const word frozenPointsZone_;
113 
114  //- Demand driven: surface to project
115  mutable autoPtr<searchableSurfaces> surfacesPtr_;
116 
117 
118  // Private Member Functions
119 
120  //- Calculate displacement (w.r.t. points0()) to project onto surface
121  void calcProjection(vectorField& displacement) const;
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("surfaceDisplacement");
128 
129 
130  // Constructors
131 
132  //- Construct from patch and internal field
134  (
135  const pointPatch&,
137  );
138 
139  //- Construct from patch, internal field and dictionary
141  (
142  const pointPatch&,
144  const dictionary&
145  );
146 
147  //- Construct by mapping given patchField<vector> onto a new patch
149  (
151  const pointPatch&,
153  const pointPatchFieldMapper&
154  );
155 
156  //- Disallow copy without setting internal field reference
158  (
160  ) = delete;
161 
162  //- Copy constructor setting internal field reference
164  (
167  );
168 
169  //- Construct and return a clone setting internal field reference
171  (
173  ) const
174  {
176  (
178  (
179  *this,
180  iF
181  )
182  );
183  }
184 
185  // Member Functions
186 
187  //- Surface to follow. Demand loads surfaceNames.
188  const searchableSurfaces& surfaces() const;
189 
190  //- Update the coefficients associated with the patch field
191  virtual void updateCoeffs();
192 
193  //- Write
194  virtual void write(Ostream&) const;
195 
196 
197  // Member Operators
198 
199  //- Disallow default bitwise assignment
200  void operator=
201  (
203  ) = delete;
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
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:156
virtual autoPtr< pointPatchVectorField > clone(const DimensionedField< vector, pointMesh > &iF) const
Construct and return a clone setting internal field reference.
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:54
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
Namespace for OpenFOAM.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.