forceCoeffs.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) 2011-2018 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::forceCoeffs
26 
27 Description
28  Extends the forces functionObject by providing lift, drag and moment
29  coefficients. The data can optionally be output into bins, defined in a
30  given direction.
31 
32  Example of function object specification:
33  \verbatim
34  forceCoeffs1
35  {
36  type forceCoeffs;
37  libs ("libforces.so");
38  ...
39  log yes;
40  patches (walls);
41  liftDir (0 1 0);
42  dragDir (-1 0 0);
43  pitchAxis (0 0 1);
44  magUInf 100;
45  lRef 3.5;
46  Aref 2.2;
47 
48  binData
49  {
50  nBin 20;
51  direction (1 0 0);
52  cumulative yes;
53  }
54  }
55  \endverbatim
56 
57 Usage
58  \table
59  Property | Description | Required | Default value
60  type | type name: forceCoeffs | yes |
61  log | write force data to standard output | no | no
62  patches | patches included in the forces calculation | yes |
63  liftDir | lift direction | yes |
64  dragDir | drag direction | yes |
65  pitchAxis | picth axis | yes |
66  magUInf | free stream velocity magnitude | yes |
67  lRef | reference length scale for moment calculations | yes |
68  Aref | reference area | yes |
69  \endtable
70 
71  Bin data is optional, but if the dictionary is present, the entries must
72  be defined according o
73  \table
74  nBin | number of data bins | yes |
75  direction | direction along which bins are defined | yes |
76  cumulative | bin data accumulated with incresing distance | yes |
77  \endtable
78 
79 See also
80  Foam::functionObject
81  Foam::functionObjects::timeControl
82  Foam::functionObjects::forces
83 
84 SourceFiles
85  forceCoeffs.C
86 
87 \*---------------------------------------------------------------------------*/
88 
89 #ifndef functionObjects_forceCoeffs_H
90 #define functionObjects_forceCoeffs_H
91 
92 #include "forces.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 namespace functionObjects
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class forceCoeffs Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class forceCoeffs
106 :
107  public forces
108 {
109  // Private data
110 
111  // Force coefficient geometry
112 
113  //- Lift
114  vector liftDir_;
115 
116  //- Drag
117  vector dragDir_;
118 
119  //- Pitch
120  vector pitchAxis_;
121 
122 
123  // Free-stream conditions
124 
125  //- Velocity magnitude
126  scalar magUInf_;
127 
128 
129  // Reference scales
130 
131  //- Length
132  scalar lRef_;
133 
134  //- Area
135  scalar Aref_;
136 
137 
138  // Private Member Functions
139 
140  //- Disallow default bitwise copy construct
141  forceCoeffs(const forceCoeffs&);
142 
143  //- Disallow default bitwise assignment
144  void operator=(const forceCoeffs&);
145 
146 
147 protected:
148 
149  //- Output file header information
150  virtual void writeFileHeader(const label i);
151 
152 
153 public:
154 
155  //- Runtime type information
156  TypeName("forceCoeffs");
157 
158 
159  // Constructors
160 
161  //- Construct from Time and dictionary
162  forceCoeffs
163  (
164  const word& name,
165  const Time& runTime,
166  const dictionary&
167  );
168 
170  //- Destructor
171  virtual ~forceCoeffs();
172 
173 
174  // Member Functions
175 
176  //- Read the forces data
177  virtual bool read(const dictionary&);
178 
179  //- Execute, currently does nothing
180  virtual bool execute();
181 
182  //- Write the forces
183  virtual bool write();
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace functionObjects
190 } // End namespace Foam
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #endif
195 
196 // ************************************************************************* //
TypeName("forceCoeffs")
Runtime type information.
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
virtual bool write()
Write the forces.
Definition: forceCoeffs.C:190
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
engineTime & runTime
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
virtual bool read(const dictionary &)
Read the forces data.
Definition: forceCoeffs.C:154
virtual void writeFileHeader(const label i)
Output file header information.
Definition: forceCoeffs.C:43
virtual ~forceCoeffs()
Destructor.
Definition: forceCoeffs.C:148
virtual bool execute()
Execute, currently does nothing.
Definition: forceCoeffs.C:184
Namespace for OpenFOAM.