surfaceDisplacementPointPatchVectorField.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-2015 OpenFOAM Foundation
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::surfaceDisplacementPointPatchVectorField
28 
29 Description
30  Displacement fixed by projection onto triSurface.
31  Use in a displacementMotionSolver
32  as a bc on the pointDisplacement field.
33 
34  Calculates the projection onto the surface according
35  to the projectMode
36  - NEAREST : nearest
37  - POINTNORMAL : intersection with point normal
38  - FIXEDNORMAL : intersection with fixed vector
39 
40  This displacement is then clipped with the specified velocity * deltaT.
41 
42  Optionally (intersection only) removes a component ("wedgePlane") to
43  stay in 2D.
44 
45  Needs:
46  - geometry : dictionary with searchableSurfaces. (usually
47  triSurfaceMeshes in constant/triSurface)
48  - projectMode : see above
49  - projectDirection : if projectMode = fixedNormal
50  - wedgePlane : -1 or component to knock out of intersection normal
51  - frozenPointsZone : empty or name of pointZone containing points
52  that do not move
53 
54 SourceFiles
55  surfaceDisplacementPointPatchVectorField.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef surfaceDisplacementPointPatchVectorField_H
60 #define surfaceDisplacementPointPatchVectorField_H
61 
62 #include "pointPatchFields.H"
64 #include "searchableSurfaces.H"
65 #include "Enum.H"
66 #include "Switch.H"
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class surfaceDisplacementPointPatchVectorField Declaration
75 \*---------------------------------------------------------------------------*/
76 
78 :
79  public fixedValuePointPatchVectorField
80 {
81 
82 public:
83 
84  // Public data types
85 
86  enum projectMode
87  {
91  };
92 
93 private:
94 
95  // Private data
96 
97  //- Project mode names
98  static const Enum<projectMode> projectModeNames_;
99 
100  //- Maximum velocity
101  const vector velocity_;
102 
103  //- Names of surfaces
104  const dictionary surfacesDict_;
105 
106  //- How to project/project onto surface
107  const projectMode projectMode_;
108 
109  //- Direction to project
110  const vector projectDir_;
111 
112  //- Plane for 2D wedge case or -1.
113  const label wedgePlane_;
114 
115  //- Name of pointZone with frozen points
116  const word frozenPointsZone_;
117 
118  //- Demand driven: surface to project
119  mutable autoPtr<searchableSurfaces> surfacesPtr_;
120 
121 
122  // Private Member Functions
123 
124  //- Calculate displacement (w.r.t. points0()) to project onto surface
125  void calcProjection(vectorField& displacement) const;
126 
127  //- No copy assignment
128  void operator=
129  (
131  ) = delete;
132 
133 
134 public:
135 
136  //- Runtime type information
137  TypeName("surfaceDisplacement");
138 
139 
140  // Constructors
141 
142  //- Construct from patch and internal field
144  (
145  const pointPatch&,
147  );
148 
149  //- Construct from patch, internal field and dictionary
151  (
152  const pointPatch&,
154  const dictionary&
155  );
156 
157  //- Construct by mapping given patchField<vector> onto a new patch
159  (
161  const pointPatch&,
163  const pointPatchFieldMapper&
164  );
165 
166  //- Construct as copy
168  (
170  );
171 
172  //- Construct and return a clone
173  virtual autoPtr<pointPatchVectorField> clone() const
174  {
176  (
178  (
179  *this
180  )
181  );
182  }
183 
184  //- Construct as copy setting internal field reference
186  (
189  );
190 
191  //- Construct and return a clone setting internal field reference
193  (
195  ) const
196  {
198  (
200  (
201  *this,
202  iF
203  )
204  );
205  }
206 
207  // Member Functions
208 
209  //- Surface to follow. Demand loads surfaceNames.
210  const searchableSurfaces& surfaces() const;
211 
212  //- Update the coefficients associated with the patch field
213  virtual void updateCoeffs();
214 
215  //- Write
216  virtual void write(Ostream&) const;
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
Foam::surfaceDisplacementPointPatchVectorField::surfaceDisplacementPointPatchVectorField
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Definition: surfaceDisplacementPointPatchVectorField.C:300
Foam::surfaceDisplacementPointPatchVectorField::TypeName
TypeName("surfaceDisplacement")
Runtime type information.
Foam::surfaceDisplacementPointPatchVectorField::projectMode
projectMode
Definition: surfaceDisplacementPointPatchVectorField.H:85
Foam::Enum< projectMode >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::surfaceDisplacementPointPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: surfaceDisplacementPointPatchVectorField.C:422
Foam::pointPatch
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:58
Foam::pointPatchFieldMapper
Foam::pointPatchFieldMapper.
Definition: pointPatchFieldMapper.H:48
Foam::surfaceDisplacementPointPatchVectorField::clone
virtual autoPtr< pointPatchVectorField > clone() const
Construct and return a clone.
Definition: surfaceDisplacementPointPatchVectorField.H:172
searchableSurfaces.H
Foam::Field< vector >
Foam::surfaceDisplacementPointPatchVectorField::NEAREST
Definition: surfaceDisplacementPointPatchVectorField.H:87
Switch.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fixedValuePointPatchFields.H
Foam::surfaceDisplacementPointPatchVectorField::FIXEDNORMAL
Definition: surfaceDisplacementPointPatchVectorField.H:89
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::Vector< scalar >
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
pointPatchFields.H
Foam::surfaceDisplacementPointPatchVectorField
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
Definition: surfaceDisplacementPointPatchVectorField.H:76
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::surfaceDisplacementPointPatchVectorField::POINTNORMAL
Definition: surfaceDisplacementPointPatchVectorField.H:88
Foam::surfaceDisplacementPointPatchVectorField::surfaces
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
Definition: surfaceDisplacementPointPatchVectorField.C:395
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::surfaceDisplacementPointPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: surfaceDisplacementPointPatchVectorField.C:468
Enum.H