# Lift and drag over a cylinder

**URL:** <https://community.freefem.org/t/lift-and-drag-over-a-cylinder/2654>\
**Category:** General Discussion\
**Created:** [August 14, 2023, 10:38am UTC](https://community.freefem.org/t/lift-and-drag-over-a-cylinder/2654 "2023-08-14T10:38:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erika](https://avatars.discourse-cdn.com/v4/letter/e/47e85d/32.png) [@Erika](https://community.freefem.org/u/Erika)\
**Post date:** [August 14, 2023, 10:38am UTC](https://community.freefem.org/t/lift-and-drag-over-a-cylinder/2654/1 "2023-08-14T10:38:45Z")

</div>

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](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/8/8a5731e9718e2a741fcdd1fc2f168334e3630a60.png)

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

```auto
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

---

<div class="post-metadata">

**Author:** ![marchywka](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@marchywka](https://community.freefem.org/u/marchywka)\
**Post date:** [August 14, 2023, 12:48pm UTC](https://community.freefem.org/t/lift-and-drag-over-a-cylinder/2654/2 "2023-08-14T12:48:12Z")

</div>

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

```auto
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);

```

---

<div class="post-metadata">

**Author:** ![Erika](https://avatars.discourse-cdn.com/v4/letter/e/47e85d/32.png) [@Erika](https://community.freefem.org/u/Erika)\
**Post date:** [August 14, 2023, 1:40pm UTC](https://community.freefem.org/t/lift-and-drag-over-a-cylinder/2654/3 "2023-08-14T13:40:16Z")

</div>

Yes thank you, it works! Thank you again!

---

<div class="post-metadata">

**Author:** ![aszaboa](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/aszaboa/32/2918_2.png) [@aszaboa](https://community.freefem.org/u/aszaboa)\
**Post date:** [August 14, 2023, 2:27pm UTC](https://community.freefem.org/t/lift-and-drag-over-a-cylinder/2654/4 "2023-08-14T14:27:44Z")

</div>

You can find examples for various fluid flow calculations and metrics in FreeFem inthe Stabfem library: [SOURCES\_FREEFEM · master · StabFem / StabFem · GitLab](https://gitlab.com/stabfem/StabFem/-/tree/master/SOURCES_FREEFEM?ref_type=heads)

---

<div class="post-metadata">

**Author:** ![thingway](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/thingway/32/2353_2.png) [@thingway](https://community.freefem.org/u/thingway)\
**Post date:** [January 11, 2024, 8:09am UTC](https://community.freefem.org/t/lift-and-drag-over-a-cylinder/2654/5 "2024-01-11T08:09:57Z")

</div>

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