Hi,

I am currently trying to calculate the drag / friction force in a fluid simulation.

In order to obtain the velocity and the pressure field, I have already solved the Stokes / Navier-Stokes equation, as described in the examples on the documentation website.

Now I need the gradient of the velocity normal to a boundary. Unfortunately, the gradient of the velocity is 0 on the boundaries with a dirichlet condition, making it impossible to determine the shear stresses on these surfaces.

I am using the Grad()-function like this:

velocity = gfu.components[0]

c_u = GridFunction(Q)

c_u.Set(velocity[0])

c_w = GridFunction(Q)

c_w.Set(velocity[2])

dudz = Grad(c_u)[2]

dwdx = Grad(c_w)[0]

tau = eta * (dudz + dwdx)

F_fric = Integrate(cf = tau,mesh=mesh,VOL_or_BND=BND,definedon=mesh.Boundaries(‘bottom’))

Is there any way to calculate the gradient of the velocity correctly on a surface with a dirichlet boundary condition?

I also tried to determine the tau tensor via the formula for incompressible fluids:

tau = eta *(Grad(velocity)+Grad(velocity).trans)
F_fric = Integrate(cf = tau*normal,mesh=mesh,VOL_or_BND=BND,definedon=mesh.Boundaries(‘bottom’))

But the gradient on “bottom” (dirichlet boundary condition) is always calculated to 0, this is also visible in the netgen visualisation.

Using grad() instead of Grad() doesn’t work, either.

I hope, I made my problem clear.

Thank you for your help!

Best regards,

Niklas