surfaceDisplacementPointPatchVectorField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::surfaceDisplacementPointPatchVectorField
28 
29 Description
30  Displacement fixed by projection onto triSurface.
31  Use in a displacementMotionSolver
32  as a bc on the pointDisplacement field.
33 
34  Calculates the projection onto the surface according
35  to the projectMode
36  - NEAREST : nearest
37  - POINTNORMAL : intersection with point normal
38  - FIXEDNORMAL : intersection with fixed vector
39 
40  This displacement is then clipped with the specified velocity * deltaT.
41 
42  Optionally (intersection only) removes a component ("wedgePlane") to
43  stay in 2D.
44 
45  Needs:
46  - geometry : dictionary with searchableSurfaces. (usually
47  triSurfaceMeshes in constant/triSurface)
48  - projectMode : see above
49  - projectDirection : if projectMode = fixedNormal
50  - wedgePlane : -1 or component to knock out of intersection normal
51  - frozenPointsZone : empty or name of pointZone containing points
52  that do not move
53 
54 SourceFiles
55  surfaceDisplacementPointPatchVectorField.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef surfaceDisplacementPointPatchVectorField_H
60 #define surfaceDisplacementPointPatchVectorField_H
61 
62 #include "pointPatchFields.H"
64 #include "searchableSurfaces.H"
65 #include "Enum.H"
66 #include "Switch.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class surfaceDisplacementPointPatchVectorField Declaration
75 \*---------------------------------------------------------------------------*/
76 
78 :
79  public fixedValuePointPatchVectorField
80 {
81 
82 public:
83 
84  // Public data types
85 
86  enum projectMode
87  {
88  NEAREST,
91  };
92 
93 private:
94 
95  // Private data
96 
97  //- Project mode names
98  static const Enum<projectMode> projectModeNames_;
99 
100  //- Maximum velocity
101  const vector velocity_;
102 
103  //- Names of surfaces
104  const dictionary surfacesDict_;
105 
106  //- How to project/project onto surface
107  const projectMode projectMode_;
108 
109  //- Direction to project
110  const vector projectDir_;
111 
112  //- Plane for 2D wedge case or -1.
113  const label wedgePlane_;
114 
115  //- Name of pointZone with frozen points
116  const word frozenPointsZone_;
117 
118  //- Demand driven: surface to project
119  mutable autoPtr<searchableSurfaces> surfacesPtr_;
120 
121 
122  // Private Member Functions
123 
124  //- Calculate displacement (w.r.t. points0()) to project onto surface
125  void calcProjection(vectorField& displacement) const;
126 
127  //- No copy assignment
128  void operator=
129  (
131  ) = delete;
132 
133 
134 public:
135 
136  //- Runtime type information
137  TypeName("surfaceDisplacement");
138 
139 
140  // Constructors
141 
142  //- Construct from patch and internal field
144  (
145  const pointPatch&,
147  );
148 
149  //- Construct from patch, internal field and dictionary
151  (
152  const pointPatch&,
154  const dictionary&
155  );
156 
157  //- Construct by mapping given patch field onto a new patch
159  (
161  const pointPatch&,
163  const pointPatchFieldMapper&
164  );
165 
166  //- Construct as copy
168  (
170  );
171 
172  //- Construct as copy setting internal field reference
174  (
177  );
178 
179  //- Return a clone
180  virtual autoPtr<pointPatchField<vector>> clone() const
181  {
182  return pointPatchField<vector>::Clone(*this);
183  }
184 
185  //- Construct and return a clone setting internal field reference
186  virtual autoPtr<pointPatchField<vector>> clone
187  (
188  const DimensionedField<vector, pointMesh>& iF
189  ) const
190  {
191  return pointPatchField<vector>::Clone(*this, iF);
192  }
193 
194 
195  // Member Functions
196 
197  //- Surface to follow. Demand loads surfaceNames.
198  const searchableSurfaces& surfaces() const;
199 
200  //- Update the coefficients associated with the patch field
201  virtual void updateCoeffs();
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
TypeName("surfaceDisplacement")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual autoPtr< pointPatchField< vector > > clone() const
Return a clone.
Foam::pointPatchFieldMapper.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
A class for handling words, derived from Foam::string.
Definition: word.H:63
static autoPtr< pointPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:61
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Namespace for OpenFOAM.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.