CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Paraview & paraFoam (http://www.cfd-online.com/Forums/openfoam-paraview/)
-   -   Display lift and Drag in paraview (http://www.cfd-online.com/Forums/openfoam-paraview/117352-display-lift-drag-paraview.html)

SamerAli May 7, 2013 04:21

Display lift and Drag in paraview
 
Dear all

I am using openfoam 1.6-ext and i am testing a solver on a Turek Benchmark (oscillating elastic flap in a laminar incompressible flow) and i want to see the lift and drag on the flap, i included a header file in my main .C file that calculates the lift and drag:

scalar lift = 0;
scalar drag = 0;

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;
}

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;
}

how can i know see these scalar fields in paraview?

nimasam May 16, 2013 12:51

its not scalar field, its a scalar :) (just one value!!!), you can use
"Info" for example
Code:

Info << "drag" << drag <<" lift"<< lift <<endl;
to show it in terminal
or you can save it in a txt file


All times are GMT -4. The time now is 16:27.