MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / write

Function write

src/functionObjects/forces/forceCoeffs/forceCoeffs.C:183–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182
183bool Foam::functionObjects::forceCoeffs::write()
184{
185 forces::calcForcesMoment();
186
187 if (Pstream::master())
188 {
189 logFiles::write();
190
191 scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
192
193 Field<vector> totForce(force_[0] + force_[1] + force_[2]);
194 Field<vector> totMoment(moment_[0] + moment_[1] + moment_[2]);
195
196 List<Field<scalar>> coeffs(3);
197 coeffs[0].setSize(nBin_);
198 coeffs[1].setSize(nBin_);
199 coeffs[2].setSize(nBin_);
200
201 // lift, drag and moment
202 coeffs[0] = (totForce & liftDir_)/(Aref_*pDyn);
203 coeffs[1] = (totForce & dragDir_)/(Aref_*pDyn);
204 coeffs[2] = (totMoment & pitchAxis_)/(Aref_*lRef_*pDyn);
205
206 scalar Cl = sum(coeffs[0]);
207 scalar Cd = sum(coeffs[1]);
208 scalar Cm = sum(coeffs[2]);
209
210 scalar Clf = Cl/2.0 + Cm;
211 scalar Clr = Cl/2.0 - Cm;
212
213 writeTime(file(MAIN_FILE));
214 file(MAIN_FILE)
215 << tab << Cm << tab << Cd
216 << tab << Cl << tab << Clf << tab << Clr << endl;
217
218 Log << type() << " " << name() << " write:" << nl
219 << " Cm = " << Cm << nl
220 << " Cd = " << Cd << nl
221 << " Cl = " << Cl << nl
222 << " Cl(f) = " << Clf << nl
223 << " Cl(r) = " << Clr << endl;
224
225 if (nBin_ > 1)
226 {
227 if (binCumulative_)
228 {
229 for (label i = 1; i < coeffs[0].size(); i++)
230 {
231 coeffs[0][i] += coeffs[0][i-1];
232 coeffs[1][i] += coeffs[1][i-1];
233 coeffs[2][i] += coeffs[2][i-1];
234 }
235 }
236
237 writeTime(file(BINS_FILE));
238
239 forAll(coeffs[0], i)
240 {

Callers

nothing calls this directly

Calls 8

calcForcesMomentFunction · 0.85
coeffsFunction · 0.85
writeTimeFunction · 0.85
typeEnum · 0.50
nameFunction · 0.50
forAllFunction · 0.50
setSizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected