Lift and drag over a cylinder

Hello everyone, I am writing a mesh code and I need to compute the lift and the drag over a cylindrical surface. The computation I need to implement is the following one:

Schermata del 2023-08-14 12-37-21

and I have tried to implement them in the following way:

Wh un = [u1, u2]'*[N.x, N.y]; //normal component of the velocity
Wh ut = un*N.x + un*N.y; //tangential component of the velocity
Vh gradN = grad(ut)'*[N.x, N.y]; 
real drag = int1d(Th, 3)(rho*nu*gradN*N.y - p*N.x); 
real lift = int1d(Th, 3)(-rho*nu*gradN*N.x + p*N.y);

However, I am quite sure that I have not compute in the correct way the tangential component of the velocity but I am not able to find an alternative way to describe it. Can you help me please?

Thank you in advance and have a nice day,

Erika

1 Like

I guess I would write this although likely erorrs includings signs,
Does this help?

Wh un = [u1, u2]'*[N.x, N.y]; //normal component of the velocity
// AFAICT this should be z x n altough IIRC FF
// has some tangential thing but I never use it. 
Wh ut = [u1, u2]'*[N.y, -N.x]; //tangential component of the velocity
//Wh ut = un*N.x + un*N.y; //tangential component of the velocity
Vh gradN = grad(ut)'*[N.x, N.y]; 
// I take it drag pushed in +x dir 
real drag = int1d(Th, 3)(rho*nu*gradN*N.y - p*N.x); 
// this does not look consistent with your posted Fl due to sign
// if lift is up static pressure on ny<0 should be up for
// outward normal I guess . 
real lift = int1d(Th, 3)(-rho*nu*gradN*N.x + p*N.y);

Yes thank you, it works! Thank you again!

You can find examples for various fluid flow calculations and metrics in FreeFem inthe Stabfem library: SOURCES_FREEFEM · master · StabFem / StabFem · GitLab

1 Like

Can you share your program? I’ve used both of your methods and they don’t work. Thank you very much.