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
51 
52 
53 SourceFiles
54  surfaceSlipDisplacementPointPatchVectorField.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef surfaceSlipDisplacementPointPatchVectorField_H
59 #define surfaceSlipDisplacementPointPatchVectorField_H
60 
61 #include "pointPatchFields.H"
62 #include "searchableSurfaces.H"
63 #include "PatchFunction1.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class surfaceSlipDisplacementPointPatchVectorField Declaration
72 \*---------------------------------------------------------------------------*/
73 
75 :
77 {
78 
79 public:
80 
81  // Public data types
82 
83  enum projectMode
84  {
85  NEAREST,
88  };
89 
90 private:
91 
92  // Private data
93 
94  //- Project mode names
95  static const Enum<projectMode> projectModeNames_;
96 
97  //- Names of surfaces
98  const dictionary surfacesDict_;
99 
100  //- How to project/project onto surface
101  const projectMode projectMode_;
102 
103  //- Direction to project
104  const vector projectDir_;
105 
106  //- Plane for 2D wedge case or -1.
107  const label wedgePlane_;
108 
109  //- pointZone with frozen points
110  const word frozenPointsZone_;
111 
112  //- Scalar scale factor
114 
115  //- Demand driven: surface to project
116  mutable autoPtr<searchableSurfaces> surfacesPtr_;
117 
118 
119  // Private Member Functions
120 
121  //- Calculate displacement (w.r.t. points0()) to project onto surface
122  void calcProjection(vectorField& displacement) const;
123 
124  //- No copy assignment
125  void operator=
126  (
128  ) = delete;
129 
130 
131 public:
132 
133  //- Runtime type information
134  TypeName("surfaceSlipDisplacement");
135 
136 
137  // Constructors
138 
139  //- Construct from patch and internal field
141  (
142  const pointPatch&,
144  );
145 
146  //- Construct from patch, internal field and dictionary
148  (
149  const pointPatch&,
151  const dictionary&
152  );
153 
154  //- Construct by mapping given patch field onto a new patch
156  (
158  const pointPatch&,
160  const pointPatchFieldMapper&
161  );
162 
163  //- Construct as copy
165  (
167  );
168 
169  //- Construct as copy setting internal field reference
171  (
174  );
175 
176  //- Return a clone
177  virtual autoPtr<pointPatchField<vector>> clone() const
178  {
179  return pointPatchField<vector>::Clone(*this);
180  }
181 
182  //- Construct and return a clone setting internal field reference
183  virtual autoPtr<pointPatchField<vector>> clone
184  (
185  const DimensionedField<vector, pointMesh>& iF
186  ) const
187  {
188  return pointPatchField<vector>::Clone(*this, iF);
189  }
190 
191 
192  // Member Functions
193 
194  //- Surface to follow. Demand loads surfaceNames.
195  const searchableSurfaces& surfaces() const;
196 
197  //- Update the coefficients associated with the patch field
198  virtual void updateCoeffs();
199 
200  //- Write
201  virtual void write(Ostream&) const;
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
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: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 autoPtr< pointPatchField< vector > > clone() const
Return a clone.
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
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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.