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 -------------------------------------------------------------------------------
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::rigidBodyMeshMotionSolver
28 
29 Description
30  Rigid-body mesh motion solver for fvMesh.
31 
32  Applies septernion interpolation of movement as function of distance to the
33  object surface.
34 
35 SourceFiles
36  rigidBodyMeshMotionSolver.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef rigidBodyMeshMotionSolver_H
41 #define rigidBodyMeshMotionSolver_H
42 
44 #include "rigidBodyMotion.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class rigidBodyMeshMotionSolver Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public motionSolver
58 {
59  //- Class containing the patches and point motion weighting for each body
60  class bodyMesh
61  {
62  //- Name of the body
63  const word name_;
64 
65  //- ID of the body in the RBD::rigidBodyMotion
66  const label bodyID_;
67 
68  //- List of mesh patches associated with this body
69  const wordRes patches_;
70 
71  //- Patches to integrate forces
72  const labelHashSet patchSet_;
73 
74 
75  public:
76 
77  friend class rigidBodyMeshMotionSolver;
78 
79  bodyMesh
80  (
81  const polyMesh& mesh,
82  const word& name,
83  const label bodyID,
84  const dictionary& dict
85  );
86  };
87 
88 
89  // Private data
90 
91  //- Rigid-body model
92  RBD::rigidBodyMotion model_;
93 
94  //- List of the bodyMeshes containing the patches and point motion
95  // weighting for each body
96  PtrList<bodyMesh> bodyMeshes_;
97 
98  //- Test-mode in which only the gravitational body-force is applied
99  bool test_;
100 
101  //- Reference density required by the forces object for
102  // incompressible calculations, required if rho == rhoInf
103  scalar rhoInf_;
104 
105  //- Name of density field, optional unless used for an
106  // incompressible simulation, when this needs to be specified
107  // as rhoInf
108  word rhoName_;
109 
110  //- Current time index (used for updating)
111  label curTimeIndex_;
112 
113  autoPtr<motionSolver> meshSolverPtr_;
114 
115  displacementMotionSolver& meshSolver_;
116 
117 
118  // Private Member Functions
119 
120  //- No copy construct
122  (
124  ) = delete;
125 
126  //- No copy assignment
127  void operator=(const rigidBodyMeshMotionSolver&) = delete;
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("rigidBodyMotionSolver");
134 
135 
136  // Constructors
137 
138  //- Construct from polyMesh and IOdictionary
140  (
141  const polyMesh&,
142  const IOdictionary& dict
143  );
144 
145 
146  //- Destructor
147  ~rigidBodyMeshMotionSolver() = default;
148 
149 
150  // Member Functions
151 
152  //- Return point location obtained from the current motion field
153  virtual tmp<pointField> curPoints() const;
154 
155  //- Solve for motion
156  virtual void solve();
157 
158  //- Write state using given format, version and compression
159  virtual bool writeObject
160  (
164  const bool valid
165  ) const;
166 
167  //- Read dynamicMeshDict dictionary
168  virtual bool read();
169 
170  //- Update local data for geometry changes
171  virtual void movePoints(const pointField&);
172 
173  //- Update local data for topology changes
174  virtual void updateMesh(const mapPolyMesh&);
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
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:62
Foam::rigidBodyMeshMotionSolver::writeObject
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool valid) const
Write state using given format, version and compression.
Definition: rigidBodyMeshMotionSolver.C:280
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
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:73
Foam::baseIOdictionary::name
const word & name() const
Name function is needed to disambiguate those inherited.
Definition: baseIOdictionary.C:88
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::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:62
Foam::IOstreamOption::versionNumber
Representation of a major/minor version number.
Definition: IOstreamOption.H:79
Foam::Field< vector >
Foam::PtrList< bodyMesh >
dict
dictionary dict
Definition: searchingEngine.H:14
rigidBodyMotion.H
Foam::IOstreamOption::streamFormat
streamFormat
Data format (ascii | binary)
Definition: IOstreamOption.H:64
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
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:54
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::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:160
Foam::IOstreamOption::compressionType
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
Definition: IOstreamOption.H:71
Foam::rigidBodyMeshMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Definition: rigidBodyMeshMotionSolver.C:326