Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::rigidBodyMeshMotion
29
30Group
31 grpMeshMotionSolvers
32
33Description
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
39SourceFiles
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
53namespace Foam
54{
56/*---------------------------------------------------------------------------*\
57 Class rigidBodyMeshMotion Declaration
58\*---------------------------------------------------------------------------*/
59
60class rigidBodyMeshMotion
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
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
148public:
149
150 //- Runtime type information
151 TypeName("rigidBodyMotion");
152
153
154 // Constructors
155
156 //- Construct from polyMesh and IOdictionary
157 rigidBodyMeshMotion
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 writeOnProc
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// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
A simple container for options an IOstream can normally have.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
Six degree of freedom motion for a rigid body.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
displacementMotionSolver(const displacementMotionSolver &)=delete
No copy construct.
const polyMesh & mesh() const
Return reference to mesh.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write state using stream options.
~rigidBodyMeshMotion()=default
Destructor.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
TypeName("rigidBodyMotion")
Runtime type information.
virtual void solve()
Solve for motion.
virtual bool read()
Read dynamicMeshDict dictionary.
A class for managing temporary objects.
Definition tmp.H:75
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68