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.cxx
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef Foam_surfaceDisplacementPointPatchVectorField_H
60 #define Foam_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 {
82  typedef fixedValuePointPatchVectorField parent_bctype;
83 
84 public:
85 
86  // Public data types
87 
88  enum projectMode
89  {
90  NEAREST,
93  };
94 
95 private:
96 
97  // Private Data
98 
99  //- Project mode names
100  static const Enum<projectMode> projectModeNames_;
101 
102  //- Maximum velocity
103  const vector velocity_;
104 
105  //- Names of surfaces
106  const dictionary surfacesDict_;
107 
108  //- How to project/project onto surface
109  const projectMode projectMode_;
110 
111  //- Direction to project
112  const vector projectDir_;
113 
114  //- Plane for 2D wedge case or -1.
115  const label wedgePlane_;
116 
117  //- Name of pointZone with frozen points
118  const word frozenPointsZone_;
119 
120  //- Demand driven: surface to project
121  mutable autoPtr<searchableSurfaces> surfacesPtr_;
122 
123 
124  // Private Member Functions
125 
126  //- Calculate displacement (w.r.t. points0()) to project onto surface
127  void calcProjection(vectorField& displacement) const;
128 
129 public:
130 
131  //- Runtime type information
132  TypeName("surfaceDisplacement");
133 
134 
135  // Constructors
136 
137  //- Construct from patch and internal field
139  (
140  const pointPatch&,
142  );
143 
144  //- Construct from patch, internal field and dictionary
146  (
147  const pointPatch&,
149  const dictionary&
150  );
151 
152  //- Construct by mapping onto a new patch
154  (
155  const this_bctype&,
156  const pointPatch&,
158  const pointPatchFieldMapper&
159  );
160 
161  //- Construct as copy setting internal field reference
163  (
164  const this_bctype&,
166  );
167 
168  //- No copy without an internal field
169  surfaceDisplacementPointPatchVectorField(const this_bctype&) = delete;
170 
171  //- Clone with an internal field reference
173  (
175  ) const
176  {
177  return pointPatchField<vector>::Clone(*this, iF);
178  }
179 
180 
181  // Member Functions
182 
183  //- Surface to follow. Demand loads surfaceNames.
184  const searchableSurfaces& surfaces() const;
185 
186  //- Update the coefficients associated with the patch field
187  virtual void updateCoeffs();
188 
189  //- Write
190  virtual void write(Ostream&) const;
191 
192 
193  // Member Operators
194 
195  //- No copy assignment
196  void operator=
197  (
199  ) = delete;
201  //- Inherit assignment
202  using parent_bctype::operator=;
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
virtual autoPtr< pointPatchField< vector > > clone(const DimensionedField< vector, pointMesh > &iF) const
Clone with an internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("surfaceDisplacement")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
Foam::pointPatchFieldMapper.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
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...
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:64
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.