CFD Online Logo CFD Online URL
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] Display lift and Drag in paraview

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2013, 04:21
Default Display lift and Drag in paraview
Join Date: Jan 2013
Posts: 31
Rep Power: 13
SamerAli is on a distinguished road
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?
SamerAli is offline   Reply With Quote

Old   May 16, 2013, 12:51
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
its not scalar field, its a scalar (just one value!!!), you can use
"Info" for example
Info << "drag" << drag <<" lift"<< lift <<endl;
to show it in terminal
or you can save it in a txt file
My Personal Website (
Telegram channel (
nimasam is offline   Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation of lift and drag coefficients on airfoil CoolHersheys OpenFOAM Post-Processing 5 September 27, 2021 06:04
How to calculate lift, drag and lift distribution in Star CCM+? israelcasillas94 STAR-CCM+ 4 November 6, 2020 08:35
[OpenFOAM] Calculating Lift and Drag in Paraview (paraFoam) scott ParaView 26 August 22, 2019 06:26
wrong SU2 calculation for lift and drag coefficient for NAC4421 mechy SU2 7 January 9, 2017 05:18
Correct lift but wrong pressure drag - possible? zx Main CFD Forum 4 July 27, 2007 23:38

All times are GMT -4. The time now is 21:37.