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 | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::surfaceDisplacementPointPatchVectorField
26 
27 Description
28  Displacement fixed by projection onto triSurface.
29  Use in a displacementMotionSolver
30  as a bc on the pointDisplacement field.
31 
32  Calculates the projection onto the surface according
33  to the projectMode
34  - NEAREST : nearest
35  - POINTNORMAL : intersection with point normal
36  - FIXEDNORMAL : intersection with fixed vector
37 
38  This displacement is then clipped with the specified velocity * deltaT.
39 
40  Optionally (intersection only) removes a component ("wedgePlane") to
41  stay in 2D.
42 
43  Needs:
44  - geometry : dictionary with searchableSurfaces. (usually
45  triSurfaceMeshes in constant/triSurface)
46  - projectMode : see above
47  - projectDirection : if projectMode = fixedNormal
48  - wedgePlane : -1 or component to knock out of intersection normal
49  - frozenPointsZone : empty or name of pointZone containing points
50  that do not move
51 
52 SourceFiles
53  surfaceDisplacementPointPatchVectorField.C
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef surfaceDisplacementPointPatchVectorField_H
58 #define surfaceDisplacementPointPatchVectorField_H
59 
60 #include "pointPatchFields.H"
62 #include "searchableSurfaces.H"
63 #include "Switch.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 
70 /*---------------------------------------------------------------------------*\
71  Class surfaceDisplacementPointPatchVectorField Declaration
72 \*---------------------------------------------------------------------------*/
73 
75 :
76  public fixedValuePointPatchVectorField
77 {
78 
79 public:
80 
81  // Public data types
82 
83  enum projectMode
84  {
88  };
89 
90 private:
91 
92  // Private data
93 
94  //- Project mode names
96 
97  //- Maximum velocity
98  const vector velocity_;
99 
100  //- Names of surfaces
102 
103  //- How to project/project onto surface
105 
106  //- Direction to project
107  const vector projectDir_;
108 
109  //- Plane for 2D wedge case or -1.
110  const label wedgePlane_;
111 
112  //- pointZone with frozen points
113  const word frozenPointsZone_;
114 
115  //- Demand driven: surface to project
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 
125  //- Disallow default bitwise assignment
127 
128 public:
129 
130  //- Runtime type information
131  TypeName("surfaceDisplacement");
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 given patchField<vector> onto a new patch
153  (
155  const pointPatch&,
157  const pointPatchFieldMapper&
158  );
159 
160  //- Construct as copy
162  (
164  );
165 
166  //- Construct and return a clone
167  virtual autoPtr<pointPatchVectorField> clone() const
168  {
170  (
172  (
173  *this
174  )
175  );
176  }
177 
178  //- Construct as copy setting internal field reference
180  (
183  );
184 
185  //- Construct and return a clone setting internal field reference
187  (
189  ) const
190  {
192  (
194  (
195  *this,
196  iF
197  )
198  );
199  }
200 
201  // Member Functions
202 
203  //- Surface to follow. Demand loads surfaceNames.
204  const searchableSurfaces& surfaces() const;
205 
206  //- Update the coefficients associated with the patch field
207  virtual void updateCoeffs();
208 
209  //- Write
210  virtual void write(Ostream&) const;
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
Foam::surfaceDisplacementPointPatchVectorField::surfaceDisplacementPointPatchVectorField
surfaceDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Definition: surfaceDisplacementPointPatchVectorField.C:305
Foam::surfaceDisplacementPointPatchVectorField::TypeName
TypeName("surfaceDisplacement")
Runtime type information.
Foam::surfaceDisplacementPointPatchVectorField::projectMode
projectMode
Definition: surfaceDisplacementPointPatchVectorField.H:82
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::surfaceDisplacementPointPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: surfaceDisplacementPointPatchVectorField.C:426
Foam::surfaceDisplacementPointPatchVectorField::surfacesDict_
const dictionary surfacesDict_
Names of surfaces.
Definition: surfaceDisplacementPointPatchVectorField.H:100
Foam::pointPatch
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:56
Foam::pointPatchFieldMapper
Foam::pointPatchFieldMapper.
Definition: pointPatchFieldMapper.H:46
Foam::surfaceDisplacementPointPatchVectorField::clone
virtual autoPtr< pointPatchVectorField > clone() const
Construct and return a clone.
Definition: surfaceDisplacementPointPatchVectorField.H:166
Foam::surfaceDisplacementPointPatchVectorField::surfacesPtr_
autoPtr< searchableSurfaces > surfacesPtr_
Demand driven: surface to project.
Definition: surfaceDisplacementPointPatchVectorField.H:115
searchableSurfaces.H
Foam::surfaceDisplacementPointPatchVectorField::frozenPointsZone_
const word frozenPointsZone_
pointZone with frozen points
Definition: surfaceDisplacementPointPatchVectorField.H:112
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::surfaceDisplacementPointPatchVectorField::NEAREST
@ NEAREST
Definition: surfaceDisplacementPointPatchVectorField.H:84
Switch.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::surfaceDisplacementPointPatchVectorField::velocity_
const vector velocity_
Maximum velocity.
Definition: surfaceDisplacementPointPatchVectorField.H:97
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
fixedValuePointPatchFields.H
Foam::surfaceDisplacementPointPatchVectorField::calcProjection
void calcProjection(vectorField &displacement) const
Calculate displacement (w.r.t. points0()) to project onto surface.
Definition: surfaceDisplacementPointPatchVectorField.C:58
Foam::surfaceDisplacementPointPatchVectorField::FIXEDNORMAL
@ FIXEDNORMAL
Definition: surfaceDisplacementPointPatchVectorField.H:86
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::surfaceDisplacementPointPatchVectorField::surfaces
const searchableSurfaces & surfaces() const
Surface to follow. Demand loads surfaceNames.
Definition: surfaceDisplacementPointPatchVectorField.C:400
Foam::surfaceDisplacementPointPatchVectorField::wedgePlane_
const label wedgePlane_
Plane for 2D wedge case or -1.
Definition: surfaceDisplacementPointPatchVectorField.H:109
Foam::Vector< scalar >
Foam::searchableSurfaces
Container for searchableSurfaces.
Definition: searchableSurfaces.H:53
pointPatchFields.H
Foam::surfaceDisplacementPointPatchVectorField::projectModeNames_
static const NamedEnum< projectMode, 3 > projectModeNames_
Project mode names.
Definition: surfaceDisplacementPointPatchVectorField.H:94
Foam::surfaceDisplacementPointPatchVectorField
Displacement fixed by projection onto triSurface. Use in a displacementMotionSolver as a bc on the po...
Definition: surfaceDisplacementPointPatchVectorField.H:73
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::surfaceDisplacementPointPatchVectorField::POINTNORMAL
@ POINTNORMAL
Definition: surfaceDisplacementPointPatchVectorField.H:85
Foam::surfaceDisplacementPointPatchVectorField::projectDir_
const vector projectDir_
Direction to project.
Definition: surfaceDisplacementPointPatchVectorField.H:106
Foam::surfaceDisplacementPointPatchVectorField::operator=
void operator=(const surfaceDisplacementPointPatchVectorField &)
Disallow default bitwise assignment.
Foam::surfaceDisplacementPointPatchVectorField::projectMode_
const projectMode projectMode_
How to project/project onto surface.
Definition: surfaceDisplacementPointPatchVectorField.H:103
Foam::NamedEnum< projectMode, 3 >
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
Foam::surfaceDisplacementPointPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: surfaceDisplacementPointPatchVectorField.C:472