rigidBodySectionalForceGraph.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::rigidBodySectionalForceGraph
26 
27  Description
28  This function calculates the fluid and acceleration forces and moments at a
29  series of section-planes through a given rigid body. It writes the result
30  into a graph which can be used to construct (potentially just a part of) a
31  shear force and bending moment diagram. Points in the graph are graded to
32  approximately match the resolution of the mesh.
33 
34  The cut-planes are defined as normal to an axis in the local coordinate
35  system of the rigid body, and the line of the graph extends along the axis
36  from an origin defined in the same local coordinate system. Forces and
37  moments are calculated on the side of the plane on which coordinates have a
38  positive axis-component.
39 
40  Note that this function does not take into account the effect of joints or
41  restraints attached to the body, so if these are applied then the shear
42  force and bending moment diagrams generated will be somewhat incomplete.
43  Note that ramping, acceleration relaxation, and solution tolerance can also
44  result in components of the forces and moments to be missing from the
45  output.
46 
47  Example of function object specification:
48  \verbatim
49  rigidBodySectionalForceGraph
50  {
51  type rigidBodySectionalForceGraph;
52  libs ("librigidBodyForces.so");
53  body beam;
54  patches (beam);
55  axis x;
56  nPoints 101;
57  setFormat raw;
58  writeControl writeTime;
59  }
60  \endverbatim
61 
62 Usage
63  \table
64  Property | Description | Required | Default value
65  type | Type name: rigidBodySectionalForceGraph | yes |
66  body | The name of the rigid body | yes |
67  patches | Patches included in the forces calculation | yes |
68  axis | Local axis normal to the section planes | yes |
69  origin | Local origin of the plot | no | body centroid
70  nPoints | Number of points in the plot | yes |
71  setFormat | Graph output format | yes |
72  p | Pressure field name | no | p
73  U | Velocity field name | no | U
74  rho | Density field name | no | rho
75  phase | Phase name for phase-fraction | no |
76  rhoRef | Reference density | if incompressible |
77  pRef | Reference pressure | no | 0
78  \endtable
79 
80 SourceFiles
81  rigidBodySectionalForceGraph.C
82 
83 \*---------------------------------------------------------------------------*/
84 
85 #ifndef rigidBodySectionalForceGraph_functionObject_H
86 #define rigidBodySectionalForceGraph_functionObject_H
87 
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 namespace Foam
93 {
94 namespace functionObjects
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class rigidBodySectionalForceGraph Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 class rigidBodySectionalForceGraph
102 :
103  public rigidBodySectionalForcesBase
104 {
105  // Private Data
106 
107  //- The distances from the origin to the section planes
108  mutable autoPtr<scalarField> distancesPtr_;
109 
110  //- The number of points in the plot
111  label nPoints_;
112 
113  //- File writer
114  autoPtr<setWriter> formatter_;
115 
116  //- Number of optimisation iterations. Default is 2.
117  label nOptimiseIter_;
118 
119 
120  // Private Member Functions
121 
122  //- Clear the cached weights
123  virtual void clear();
124 
125  //- Return the distances from the origin to the section planes
126  virtual tmp<scalarField> distances() const;
127 
128 
129 public:
130 
131  //- Runtime type information
132  TypeName("rigidBodySectionalForceGraph");
133 
134 
135  // Constructors
136 
137  //- Construct from Time and dictionary
139  (
140  const word& name,
141  const Time& runTime,
142  const dictionary& dict
143  );
144 
145  //- Disallow default bitwise copy construction
147  (
149  ) = delete;
150 
151 
152  //- Destructor
154 
155 
156  // Member Functions
157 
158  //- Read the rigidBodySectionalForceGraph data
159  virtual bool read(const dictionary&);
160 
161  //- Write the rigidBodySectionalForceGraph
162  virtual bool write();
163 
164 
165  // Member Operators
166 
167  //- Disallow default bitwise assignment
168  void operator=(const rigidBodySectionalForceGraph&) = delete;
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace functionObjects
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
const word & name() const
Return the name of this functionObject.
rigidBodySectionalForceGraph(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
void operator=(const rigidBodySectionalForceGraph &)=delete
Disallow default bitwise assignment.
TypeName("rigidBodySectionalForceGraph")
Runtime type information.
virtual bool write()
Write the rigidBodySectionalForceGraph.
virtual bool read(const dictionary &)
Read the rigidBodySectionalForceGraph data.
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