rigidBodyMeshMotion.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) 2016-2017 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::rigidBodyMeshMotion
29 
30 Group
31  grpMeshMotionSolvers
32 
33 Description
34  Rigid-body mesh motion solver for fvMesh.
35 
36  Applies septernion interpolation of movement as function of distance to the
37  object surface.
38 
39 SourceFiles
40  rigidBodyMeshMotion.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef rigidBodyMeshMotion_H
45 #define rigidBodyMeshMotion_H
46 
48 #include "rigidBodyMotion.H"
49 #include "ramp.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class rigidBodyMeshMotion Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 :
63 {
64  //- Class containing the patches and point motion weighting for each body
65  class bodyMesh
66  {
67  //- Name of the body
68  const word name_;
69 
70  //- ID of the body in the RBD::rigidBodyMotion
71  const label bodyID_;
72 
73  //- List of mesh patches associated with this body
74  const wordRes patches_;
75 
76  //- Patches to integrate forces
77  const labelHashSet patchSet_;
78 
79  //- Inner morphing distance (limit of solid-body region)
80  const scalar di_;
81 
82  //- Outer morphing distance (limit of linear interpolation region)
83  const scalar do_;
84 
85  //- Current interpolation weight
86  // (1 at patches and within di_, 0 at do_ and beyond)
87  pointScalarField weight_;
88 
89 
90  public:
91 
92  friend class rigidBodyMeshMotion;
93 
94  bodyMesh
95  (
96  const polyMesh& mesh,
97  const word& name,
98  const label bodyID,
99  const dictionary& dict
100  );
101  };
102 
103 
104  // Private data
105 
106  //- Rigid-body model
107  RBD::rigidBodyMotion model_;
108 
109  //- List of the bodyMeshes containing the patches and point motion
110  // weighting for each body
111  PtrList<bodyMesh> bodyMeshes_;
112 
113  //- Test-mode in which only the gravitational body-force is applied
114  bool test_;
115 
116  //- Reference density required by the forces object for
117  // incompressible calculations, required if rho == rhoInf
118  scalar rhoInf_;
119 
120  //- Name of density field, optional unless used for an
121  // incompressible simulation, when this needs to be specified
122  // as rhoInf
123  word rhoName_;
124 
125  //- Ramp the forces according to the specified function and period
127 
128  //- Current time index (used for updating)
129  label curTimeIndex_;
130 
131  //- Name of the uniformVectorField for CofG displacement
132  word cOfGdisplacement_;
133 
134  //- Body Id for the body to write CofG displacement
135  label bodyIdCofG_;
136 
137 
138 
139  // Private Member Functions
140 
141  //- No copy construct
142  rigidBodyMeshMotion(const rigidBodyMeshMotion&) = delete;
143 
144  //- No copy assignment
145  void operator=(const rigidBodyMeshMotion&) = delete;
146 
147 
148 public:
149 
150  //- Runtime type information
151  TypeName("rigidBodyMotion");
152 
153 
154  // Constructors
155 
156  //- Construct from polyMesh and IOdictionary
158  (
159  const polyMesh&,
160  const IOdictionary& dict
161  );
162 
163 
164  //- Destructor
165  ~rigidBodyMeshMotion() = default;
166 
167 
168  // Member Functions
169 
170  //- Return point location obtained from the current motion field
171  virtual tmp<pointField> curPoints() const;
172 
173  //- Solve for motion
174  virtual void solve();
175 
176  //- Write state using stream options
177  virtual bool writeObject
178  (
179  IOstreamOption streamOpt,
180  const bool valid
181  ) const;
182 
183  //- Read dynamicMeshDict dictionary
184  virtual bool read();
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #endif
195 
196 // ************************************************************************* //
Foam::rigidBodyMeshMotion::read
virtual bool read()
Read dynamicMeshDict dictionary.
Definition: rigidBodyMeshMotion.C:420
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::rigidBodyMeshMotion
Rigid-body mesh motion solver for fvMesh.
Definition: rigidBodyMeshMotion.H:59
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::rigidBodyMeshMotion::TypeName
TypeName("rigidBodyMotion")
Runtime type information.
Foam::rigidBodyMeshMotion::~rigidBodyMeshMotion
~rigidBodyMeshMotion()=default
Destructor.
Foam::RBD::rigidBodyMotion
Six degree of freedom motion for a rigid body.
Definition: rigidBodyMotion.H:75
Foam::rigidBodyMeshMotion::solve
virtual void solve()
Solve for motion.
Definition: rigidBodyMeshMotion.C:238
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:85
Foam::HashSet< label, Hash< label > >
Foam::rigidBodyMeshMotion::curPoints
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Definition: rigidBodyMeshMotion.C:217
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::PtrList< bodyMesh >
dict
dictionary dict
Definition: searchingEngine.H:14
rigidBodyMotion.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::displacementMotionSolver
Virtual base class for displacement motion solver.
Definition: displacementMotionSolver.H:53
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
displacementMotionSolver.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::motionSolver::mesh
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:144
ramp.H
Foam::GeometricField< scalar, pointPatchField, pointMesh >
Foam::rigidBodyMeshMotion::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write state using stream options.
Definition: rigidBodyMeshMotion.C:393