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.cxx
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef Foam_pointAttractionDisplacementPointPatchVectorField_H
48 #define Foam_pointAttractionDisplacementPointPatchVectorField_H
49 
50 #include "pointPatchFields.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class pointAttractionDisplacementPointPatchVectorField Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 :
65 {
68 
69  // Private Data
70 
71  //- Maximum velocity
72  const vector velocity_;
73 
74  //- file
75  const fileName featFileName_;
76 
77  //- pointZone with frozen points
78  const word frozenPointsZone_;
79 
80  //- Point searching
81  mutable autoPtr<indexedOctree<treeDataPoint>> pointTreePtr_;
82 
83 
84  // Private Member Functions
85 
86  //- Calculate displacement (w.r.t. points0()) to project onto surface
87  void calcProjection(vectorField& displacement) const;
88 
89 
90 protected:
91 
93 
94 
95 public:
96 
97  //- Runtime type information
98  TypeName("pointAttraction");
99 
100 
101  // Constructors
102 
103  //- Construct from patch and internal field
105  (
106  const pointPatch&,
108  );
109 
110  //- Construct from patch, internal field and dictionary
112  (
113  const pointPatch&,
115  const dictionary&
116  );
117 
118  //- Construct by mapping onto a new patch
120  (
121  const this_bctype&,
122  const pointPatch&,
124  const pointPatchFieldMapper&
125  );
126 
127  //- Construct as copy setting internal field reference
129  (
130  const this_bctype&,
132  );
133 
134  //- No copy without an internal field
136  (
137  const this_bctype&
138  ) = delete;
139 
140  //- Clone with an internal field reference
142  (
144  ) const
145  {
146  return pointPatchField<vector>::Clone(*this, iF);
147  }
148 
149 
150  // Member Functions
151 
152  //- Update the coefficients associated with the patch field
153  virtual void updateCoeffs();
154 
155  //- Write
156  virtual void write(Ostream&) const;
157 
158 
159  // Member Operators
160 
161  //- No copy assignment
162  void operator=
163  (
165  ) = delete;
166 
167  //- Inherit assignment
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
const indexedOctree< treeDataPoint > & pointTree() const
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:130
Foam::pointPatchFieldMapper.
virtual autoPtr< pointPatchField< Type > > clone() const
No clone without an internal field reference.
friend Ostream & operator(Ostream &, const pointPatchField< vector > &)
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
static autoPtr< pointPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
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...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
virtual void write(Ostream &) const
Write.
Namespace for OpenFOAM.