|
[Sponsors] |
October 17, 2017, 10:29 |
Source Code: Calculation of Drag
|
#1 |
Member
Join Date: Jun 2017
Posts: 73
Rep Power: 9 |
Hi,
I try to understand how OpenFOAM calculates the drag forces and coefficients. In the sourceCode of forceCoeffs.C I have found the following exression: Code:
bool Foam::functionObjects::forceCoeffs::write() { forces::calcForcesMoment(); if (Pstream::master()) { writeFiles::write(); scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_; Field<vector> totForce(force_[0] + force_[1] + force_[2]); Field<vector> totMoment(moment_[0] + moment_[1] + moment_[2]); List<Field<scalar>> coeffs(3); coeffs[0].setSize(nBin_); coeffs[1].setSize(nBin_); coeffs[2].setSize(nBin_); // lift, drag and moment coeffs[0] = (totForce & liftDir_)/(Aref_*pDyn); coeffs[1] = (totForce & dragDir_)/(Aref_*pDyn); coeffs[2] = (totMoment & pitchAxis_)/(Aref_*lRef_*pDyn); scalar Cl = sum(coeffs[0]); scalar Cd = sum(coeffs[1]); scalar Cm = sum(coeffs[2]); Looking in forces.C I have found: Code:
if (directForceDensity_) { const volVectorField& fD = obr_.lookupObject<volVectorField>(fDName_); const fvMesh& mesh = fD.mesh(); const surfaceVectorField::Boundary& Sfb = mesh.Sf().boundaryField(); forAllConstIter(labelHashSet, patchSet_, iter) { label patchi = iter.key(); vectorField Md ( mesh.C().boundaryField()[patchi] - coordSys_.origin() ); scalarField sA(mag(Sfb[patchi])); // Normal force = surfaceUnitNormal*(surfaceNormal & forceDensity) vectorField fN ( Sfb[patchi]/sA *( Sfb[patchi] & fD.boundaryField()[patchi] ) ); // Tangential force (total force minus normal fN) vectorField fT(sA*fD.boundaryField()[patchi] - fN); //- Porous force vectorField fP(Md.size(), Zero); applyBins(Md, fN, fT, fP, mesh.C().boundaryField()[patchi]); } } Does anyone know how OpenFOAM calculates the forces and coefficients? I would be very thankfull for any help. Greetings, Friendly |
|
Tags |
coefficients, drag, force, source code |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] Patches to compile OpenFOAM 2.2 on Mac OS X | gschaider | OpenFOAM Installation | 136 | October 10, 2017 18:25 |
polynomial BC | srv537 | OpenFOAM Pre-Processing | 4 | December 3, 2016 10:07 |
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 | Seroga | OpenFOAM Community Contributions | 9 | June 12, 2015 18:18 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |