rigidBodyDisplacement_pointMeshMover.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2026 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::pointMeshMovers::rigidBodyDisplacement
26 
27 Description
28  Rigid-body mesh motion solver for fvMesh.
29 
30 SourceFiles
31  rigidBodyDisplacement.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef rigidBodyDisplacement_pointMeshMover_H
36 #define rigidBodyDisplacement_pointMeshMover_H
37 
39 #include "rigidBodyMotion.H"
40 #include "Function1.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace pointMeshMovers
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class rigidBodyDisplacement Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public pointMeshMover,
57 {
58  //- Class containing the patches and point motion weighting for each body
59  class bodyMesh
60  {
61  //- Name of the body
62  const word name_;
63 
64  //- ID of the body in the RBD::rigidBodyMotion
65  const label bodyIndex_;
66 
67  //- List of mesh patches associated with this body
68  const wordReList patches_;
69 
70  //- Patches to integrate forces
71  const labelHashSet patchSet_;
72 
73 
74  public:
75 
76  friend class rigidBodyDisplacement;
77 
78  bodyMesh
79  (
80  const polyMesh& mesh,
81  const word& name,
82  const label bodyID,
83  const dictionary& dict
84  );
85  };
86 
87 
88  // Private Data
89 
90  //- List of the bodyMeshes containing the patches and point motion
91  // weighting for each body
92  PtrList<bodyMesh> bodyMeshes_;
93 
94  //- Switch for test-mode in which only the
95  // gravitational body-force is applied
96  Switch test_;
97 
98  //- Number of iterations in test-mode
99  label nIter_;
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  //- Ramp the forces according to the specified function and period
112 
113  //- Current time index (used for updating)
114  label curTimeIndex_;
115 
116  autoPtr<pointMeshMover> meshSolverPtr_;
117 
118  pointMeshMovers::displacement& meshSolver_;
119 
120  //- To avoid warning from clang
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("rigidBodyDisplacement");
128 
129 
130  // Constructors
131 
132  //- Construct from polyMesh and dictionary
134 
135  //- Disallow default bitwise copy construction
137  (
138  const rigidBodyDisplacement&
139  ) = delete;
140 
141 
142  //- Destructor
144 
145 
146  // Member Functions
147 
148  //- Return point location obtained from the current motion field
149  virtual tmp<pointField> newPoints();
150 
151  //- Update local data for geometry changes
152  virtual void movePoints(const pointField&);
153 
154  //- Update local data for topology changes
155  virtual void topoChange(const polyTopoChangeMap&);
156 
157  //- Update from another mesh using the given map
158  virtual void mapMesh(const polyMeshMap&);
159 
160  //- Update corresponding to the given distribution map
161  virtual void distribute(const polyDistributionMap&);
162 
163  //- Write motion state information for restart
164  virtual bool write() const;
165 
166 
167  // Member Operators
168 
169  //- Disallow default bitwise assignment
170  void operator=(const rigidBodyDisplacement&) = delete;
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace pointMeshMovers
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
const word & name(const label bodyID) const
Return the name of body with the given ID.
Six degree of freedom motion for a rigid body.
virtual void write(Ostream &) const
Write.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for pointMesh movers.
Abstract base class for displacement pointMesh movers.
TypeName("rigidBodyDisplacement")
Runtime type information.
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
virtual tmp< pointField > newPoints()
Return point location obtained from the current motion field.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
void operator=(const rigidBodyDisplacement &)=delete
Disallow default bitwise assignment.
virtual bool write() const
Write motion state information for restart.
rigidBodyDisplacement(const polyMesh &, const dictionary &dict)
Construct from polyMesh and dictionary.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
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
dictionary dict