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  Copyright (C) 2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::surfaceSlipDisplacementPointPatchVectorField
29 
30 Description
31  Displacement follows a triSurface. Use in a displacementMotionSolver
32  as a bc on the pointDisplacement field.
33  Following is done by calculating the projection onto the surface according
34  to the projectMode
35  - NEAREST : nearest
36  - POINTNORMAL : intersection with point normal
37  - FIXEDNORMAL : intersection with fixed vector
38 
39  Optionally (intersection only) removes a component ("wedgePlane") to
40  stay in 2D.
41 
42  Needs:
43  - geometry : dictionary with searchableSurfaces. (usually
44  triSurfaceMeshes in constant/triSurface)
45  - projectMode : see above
46  - projectDirection : if projectMode = fixedNormal
47  - wedgePlane : -1 or component to knock out of intersection normal
48  - frozenPointsZone : empty or name of pointZone containing points
49  that do not move
50  - scale : optional scaling factor as PatchFunction1. Note that this
51  is only supported for polyPatch-derived pointPatches
52  ('facePointPatch') and not for stand-alone pointPatches.
53 
54 
55 SourceFiles
56  surfaceSlipDisplacementPointPatchVectorField.cxx
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef Foam_surfaceSlipDisplacementPointPatchVectorField_H
61 #define Foam_surfaceSlipDisplacementPointPatchVectorField_H
62 
63 #include "pointPatchFields.H"
64 #include "searchableSurfaces.H"
65 #include "PatchFunction1.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class surfaceSlipDisplacementPointPatchVectorField Declaration
74 \*---------------------------------------------------------------------------*/
75 
77 :
79 {
82 
83 public:
84 
85  // Public Data Types
86 
87  enum projectMode
88  {
89  NEAREST,
92  };
93 
94 private:
95 
96  // Private Data
97 
98  //- Project mode names
99  static const Enum<projectMode> projectModeNames_;
100 
101  //- Names of surfaces
102  const dictionary surfacesDict_;
103 
104  //- How to project/project onto surface
105  const projectMode projectMode_;
106 
107  //- Direction to project
108  const vector projectDir_;
109 
110  //- Plane for 2D wedge case or -1.
111  const label wedgePlane_;
112 
113  //- pointZone with frozen points
114  const word frozenPointsZone_;
115 
116  //- Scalar scale factor
118 
119  //- Demand driven: surface to project
120  mutable autoPtr<searchableSurfaces> surfacesPtr_;
121 
122 
123  // Private Member Functions
124 
125  //- Calculate displacement (w.r.t. points0()) to project onto surface
126  void calcProjection(vectorField& displacement) const;
127 
128 public:
129 
130  //- Runtime type information
131  TypeName("surfaceSlipDisplacement");
132 
133 
134  // Constructors
135 
136  //- Construct from patch and internal field
138  (
139  const pointPatch&,
141  );
142 
143  //- Construct from patch, internal field and dictionary
145  (
146  const pointPatch&,
148  const dictionary&
149  );
150 
151  //- Construct by mapping onto a new patch
153  (
154  const this_bctype&,
155  const pointPatch&,
157  const pointPatchFieldMapper&
158  );
159 
160  //- Copy construct with internal field reference
162  (
163  const this_bctype&,
165  );
166 
167  //- No copy without an internal field
169  (
170  const this_bctype&
171  ) = delete;
172 
173  //- Clone with an internal field reference
175  (
177  ) const
178  {
179  return pointPatchField<vector>::Clone(*this, iF);
180  }
181 
182 
183  // Member Functions
184 
185  //- Surface to follow. Demand loads surfaceNames.
186  const searchableSurfaces& surfaces() const;
187 
188  //- Update the coefficients associated with the patch field
189  virtual void updateCoeffs();
190 
191  //- Write
192  virtual void write(Ostream&) const;
193 
194 
195  // Member Operators
196 
197  //- No copy assignment
198  void operator=
199  (
201  ) = delete;
203  //- Inherit assignment
205 };
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
Displacement follows a triSurface. Use in a displacementMotionSolver as a bc on the pointDisplacement...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
Foam::pointPatchFieldMapper.
TypeName("surfaceSlipDisplacement")
Runtime type information.
virtual autoPtr< pointPatchField< Type > > clone() const
No clone without an internal field reference.
friend Ostream & operator(Ostream &, const pointPatchField< vector > &)
virtual void write(Ostream &) const
Write.
A class for handling words, derived from Foam::string.
Definition: word.H:63
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static autoPtr< pointPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
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: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
surfaceSlipDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.