2012-09-11 15:42:55 +00:00
|
|
|
{
|
|
|
|
//- calculate lift and drag for plate and cylinder due to pressure (ignore shear stress)
|
|
|
|
label plateID = mesh.boundaryMesh().findPatchID("plate");
|
|
|
|
label cylinderID = mesh.boundaryMesh().findPatchID("cylinder");
|
|
|
|
|
|
|
|
if(plateID == -1 || cylinderID == -1)
|
2013-07-18 01:43:15 +00:00
|
|
|
{
|
2012-09-11 15:42:55 +00:00
|
|
|
FatalError << "\n Cannot find the plate patch or the cylinder"
|
2013-07-18 01:43:15 +00:00
|
|
|
<< " patch to calculate lift and drag!"
|
|
|
|
<< exit(FatalError);
|
|
|
|
}
|
2012-09-11 15:42:55 +00:00
|
|
|
|
|
|
|
scalar lift = 0;
|
|
|
|
scalar drag = 0;
|
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
const vectorField& Sfp = mesh.boundary()[plateID].Sf();
|
2012-09-11 15:42:55 +00:00
|
|
|
forAll(p.boundaryField()[plateID], facei)
|
|
|
|
{
|
2013-07-18 01:43:15 +00:00
|
|
|
vector faceForce = p.boundaryField()[plateID][facei] * Sfp[facei];
|
|
|
|
lift += vector(0,1,0) & faceForce;
|
|
|
|
drag += vector(1,0,0) & faceForce;
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
const vectorField& Sfc = mesh.boundary()[cylinderID].Sf();
|
2012-09-11 15:42:55 +00:00
|
|
|
forAll(p.boundaryField()[cylinderID], facei)
|
|
|
|
{
|
2013-07-18 01:43:15 +00:00
|
|
|
vector faceForce = p.boundaryField()[cylinderID][facei] * Sfc[facei];
|
|
|
|
lift += vector(0,1,0) & faceForce;
|
|
|
|
drag += vector(1,0,0) & faceForce;
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
scalar width = 0.050668;
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-07-18 01:43:15 +00:00
|
|
|
Info << "Total lift on the cylinder and plate boundaries is " << lift << " N, per unit width is " << (lift/width) << " N\n"
|
|
|
|
<< "Total drag on the cylinder and plate boundaries is " << drag << " N, per unit width is " << (drag/width) << " N\n"
|
|
|
|
<< endl;
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|