pointAttractionDisplacementPointPatchVectorField.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) 2024 OpenCFD Ltd.
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::pointAttractionDisplacementPointPatchVectorField
28 
29 Description
30  Displacement by attraction to nearest point. Use in a
31  displacementMotionSolver as a bc on the pointDisplacement field.
32 
33  Needs:
34  - file : name of edgeMesh. Either:
35  - .extendedFeatureEdgeMesh (read from constant/extendedFeatureEdgeMesh)
36  - or .eMesh in or a known format (read from constant/triSurface)
37  - frozenPointsZone : empty or name of pointZone containing points
38  that do not move
39  - velocity : maximum displacement velocity
40 
41 
42 SourceFiles
43  pointAttractionDisplacementPointPatchVectorField.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef pointAttractionDisplacementPointPatchVectorField_H
48 #define pointAttractionDisplacementPointPatchVectorField_H
49 
50 #include "pointPatchFields.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class pointAttractionDisplacementPointPatchVectorField Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 :
65 {
66 private:
67 
68  // Private data
69 
70  //- Maximum velocity
71  const vector velocity_;
72 
73  //- file
74  const fileName featFileName_;
75 
76  //- pointZone with frozen points
77  const word frozenPointsZone_;
78 
79  //- Point searching
80  mutable autoPtr<indexedOctree<treeDataPoint>> pointTreePtr_;
81 
82 
83  // Private Member Functions
84 
85  //- Calculate displacement (w.r.t. points0()) to project onto surface
86  void calcProjection(vectorField& displacement) const;
87 
88  //- No copy assignment
89  void operator=
90  (
92  ) = delete;
93 
94 
95 protected:
96 
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("pointAttraction");
104 
105 
106  // Constructors
107 
108  //- Construct from patch and internal field
110  (
111  const pointPatch&,
113  );
114 
115  //- Construct from patch, internal field and dictionary
117  (
118  const pointPatch&,
120  const dictionary&
121  );
122 
123  //- Construct by mapping given patch field onto a new patch
125  (
127  const pointPatch&,
129  const pointPatchFieldMapper&
130  );
131 
132  //- Construct as copy
134  (
136  );
137 
138  //- Construct and return a clone
139  virtual autoPtr<pointPatchVectorField> clone() const
140  {
142  (
144  (
145  *this
146  )
147  );
148  }
149 
150  //- Construct as copy setting internal field reference
152  (
155  );
156 
157  //- Construct and return a clone setting internal field reference
159  (
161  ) const
162  {
164  (
166  (
167  *this,
168  iF
169  )
170  );
171  }
172 
173  // Member Functions
174 
175  //- Update the coefficients associated with the patch field
176  virtual void updateCoeffs();
177 
178  //- Write
179  virtual void write(Ostream&) const;
180 };
181 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual autoPtr< pointPatchVectorField > clone() const
Construct and return a clone.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Foam::pointPatchFieldMapper.
Displacement by attraction to nearest point. Use in a displacementMotionSolver as a bc on the pointDi...
TypeName("pointAttraction")
Runtime type information.
pointAttractionDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
A class for handling words, derived from Foam::string.
Definition: word.H:63
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...
Non-pointer based hierarchical recursive searching.
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.