sectionalForceProbes.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) 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::functionObjects::sectionalForceProbes
26 
27 Description
28  This function calculates the fluid forces and moments at a number of
29  section-planes through a given set of patches. It writes the result into a
30  log file.
31 
32  The cut-planes are defined by a single normal and a number of points.
33  Forces and moments are calculated on the side of the planes to which the
34  normal points. If the "other" side also needs to be generated then the
35  function can be executed with the normal reversed.
36 
37  Note that this function only generates the contribution from the fluid to
38  the sectional forces and moments in the object. To compute the complete
39  sectional force would require supporting and/or dynamic forces to be
40  included also.
41 
42  Example of function object specification:
43  \verbatim
44  sectionalForceProbes1
45  {
46  type sectionalForceProbes;
47  libs ("libforces.so");
48  patches (hull);
49  points
50  (
51  (-0.8 0 0)
52  ( 0 0 0)
53  ( 0.8 0 0)
54  );
55  normal (1 0 0);
56  }
57  \endverbatim
58 
59 Usage
60  \table
61  Property | Description | Required | Default value
62  type | Type name: sectionalForceProbes | yes |
63  patches | Patches included in the forces calculation | yes |
64  points | Points in the cut-planes | yes |
65  normal | Normal to the cut-planes | yes |
66  p | Pressure field name | no | p
67  U | Velocity field name | no | U
68  rho | Density field name | no | rho
69  phase | Phase name for phase-fraction | no |
70  rhoRef | Reference density | if incompressible |
71  pRef | Reference pressure | no | 0
72  \endtable
73 
74 SourceFiles
75  sectionalForceProbes.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef sectionalForceProbes_functionObject_H
80 #define sectionalForceProbes_functionObject_H
81 
82 #include "sectionalForcesBase.H"
83 #include "logFiles.H"
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 namespace Foam
88 {
89 namespace functionObjects
90 {
91 
92 /*---------------------------------------------------------------------------*\
93  Class sectionalForceProbes Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class sectionalForceProbes
97 :
98  public sectionalForcesBase,
99  public logFiles
100 {
101  // Private Data
102 
103  //- The normal to the selection planes
104  vector normal_;
105 
106  //- Points in the section planes
107  Field<point> points_;
108 
109  //- The order the points when sorted by distance in the normal
110  labelList pointOrders_;
111 
112 
113 protected:
114 
115  // Protected Member Functions
116 
117  //- Return the normal to the section planes
118  virtual vector normal() const;
119 
120  //- Return the origin of the plot
121  virtual point origin() const;
122 
123  //- Return the distances from the origin to the section planes
124  virtual tmp<scalarField> distances() const;
125 
126  //- Output file header information
127  virtual void writeFileHeader(const label i = 0);
128 
129 
130 public:
131 
132  //- Runtime type information
133  TypeName("sectionalForceProbes");
134 
135 
136  // Constructors
137 
138  //- Construct from Time and dictionary
140  (
141  const word& name,
142  const Time& runTime,
143  const dictionary& dict
144  );
145 
146  //- Disallow default bitwise copy construction
148 
149 
150  //- Destructor
151  virtual ~sectionalForceProbes();
152 
153 
154  // Member Functions
155 
156  //- Read the sectionalForceProbes data
157  virtual bool read(const dictionary&);
158 
159  //- Write the sectionalForceProbes
160  virtual bool write();
161 
162 
163  // Member Operators
164 
165  //- Disallow default bitwise assignment
166  void operator=(const sectionalForceProbes&) = delete;
167 };
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 } // End namespace functionObjects
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const word & name() const
Return the name of this functionObject.
This function calculates the fluid forces and moments at a number of section-planes through a given s...
void operator=(const sectionalForceProbes &)=delete
Disallow default bitwise assignment.
TypeName("sectionalForceProbes")
Runtime type information.
sectionalForceProbes(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual void writeFileHeader(const label i=0)
Output file header information.
virtual tmp< scalarField > distances() const
Return the distances from the origin to the section planes.
virtual point origin() const
Return the origin of the plot.
virtual vector normal() const
Return the normal to the section planes.
virtual bool write()
Write the sectionalForceProbes.
virtual bool read(const dictionary &)
Read the sectionalForceProbes data.
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: labelList.H:56
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
vector point
Point is a vector.
Definition: point.H:41
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
dictionary dict