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-2023 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, internal field and dictionary
134  (
135  const pointPatch&,
137  const dictionary&
138  );
139 
140  //- Construct by mapping given patchField<vector> onto a new patch
142  (
144  const pointPatch&,
146  const pointPatchFieldMapper&
147  );
148 
149  //- Disallow copy without setting internal field reference
151  (
153  ) = delete;
154 
155  //- Copy constructor setting internal field reference
157  (
160  );
161 
162  //- Construct and return a clone setting internal field reference
164  (
166  ) const
167  {
169  (
171  (
172  *this,
173  iF
174  )
175  );
176  }
177 
178  // Member Functions
179 
180  //- Surface to follow. Demand loads surfaceNames.
181  const searchableSurfaces& surfaces() const;
182 
183  //- Update the coefficients associated with the patch field
184  virtual void updateCoeffs();
185 
186  //- Write
187  virtual void write(Ostream&) const;
188 
189 
190  // Member Operators
191 
192  //- Disallow default bitwise assignment
193  void operator=
194  (
196  ) = delete;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::pointPatchFieldMapper.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:57
Container for searchableSurfaces.
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
TypeName("surfaceDisplacement")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual autoPtr< pointPatchVectorField > clone(const DimensionedField< vector, pointMesh > &iF) const
Construct and return a clone setting internal field reference.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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