33 namespace functionObjects
47 case fileID::mainFile:
52 writeHeaderValue(
file(i),
"liftDir", liftDir_);
53 writeHeaderValue(
file(i),
"dragDir", dragDir_);
54 writeHeaderValue(
file(i),
"pitchAxis", pitchAxis_);
55 writeHeaderValue(
file(i),
"magUInf", magUInf_);
56 writeHeaderValue(
file(i),
"lRef", lRef_);
57 writeHeaderValue(
file(i),
"Aref", Aref_);
58 writeHeaderValue(
file(i),
"CofR", coordSys_.origin());
59 writeCommented(
file(i),
"Time");
60 writeTabbed(
file(i),
"Cm");
61 writeTabbed(
file(i),
"Cd");
62 writeTabbed(
file(i),
"Cl");
63 writeTabbed(
file(i),
"Cl(f)");
64 writeTabbed(
file(i),
"Cl(r)");
68 case fileID::binsFile:
73 writeHeaderValue(
file(i),
"bins", nBin_);
74 writeHeaderValue(
file(i),
"start", binMin_);
75 writeHeaderValue(
file(i),
"delta", binDx_);
76 writeHeaderValue(
file(i),
"direction", binDir_);
79 writeCommented(
file(i),
"x co-ords :");
82 binPoints[pointi] = (binMin_ + (pointi + 1)*binDx_)*binDir_;
83 file(i) <<
tab << binPoints[pointi].x();
87 writeCommented(
file(i),
"y co-ords :");
90 file(i) <<
tab << binPoints[pointi].y();
94 writeCommented(
file(i),
"z co-ords :");
97 file(i) <<
tab << binPoints[pointi].z();
101 writeCommented(
file(i),
"Time");
103 for (
label j = 0; j < nBin_; j++)
106 writeTabbed(
file(i),
"Cm" + jn);
107 writeTabbed(
file(i),
"Cd" + jn);
108 writeTabbed(
file(i),
"Cl" + jn);
116 <<
"Unhandled file index: " << i
134 forces(name, runTime, dict),
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.
virtual bool write()
Write function.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual bool write()
Write the forces.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
virtual bool read(const dictionary &)
Read the forces data.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
virtual bool read(const dictionary &)
Read the forces data.
bool read(const char *, int32_t &)
void writeHeader(std::ostream &, const bool isBinary, const std::string &title)
Write header.
A class for handling words, derived from string.
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
forceCoeffs(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
virtual void calcForcesMoment()
Calculate the forces and moments.
errorManip< error > abort(error &err)
virtual void writeFileHeader(const label i)
Output file header information.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
void setSize(const label)
Reset size of List.
virtual ~forceCoeffs()
Destructor.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
#define Log
Report write to Foam::Info if the local log switch is true.
dimensioned< scalar > mag(const dimensioned< Type > &)
Calculates the forces and moments by integrating the pressure and skin-friction forces over a given l...
fileID
Enumeration for ensuring the right file is accessed.
virtual bool execute()
Execute, currently does nothing.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.