sixDoFRigidBodyDisplacementPointPatchVectorField.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-2016 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::sixDoFRigidBodyDisplacementPointPatchVectorField
28 
29 Description
30  Foam::sixDoFRigidBodyDisplacementPointPatchVectorField
31 
32 SourceFiles
33  sixDoFRigidBodyDisplacementPointPatchVectorField.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Foam_sixDoFRigidBodyDisplacementPointPatchVectorField_H
38 #define Foam_sixDoFRigidBodyDisplacementPointPatchVectorField_H
39 
41 #include "sixDoFRigidBodyMotion.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class sixDoFRigidBodyDisplacementPointPatchVectorField Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 :
54  public fixedValuePointPatchField<vector>
55 {
58 
59  // Private Data
60 
61  //- Six dof motion object
62  sixDoFRigidBodyMotion motion_;
63 
64  //- Initial positions of points on the patch
65  pointField initialPoints_;
66 
67  //- Reference density required by the forces object for
68  // incompressible calculations, required if rho == rhoInf
69  scalar rhoInf_;
70 
71  //- Name of density field, optional unless used for an
72  // incompressible simulation, when this needs to be specified
73  // as rhoInf
74  word rhoName_;
75 
76  //- State of gravity lookup:
77  // -1 = not determined yet, as the BC may be instantiated before g has
78  // been read into the db yet. Determination deferred until first
79  // call to updateCoeffs. A g keyword was not supplied to the
80  // dictionary.
81  // -2 = as for -1, but a gravity value was specified in the dictionary,
82  // specifying a value in the dictionary is considered a fatal
83  // error if g is available from the db.
84  // 0 = Use this boundary condition's own value of gravity, as not
85  // available from the db.
86  // 1 = Lookup gravity from db.
87  label lookupGravity_;
88 
89  //- Gravity vector to store when not available from the db
90  vector g_;
91 
92  //- Current time index (used for updating)
93  label curTimeIndex_;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("sixDoFRigidBodyDisplacement");
100 
101 
102  // Constructors
103 
104  //- Construct from patch and internal field
106  (
107  const pointPatch&,
109  );
110 
111  //- Construct from patch, internal field and dictionary
113  (
114  const pointPatch&,
116  const dictionary&
117  );
118 
119  //- Construct by mapping onto a new patch
121  (
122  const this_bctype&,
123  const pointPatch&,
125  const pointPatchFieldMapper&
126  );
127 
128  //- Construct as copy setting internal field reference
130  (
131  const this_bctype&,
133  );
134 
135  //- No copy without an internal field
137  (
138  const this_bctype&
139  ) = delete;
140 
141  //- Clone with an internal field reference
143  (
145  ) const
146  {
147  return pointPatchField<vector>::Clone(*this, iF);
148  }
149 
150 
151  // Member functions
152 
153  // Mapping functions
154 
155  //- Map (and resize as needed) from self given a mapping object
156  virtual void autoMap
157  (
158  const pointPatchFieldMapper&
159  );
160 
161  //- Reverse map the given pointPatchField onto this pointPatchField
162  virtual void rmap
163  (
165  const labelList&
166  );
167 
168 
169  // Evaluation functions
170 
171  //- Update the coefficients associated with the patch field
172  virtual void updateCoeffs();
173 
174 
175  //- Write
176  virtual void write(Ostream&) const;
177 
178 
179  // Member Operators
180 
181  //- Inherit assignment
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
Six degree of freedom motion for a rigid body.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
sixDoFRigidBodyDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
A FixedValue boundary condition for pointField.
Foam::pointPatchFieldMapper.
virtual autoPtr< pointPatchField< vector > > clone() const
No clone without an internal field reference.
friend Ostream & operator(Ostream &, const pointPatchField< vector > &)
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void rmap(const pointPatchField< vector > &, const labelList &)
Reverse map the given pointPatchField onto this pointPatchField.
TypeName("sixDoFRigidBodyDisplacement")
Runtime type information.
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...
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.