33 namespace functionObjects
49 writeHeader(file(i),
"Force coefficients");
50 writeHeaderValue(file(i),
"liftDir", liftDir_);
51 writeHeaderValue(file(i),
"dragDir", dragDir_);
52 writeHeaderValue(file(i),
"pitchAxis", pitchAxis_);
53 writeHeaderValue(file(i),
"magUInf", magUInf_);
54 writeHeaderValue(file(i),
"lRef", lRef_);
55 writeHeaderValue(file(i),
"Aref", Aref_);
56 writeHeaderValue(file(i),
"CofR", coordSys_.origin());
57 writeCommented(file(i),
"Time");
58 writeTabbed(file(i),
"Cm");
59 writeTabbed(file(i),
"Cd");
60 writeTabbed(file(i),
"Cl");
61 writeTabbed(file(i),
"Cl(f)");
62 writeTabbed(file(i),
"Cl(r)");
68 writeHeader(file(i),
"Force coefficient bins");
69 writeHeaderValue(file(i),
"bins", nBin_);
70 writeHeaderValue(file(i),
"start", binMin_);
71 writeHeaderValue(file(i),
"delta", binDx_);
72 writeHeaderValue(file(i),
"direction", binDir_);
75 writeCommented(file(i),
"x co-ords :");
78 binPoints[pointi] = (binMin_ + (pointi + 1)*binDx_)*binDir_;
79 file(i) <<
tab << binPoints[pointi].x();
83 writeCommented(file(i),
"y co-ords :");
86 file(i) <<
tab << binPoints[pointi].y();
90 writeCommented(file(i),
"z co-ords :");
93 file(i) <<
tab << binPoints[pointi].z();
97 writeCommented(file(i),
"Time");
99 for (
label j = 0; j < nBin_; j++)
102 writeTabbed(file(i),
"Cm" + jn);
103 writeTabbed(file(i),
"Cd" + jn);
104 writeTabbed(file(i),
"Cl" + jn);
110 <<
"Unhandled file index: " << i
120 Foam::functionObjects::forceCoeffs::forceCoeffs
127 forces(name, runTime, dict),
152 dict.
lookup(
"liftDir") >> liftDir_;
153 dict.
lookup(
"dragDir") >> dragDir_;
154 dict.
lookup(
"pitchAxis") >> pitchAxis_;
157 dict.
lookup(
"magUInf") >> magUInf_;
160 dict.
lookup(
"lRef") >> lRef_;
161 dict.
lookup(
"Aref") >> Aref_;
181 scalar
pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
184 Field<vector> totMoment(moment_[0] + moment_[1] + moment_[2]);
192 coeffs[0] = (totForce & liftDir_)/(Aref_*pDyn);
193 coeffs[1] = (totForce & dragDir_)/(Aref_*pDyn);
194 coeffs[2] = (totMoment & pitchAxis_)/(Aref_*lRef_*pDyn);
196 scalar Cl =
sum(coeffs[0]);
197 scalar Cd =
sum(coeffs[1]);
198 scalar Cm =
sum(coeffs[2]);
200 scalar Clf = Cl/2.0 + Cm;
201 scalar Clr = Cl/2.0 - Cm;
209 <<
" Cm = " << Cm <<
nl 210 <<
" Cd = " << Cd <<
nl 211 <<
" Cl = " << Cl <<
nl 212 <<
" Cl(f) = " << Clf <<
nl 213 <<
" Cl(r) = " << Clr <<
endl;
219 for (
label i = 1; i < coeffs[0].
size(); i++)
221 coeffs[0][i] += coeffs[0][i-1];
222 coeffs[1][i] += coeffs[1][i-1];
223 coeffs[2][i] += coeffs[2][i-1];
232 <<
tab << coeffs[2][i]
233 <<
tab << coeffs[1][i]
234 <<
tab << coeffs[0][i];
#define forAll(list, i)
Loop across all elements in list.
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.
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 &)
A class for handling words, derived from string.
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
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.
void setSize(const label)
Reset size of List.
virtual ~forceCoeffs()
Destructor.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
addToRunTimeSelectionTable(functionObject, blendingFactor, dictionary)
virtual bool write()
Write function.
#define Log
Report write to Foam::Info if the local log switch is true.
volScalarField pDyn(IOobject("pDyn", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, dimensionedScalar("zero", dimPressure, 0.0))
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
This function object calculates the forces and moments by integrating the pressure and skin-friction ...
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.