# Navier-Stokes Secondary Flows (Dean Drag Forces) in a curved channel

**URL:** <https://fenicsproject.discourse.group/t/navier-stokes-secondary-flows-dean-drag-forces-in-a-curved-channel/4522>\
**Category:** variational formulation\
**Created:** [November 11, 2020, 5:03pm UTC](https://fenicsproject.discourse.group/t/navier-stokes-secondary-flows-dean-drag-forces-in-a-curved-channel/4522 "2020-11-11T17:03:51Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Matt688](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/matt688/32/3538_2.png) [@Matt688](https://fenicsproject.discourse.group/u/Matt688)\
**Post date:** [November 21, 2020, 4:57pm UTC](https://fenicsproject.discourse.group/t/navier-stokes-secondary-flows-dean-drag-forces-in-a-curved-channel/4522/5 "2020-11-21T16:57:09Z")

</div>

Hey dokken and all,

The problem is solved, see the solution below.

I’ve solved the issues which were mainly my wrong assumptions about how I **visualise secondary flows** and the **time step** required to produce these secondary flow effects.

Firstly, the reason why I had biased towards the positive X axis (if Y-Z plane cut) or negative Y axis (if X-Z plane cut) was that I took a plane which was perpendicular to the X, Y or Z axis. I did not take a plane which was perpendicular to my model and flow. This meant, if I was slightly off perpendicular to the model, I would start becoming parallel to flow and generate flow bias. The flow bias was raised in the comments section of the [COMSOL Demo](https://www.youtube.com/watch?v=W_WRiO-MsYE). Ensuring planes are taken perpendicular to the model, in my case the centre of the X axis, resulted in no flow bias (see images below).

Secondly, if the time step is too large, the simulation makes assumptions regarding the vectors and velocity through several cells of the mesh. Equally, too small of a time step, the vectors may not form correctly. These are obvious factors for simulations but they become more apparent when studying secondary flows. Thinking about how some systems decide on an appropriate time step, I came across Courant-Friedrichs-Lewy (CFL) condition. The CFL condition takes into account the velocity of the system, the smallest cell size of the mesh and a Courant number to aim for, in my case 0.5 as it had to be lower than 1 due to the explicit simulation. A [CFL example was available in FEniCS](https://fenicsproject.discourse.group/t/cant-run-navier-stokes-solution-in-parallel/4003/3) in this forum which I adapted to make it velocity dependent than viscosity. The value calculated was dt = 9.73e-5 seconds which was a little smaller dt = 6.25e-4 seconds in the example I presented earlier.

```auto
    # Calculate dt as per CFL (with CFLmax = 0.5)
    # dt = 0.5*deltaX**2/mu - I believe is a Taylor series expansion including numerical diffusion, or numerical viscosity
    # Courant Number (<1) * smallest cell size in mesh / velocity magnitude
    dt = (0.5*deltaX)/mu 
    # dt = 1E-2*dt # Just for testing

```

After testing, the system produced Dean Drag forces in a stable manner.

More information about [CFL can be found here](https://www.simscale.com/blog/2017/08/cfl-condition/). Images below show plane in the middle of the curved microchannel and of the Y-Z plane presenting Dean Drag forces. Also, I have implemented this problem within BERNAISE, a FEniCS based CFD simulator that can do phase field and electrochemistry. The [example in BERNAISE is available here](https://github.com/MattH688/BERNAISE/blob/master/problems/flow_curved_channel.py), with the [mesh available here](https://github.com/MattH688/BERNAISE/blob/master/meshes/curvedMicrochannel.tar.gz) and a [Paraview state](https://github.com/MattH688/BERNAISE/blob/master/analysis_scripts/CurvedMicrochannelState.pvsm) which _should_ load the data similar to the images presented below.

 ![DeanDragForcesMid](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/2/25eb529deefc54988538ba8ad5c4533e1d2cb6b9.png)  
 ![DeanDragForcesFinally](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/e/e2496d39007a7dab50a6bce4e7d101f12e9812ff.jpeg)

---

_[View the full topic](https://fenicsproject.discourse.group/t/navier-stokes-secondary-flows-dean-drag-forces-in-a-curved-channel/4522)._
