rigidBodyMeshMotionSolver.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) 2020 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::rigidBodyMeshMotionSolver
29 
30 Description
31  Rigid-body mesh motion solver for fvMesh.
32 
33  Applies septernion interpolation of movement as function of distance to the
34  object surface.
35 
36 SourceFiles
37  rigidBodyMeshMotionSolver.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef rigidBodyMeshMotionSolver_H
42 #define rigidBodyMeshMotionSolver_H
43 
45 #include "rigidBodyMotion.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class rigidBodyMeshMotionSolver Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public motionSolver
59 {
60  //- Class containing the patches and point motion weighting for each body
61  class bodyMesh
62  {
63  //- Name of the body
64  const word name_;
65 
66  //- ID of the body in the RBD::rigidBodyMotion
67  const label bodyID_;
68 
69  //- List of mesh patches associated with this body
70  const wordRes patches_;
71 
72  //- Patches to integrate forces
73  const labelHashSet patchSet_;
74 
75 
76  public:
77 
78  friend class rigidBodyMeshMotionSolver;
79 
80  bodyMesh
81  (
82  const polyMesh& mesh,
83  const word& name,
84  const label bodyID,
85  const dictionary& dict
86  );
87  };
88 
89 
90  // Private data
91 
92  //- Rigid-body model
93  RBD::rigidBodyMotion model_;
94 
95  //- List of the bodyMeshes containing the patches and point motion
96  // weighting for each body
97  PtrList<bodyMesh> bodyMeshes_;
98 
99  //- Test-mode in which only the gravitational body-force is applied
100  bool test_;
101 
102  //- Reference density required by the forces object for
103  // incompressible calculations, required if rho == rhoInf
104  scalar rhoInf_;
105 
106  //- Name of density field, optional unless used for an
107  // incompressible simulation, when this needs to be specified
108  // as rhoInf
109  word rhoName_;
110 
111  //- Current time index (used for updating)
112  label curTimeIndex_;
113 
114  autoPtr<motionSolver> meshSolverPtr_;
115 
116  displacementMotionSolver& meshSolver_;
117 
118 
119  // Private Member Functions
120 
121  //- No copy construct
123 
124  //- No copy assignment
125  void operator=(const rigidBodyMeshMotionSolver&) = delete;
126 
127 
128 public:
129 
130  //- Runtime type information
131  TypeName("rigidBodyMotionSolver");
132 
133 
134  // Constructors
135 
136  //- Construct from polyMesh and IOdictionary
138  (
139  const polyMesh&,
140  const IOdictionary& dict
141  );
142 
143 
144  //- Destructor
145  ~rigidBodyMeshMotionSolver() = default;
146 
147 
148  // Member Functions
149 
150  //- Return point location obtained from the current motion field
151  virtual tmp<pointField> curPoints() const;
152 
153  //- Solve for motion
154  virtual void solve();
155 
156  //- Write state using stream options
157  virtual bool writeObject
158  (
159  IOstreamOption streamOpt,
160  const bool valid
161  ) const;
162 
163  //- Read dynamicMeshDict dictionary
164  virtual bool read();
165 
166  //- Update local data for geometry changes
167  virtual void movePoints(const pointField&);
168 
169  //- Update local data for topology changes
170  virtual void updateMesh(const mapPolyMesh&);
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
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::rigidBodyMeshMotionSolver::TypeName
TypeName("rigidBodyMotionSolver")
Runtime type information.
Foam::rigidBodyMeshMotionSolver::solve
virtual void solve()
Solve for motion.
Definition: rigidBodyMeshMotionSolver.C:175
Foam::RBD::rigidBodyMotion
Six degree of freedom motion for a rigid body.
Definition: rigidBodyMotion.H:75
Foam::baseIOdictionary::name
const word & name() const
Definition: baseIOdictionary.C:85
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::rigidBodyMeshMotionSolver::movePoints
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Definition: rigidBodyMeshMotionSolver.C:320
Foam::rigidBodyMeshMotionSolver::read
virtual bool read()
Read dynamicMeshDict dictionary.
Definition: rigidBodyMeshMotionSolver.C:307
Foam::Field< vector >
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::rigidBodyMeshMotionSolver
Rigid-body mesh motion solver for fvMesh.
Definition: rigidBodyMeshMotionSolver.H:55
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
displacementMotionSolver.H
Foam::rigidBodyMeshMotionSolver::curPoints
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Definition: rigidBodyMeshMotionSolver.C:169
Foam::rigidBodyMeshMotionSolver::writeObject
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write state using stream options.
Definition: rigidBodyMeshMotionSolver.C:280
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::motionSolver
Virtual base class for mesh motion solver.
Definition: motionSolver.H:58
Foam::rigidBodyMeshMotionSolver::~rigidBodyMeshMotionSolver
~rigidBodyMeshMotionSolver()=default
Destructor.
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
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::rigidBodyMeshMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Definition: rigidBodyMeshMotionSolver.C:326