2012-09-11 15:42:55 +00:00
|
|
|
{
|
2015-05-17 14:25:35 +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");
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
if(plateID == -1 || cylinderID == -1)
|
|
|
|
{
|
|
|
|
FatalError << "\n Cannot find the plate patch or the cylinder"
|
|
|
|
<< " patch to calculate lift and drag!"
|
|
|
|
<< exit(FatalError);
|
|
|
|
}
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
scalar lift = 0;
|
|
|
|
scalar drag = 0;
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
const vectorField& Sfp = mesh.boundary()[plateID].Sf();
|
|
|
|
forAll(p.boundaryField()[plateID], facei)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
const vectorField& Sfc = mesh.boundary()[cylinderID].Sf();
|
|
|
|
forAll(p.boundaryField()[cylinderID], facei)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2015-05-17 14:25:35 +00:00
|
|
|
scalar width = 0.050668;
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2015-05-17 14:25:35 +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
|
|
|
}
|