multiRigidBody_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::multiRigidBody
26 
27 Description
28  Abstract base-class for multiple rigid body mesh motion.
29 
30  Applies distance weighted SLERP interpolation between the septernions
31  returned by each of the body movement functions.
32 
33 SourceFiles
34  multiRigidBody.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef multiRigidBody_pointMeshMover_H
39 #define multiRigidBody_pointMeshMover_H
40 
41 #include "displacementPoints0.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 namespace pointMeshMovers
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class multiRigidBody Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class multiRigidBody
55 :
56  public displacementPoints0
57 {
58 protected:
59 
60  //- Class containing the patches and point motion weighting for each body
61  class bodyMesh
62  {
63  const polyMesh& mesh_;
64 
65  //- Name of the body
66  const word name_;
67 
68  //- List of mesh patch names associated with this body
69  const wordReList patches_;
70 
71  //- Set of mesh patches associated with this body
72  labelHashSet patchSet_;
73 
74  //- Names of the pointZones which move with the body
75  wordReList pointZones_;
76 
77  //- pointZones which move with the body
78  labelHashSet pointZoneSet_;
79 
80  //- Inner morphing distance (limit of solid-body region)
81  const scalar di_;
82 
83  //- Outer morphing distance (limit of linear interpolation region)
84  const scalar do_;
85 
86  //- Current interpolation weight
87  // (1 at patches and within di_, 0 at do_ and beyond)
88  pointScalarField weight_;
89 
90  void calcWeights(const pointField& points0);
91 
92 
93  public:
94 
95  //- ID of the body in the RBD::rigidBodyMotion
97 
98  friend class multiRigidBody;
99 
100  bodyMesh
101  (
102  const polyMesh& mesh,
103  const word& name,
104  const dictionary& dict
105  );
106 
107  bodyMesh
108  (
109  const polyMesh& mesh,
110  const word& name
111  );
112 
113  template<class Type>
114  inline Type weight(const Type& pDist) const;
115 
116  inline const word& name()
117  {
118  return name_;
119  }
120 
121  inline const wordReList& patches() const
122  {
123  return patches_;
124  }
125  };
126 
127 
128  // Protected Data
129 
130  //- List of the bodyMeshes containing the patches and point motion
131  // weighting for each body
133 
134 
135 private:
136 
137  // Private Member Functions
138 
139  //- Return the list of weights for each body to pointi
140  // w is used as the work-space for the weights and returned
141  List<scalar>& weights(const label pointi, List<scalar>& w) const;
142 
143  //- Return the list of transformation for each body from time 0
144  virtual List<septernion> transforms0() const = 0;
145 
146  //- Move the bodies
147  virtual void moveBodies() = 0;
148 
149 
150 public:
151 
152  //- Runtime type information
153  TypeName("multiRigidBody");
154 
155 
156  // Constructors
157 
158  //- Construct from polyMesh and dictionary
159  multiRigidBody(const polyMesh&, const dictionary& dict);
160 
161  //- Disallow default bitwise copy construction
162  multiRigidBody(const multiRigidBody&) = delete;
163 
164 
165  //- Destructor
166  ~multiRigidBody();
167 
168 
169  // Member Functions
170 
171  //- Return point location obtained from the current motion field
172  virtual tmp<pointField> newPoints();
173 
174  //- Update local data for topology changes
175  virtual void topoChange(const polyTopoChangeMap&);
176 
177  //- Update from another mesh using the given map
178  // Resets points0 to the points of the new mesh
179  virtual void mapMesh(const polyMeshMap&);
180 
181 
182  // Member Operators
183 
184  //- Disallow default bitwise assignment
185  void operator=(const multiRigidBody&) = delete;
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace pointMeshMovers
192 } // End namespace Foam
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
pointField & points0()
Return reference to the reference field.
Class containing the patches and point motion weighting for each body.
label bodyIndex
ID of the body in the RBD::rigidBodyMotion.
bodyMesh(const polyMesh &mesh, const word &name, const dictionary &dict)
Abstract base-class for multiple rigid body mesh motion.
virtual void topoChange(const polyTopoChangeMap &)
Update local data for topology changes.
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.
multiRigidBody(const polyMesh &, const dictionary &dict)
Construct from polyMesh and dictionary.
TypeName("multiRigidBody")
Runtime type information.
PtrList< bodyMesh > bodyMeshes_
List of the bodyMeshes containing the patches and point motion.
void operator=(const multiRigidBody &)=delete
Disallow default bitwise assignment.
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