db7fac3f24
git-svn-id: https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Core/OpenFOAM-1.5-dev@1731 e4e07f05-0c2f-0410-a05a-b8ba57e0c909
68 lines
1.7 KiB
C
68 lines
1.7 KiB
C
if(Pstream::master())
|
|
{
|
|
// const scalarField& magSf =
|
|
// mesh.magSf().boundaryField()[interface.aPatchID()];
|
|
|
|
// vectorField n =
|
|
// mesh.Sf().boundaryField()[interface.aPatchID()]/magSf;
|
|
|
|
// const scalarField& P = p.boundaryField()[interface.aPatchID()];
|
|
|
|
// vectorField pressureForces = magSf*P*n;
|
|
|
|
// vectorField snGradU =
|
|
// U.boundaryField()[interface.aPatchID()].snGrad();
|
|
|
|
// vectorField viscousForces =
|
|
// - interface.muFluidA().value()*magSf*
|
|
// (
|
|
// snGradU
|
|
// + ((n*n)&snGradU)
|
|
// + (fac::grad(interface.Us())&interface.aMesh().faceAreaNormals())
|
|
// ().internalField()
|
|
// );
|
|
|
|
vector totalPressureForce = -interface.totalPressureForce();
|
|
|
|
vector totalViscousForce = -interface.totalViscousForce();
|
|
|
|
vector totalForce = totalPressureForce + totalViscousForce;
|
|
|
|
|
|
vector dragDir;
|
|
scalar Uref;
|
|
|
|
if(mag(UF.value()) > SMALL)
|
|
{
|
|
dragDir = - UF.value()/mag(UF.value());
|
|
Uref = mag(UF.value());
|
|
}
|
|
else
|
|
{
|
|
dragDir = interface.g().value()/mag(interface.g().value());
|
|
Uref = SMALL;
|
|
}
|
|
|
|
|
|
scalar Aref =
|
|
sum
|
|
(
|
|
(dragDir&mesh.Sf().boundaryField()[interface.aPatchID()])*
|
|
pos(dragDir&mesh.Sf().boundaryField()[interface.aPatchID()])
|
|
);
|
|
|
|
|
|
scalar drag =
|
|
(dragDir&totalForce)/
|
|
(0.5*interface.rhoFluidA().value()*sqr(Uref)*Aref);
|
|
|
|
|
|
scalar lift =
|
|
mag((I - dragDir*dragDir)&totalForce)/
|
|
(0.5*interface.rhoFluidA().value()*sqr(Uref)*Aref);
|
|
|
|
|
|
forcesFile << runTime.value() << tab;
|
|
|
|
forcesFile << drag << tab << lift << endl;
|
|
}
|