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 as copy setting internal field reference
164  (
167  );
168 
169  //- Return a clone
170  virtual autoPtr<pointPatchField<vector>> clone() const
171  {
172  return pointPatchField<vector>::Clone(*this);
173  }
174 
175  //- Construct and return a clone setting internal field reference
176  virtual autoPtr<pointPatchField<vector>> clone
177  (
178  const DimensionedField<vector, pointMesh>& iF
179  ) const
180  {
181  return pointPatchField<vector>::Clone(*this, iF);
182  }
183 
184 
185  // Member Functions
186 
187  //- Surface to follow. Demand loads surfaceNames.
188  const searchableSurfaces& surfaces() const;
189 
190  //- Update the patch field
191  virtual void evaluate
192  (
194  );
195 
196  //- Write
197  virtual void write(Ostream&) const;
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 #endif
208 
209 // ************************************************************************* //
Displacement follows a triSurface. Use in a displacementMotionSolver as a bc on the pointDisplacement...
commsTypes
Communications types.
Definition: UPstream.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Foam::pointPatchFieldMapper.
TypeName("surfaceSlipDisplacement")
Runtime type information.
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.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Update the patch field.
virtual autoPtr< pointPatchField< vector > > clone() const
Return a clone.
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...
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...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
"buffered" : (MPI_Bsend, MPI_Recv)
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.