rigidBodyForces.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) 2024 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::functionObjects::rigidBodyForces
26 
27 Description
28  Calculates the forces and moments by integrating the pressure and
29  skin-friction forces over a given list of patches of a moving rigid body.
30 
31  The centre of rotation (CofR) of the moving rigid object is obtained
32  directly from the corresponding Foam::RBD::rigidBodyMotion of the
33  specified body.
34 
35  Member function rigidBodyForces::write() calculates the forces/moments and
36  writes the forces/moments into the file <timeDir>/rigidBodyForces.dat
37  and bin data (if selected) to the file <timeDir>/rigidBodyForces_bin.dat
38 
39  Example of function object specification:
40  \verbatim
41  rigidBodyForces1
42  {
43  type rigidBodyForces;
44  libs ("librigidBodyForces.so");
45 
46  body hull;
47  patches (walls);
48 
49  log yes;
50  }
51  \endverbatim
52 
53 Usage
54  \table
55  Property | Description | Required | Default value
56  type | Type name: rigidBodyForces | yes |
57  log | Write force data to standard output | no | no
58  body | Name of the rigid body | yes |
59  patches | Patches included in the forces calculation | yes |
60  p | Pressure field name | no | p
61  U | Velocity field name | no | U
62  rho | Density field name (see below) | no | rho
63  phase | Phase name for phase-fraction | no |
64  directForceDensity | Force density supplied directly (see below)|no|no
65  fD | Name of force density field (see below) | no | fD
66  \endtable
67 
68  Bin data is optional, but if the dictionary is present, the entries must
69  be defined according o
70  \table
71  nBin | number of data bins | yes |
72  direction | direction along which bins are defined | yes |
73  cumulative | bin data accumulated with increasing distance | yes |
74  \endtable
75 
76  Note
77  - For incompressible cases, set \c rho to \c rhoInf and provide
78  a \c rhoInf value corresponding to the free-stream constant density.
79  - If the \c phase name is specified the corresponding phase-fraction field
80  \c alpha.<phase> is used to filter the surface force field
81  before integration.
82  - If the force density is supplied directly, set the \c directForceDensity
83  flag to 'yes', and supply the force density field using the \c
84  fDName entry
85 
86 See also
87  Foam::functionObject
88  Foam::functionObjects::forcesBase
89  Foam::functionObjects::fvMeshFunctionObject
90  Foam::functionObjects::logFiles
91  Foam::functionObjects::timeControl
92  Foam::RBD::rigidBodyMotion
93 
94 SourceFiles
95  rigidBodyForces.C
96 
97 \*---------------------------------------------------------------------------*/
98 
99 #ifndef functionObjects_rigidBodyForces_H
100 #define functionObjects_rigidBodyForces_H
101 
102 #include "forcesBase.H"
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 namespace Foam
107 {
108 namespace functionObjects
109 {
110 
111 /*---------------------------------------------------------------------------*\
112  Class rigidBodyForces Declaration
113 \*---------------------------------------------------------------------------*/
114 
115 class rigidBodyForces
116 :
117  public forcesBase
118 {
119  // Private Data
120 
121  //- Name of the rigid body
122  word body_;
123 
124 
125 protected:
126 
127  // Protected Member Functions
128 
129  //- Return the current centre of the rigid body
130  virtual vector CofR() const;
131 
132 
133 public:
134 
135  //- Runtime type information
136  TypeName("rigidBodyForces");
137 
138 
139  // Constructors
140 
141  //- Construct from Time and dictionary
143  (
144  const word& name,
145  const Time& runTime,
146  const dictionary& dict
147  );
148 
149  //- Construct from objectRegistry and dictionary
151  (
152  const word& name,
153  const objectRegistry& obr,
154  const dictionary&
155  );
156 
157  //- Disallow default bitwise copy construction
158  rigidBodyForces(const rigidBodyForces&) = delete;
159 
160 
161  //- Destructor
162  virtual ~rigidBodyForces();
163 
164 
165  // Member Functions
166 
167  //- Read the forces data
168  virtual bool read(const dictionary&);
169 
170 
171  // Member Operators
172 
173  //- Disallow default bitwise assignment
174  void operator=(const rigidBodyForces&) = delete;
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace functionObjects
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
const word & name() const
Return the name of this functionObject.
TypeName("rigidBodyForces")
Runtime type information.
void operator=(const rigidBodyForces &)=delete
Disallow default bitwise assignment.
rigidBodyForces(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual vector CofR() const
Return the current centre of the rigid body.
virtual bool read(const dictionary &)
Read the forces data.
Namespace for OpenFOAM.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
dictionary dict