33 namespace functionObjects
83 file(i) <<
tab << binPoints[pointi].x();
90 file(i) <<
tab << binPoints[pointi].y();
97 file(i) <<
tab << binPoints[pointi].z();
116 <<
"Unhandled file index: " << i
161 dict.lookup(
"liftDir") >> liftDir_;
162 liftDir_ /=
mag(liftDir_);
164 dict.lookup(
"dragDir") >> dragDir_;
165 dragDir_ /=
mag(dragDir_);
167 dict.lookup(
"pitchAxis") >> pitchAxis_;
168 pitchAxis_ /=
mag(pitchAxis_);
171 dict.lookup(
"magUInf") >> magUInf_;
174 dict.lookup(
"rhoInf") >> rhoRef_;
177 dict.lookup(
"lRef") >> lRef_;
178 dict.lookup(
"Aref") >> Aref_;
198 scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
201 Field<vector> totMoment(moment_[0] + moment_[1] + moment_[2]);
209 coeffs[0] = (totForce & liftDir_)/(Aref_*pDyn);
210 coeffs[1] = (totForce & dragDir_)/(Aref_*pDyn);
211 coeffs[2] = (totMoment & pitchAxis_)/(Aref_*lRef_*pDyn);
213 scalar Cl =
sum(coeffs[0]);
214 scalar Cd =
sum(coeffs[1]);
215 scalar Cm =
sum(coeffs[2]);
217 scalar Clf = Cl/2.0 + Cm;
218 scalar Clr = Cl/2.0 - Cm;
220 writeTime(
file(fileID::mainFile));
221 file(fileID::mainFile)
226 <<
" Cm = " << Cm <<
nl
227 <<
" Cd = " << Cd <<
nl
228 <<
" Cl = " << Cl <<
nl
229 <<
" Cl(f) = " << Clf <<
nl
230 <<
" Cl(r) = " << Clr <<
endl;
236 for (
label i = 1; i < coeffs[0].
size(); i++)
238 coeffs[0][i] += coeffs[0][i-1];
239 coeffs[1][i] += coeffs[1][i-1];
240 coeffs[2][i] += coeffs[2][i-1];
244 writeTime(
file(fileID::binsFile));
248 file(fileID::binsFile)
249 <<
tab << coeffs[2][i]
250 <<
tab << coeffs[1][i]
251 <<
tab << coeffs[0][i];
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool master(const label communicator=0)
Am I the master process.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Abstract base-class for Time/database functionObjects.
Extends the forces functionObject by providing lift, drag and moment coefficients....
forceCoeffs(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
virtual void writeFileHeader(const label i)
Output file header information.
virtual ~forceCoeffs()
Destructor.
virtual bool execute()
Execute, currently does nothing.
virtual bool write()
Write the forces.
virtual bool read(const dictionary &)
Read the forces data.
virtual void calcForcesMoments()
Calculate the forces and moments.
scalar binMin_
Minimum bin bounds.
label nBin_
Number of bins.
OFstream & file()
Return access to the file (if only 1)
fileID
Enumeration for ensuring the right file is accessed.
vector binDir_
Direction used to determine bin orientation.
scalar binDx_
Distance between bin divisions.
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
vector CofR_
Centre of rotation.
virtual bool read(const dictionary &)
Read the forces data.
virtual bool write()
Write function.
void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
Write a (commented) header property and value pair.
void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define Log
Report write to Foam::Info if the local log switch is true.
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
errorManip< error > abort(error &err)
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.