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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 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::surfaceSlipDisplacementPointPatchVectorField
28 
29 Description
30  Displacement follows a triSurface. Use in a displacementMotionSolver
31  as a bc on the pointDisplacement field.
32  Following is done by calculating 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  Optionally (intersection only) removes a component ("wedgePlane") to
39  stay in 2D.
40 
41  Needs:
42  - geometry : dictionary with searchableSurfaces. (usually
43  triSurfaceMeshes in constant/triSurface)
44  - projectMode : see above
45  - projectDirection : if projectMode = fixedNormal
46  - wedgePlane : -1 or component to knock out of intersection normal
47  - frozenPointsZone : empty or name of pointZone containing points
48  that do not move
49 
50 SourceFiles
51  surfaceSlipDisplacementPointPatchVectorField.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef surfaceSlipDisplacementPointPatchVectorField_H
56 #define surfaceSlipDisplacementPointPatchVectorField_H
57 
58 #include "pointPatchFields.H"
59 #include "searchableSurfaces.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class surfaceSlipDisplacementPointPatchVectorField Declaration
68 \*---------------------------------------------------------------------------*/
69 
71 :
73 {
74 
75 public:
76 
77  // Public data types
78 
79  enum projectMode
80  {
81  NEAREST,
84  };
85 
86 private:
87 
88  // Private data
89 
90  //- Project mode names
91  static const Enum<projectMode> projectModeNames_;
92 
93  //- Names of surfaces
94  const dictionary surfacesDict_;
95 
96  //- How to project/project onto surface
97  const projectMode projectMode_;
98 
99  //- Direction to project
100  const vector projectDir_;
101 
102  //- Plane for 2D wedge case or -1.
103  const label wedgePlane_;
104 
105  //- pointZone with frozen points
106  const word frozenPointsZone_;
107 
108  //- Demand driven: surface to project
109  mutable autoPtr<searchableSurfaces> surfacesPtr_;
110 
111 
112  // Private Member Functions
113 
114  //- Calculate displacement (w.r.t. points0()) to project onto surface
115  void calcProjection(vectorField& displacement) const;
116 
117  //- No copy assignment
118  void operator=
119  (
121  ) = delete;
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("surfaceSlipDisplacement");
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 patch field onto a new patch
149  (
151  const pointPatch&,
153  const pointPatchFieldMapper&
154  );
155 
156  //- Construct as copy
158  (
160  );
161 
162  //- Construct and return a clone
163  virtual autoPtr<pointPatchVectorField> clone() const
164  {
166  (
168  (
169  *this
170  )
171  );
172  }
173 
174  //- Construct as copy setting internal field reference
176  (
178  const DimensionedField<vector, pointMesh>&
179  );
180 
181  //- Construct and return a clone setting internal field reference
182  virtual autoPtr<pointPatchVectorField> clone
183  (
184  const DimensionedField<vector, pointMesh>& iF
185  ) const
186  {
187  return autoPtr<pointPatchVectorField>
188  (
190  (
191  *this,
192  iF
193  )
194  );
195  }
196 
197  // Member Functions
198 
199  //- Surface to follow. Demand loads surfaceNames.
200  const searchableSurfaces& surfaces() const;
201 
202  //- Update the patch field
203  virtual void evaluate
204  (
206  );
207 
208  //- Write
209  virtual void write(Ostream&) const;
210 };
211 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
"blocking" : (MPI_Bsend, MPI_Recv)
Displacement follows a triSurface. Use in a displacementMotionSolver as a bc on the pointDisplacement...
commsTypes
Communications types.
Definition: UPstream.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Update the patch field.
Foam::pointPatchFieldMapper.
TypeName("surfaceSlipDisplacement")
Runtime type information.
A class for handling words, derived from Foam::string.
Definition: word.H:63
Container for searchableSurfaces. The collection is specified as a dictionary. For example...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual autoPtr< pointPatchVectorField > clone() const
Construct and return a clone.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:61
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
surfaceSlipDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.