Courant–Friedrichs–Lewy (CFL) condition for Navier Stokes Equation - Poiseuille Flow

Consider the implementation of the Poiseuille flow given in the FEniCSx tutorial: Test problem 1: Channel flow (Poiseuille flow) — FEniCSx tutorial (jsdokken.com)

This problem was initialized as:

from mpi4py import MPI
from petsc4py import PETSc
import numpy as np
import pyvista

from dolfinx.fem import Constant, Function, FunctionSpace, assemble_scalar, dirichletbc, form, locate_dofs_geometrical
from dolfinx.fem.petsc import assemble_matrix, assemble_vector, apply_lifting, create_vector, set_bc
from dolfinx.io import VTXWriter
from dolfinx.mesh import create_unit_square
from dolfinx.plot import vtk_mesh
from ufl import (FacetNormal, FiniteElement, Identity, TestFunction, TrialFunction, VectorElement,
                 div, dot, ds, dx, inner, lhs, nabla_grad, rhs, sym)

mesh = create_unit_square(MPI.COMM_WORLD, 10, 10)
t = 0
T = 10
num_steps = 500
dt = T / num_steps

This gives the mesh size \Delta x=0.1 and Time step dt=0.02
I wanted to see whether Courant–Friedrichs–Lewy (CFL) condition is satisfied for this problem.

The question I’m having is, CFL condition is defined as C\frac{dt}{\Delta x} where C represent the maximum velocity. However, before solving this problem we do not have that value. Notice that the pressure values are given as boundary conditions (Not the velocity) in this problem.

def inflow(x):
    return np.isclose(x[0], 0)
inflow_dofs = locate_dofs_geometrical(Q, inflow)
bc_inflow = dirichletbc(PETSc.ScalarType(8), inflow_dofs, Q)

So, may I please know whether there is a smart way to figure out whether the choice of \frac{dt}{\Delta x} is appropriate

For the Pouiseuille flow one can estimate the maximum velocity amplitude based on the pressure drop: Hagen–Poiseuille equation - Wikipedia

Hi @dokken let’s say my flow is not exactly Poiseuille. So, it doesn’t have an analytical solution (Sorry I didn’t mention this in the description). And it is on a complicated geometry.

But I use the same code you have provided. That means I define input and output pressure values. And calculate the velocity on the nodes of the mesh by solving the Navier Stokes equation using the variational formulation given in Test problem 1: Channel flow (Poiseuille flow) — FEniCSx tutorial (jsdokken.com)

So, basically suppose I am solving the Poiseuille example in the tutorial without knowing the analytical answer.
In such a case, what should I do with the CFL conditions?

In general I would not advice to use pressure conditions on inlets.

I guess your problem is motivated by a physical problem. Do you have estimates from the problem you are solving wrt ~velocity amplitudes.

Another option would be to solve a Stokes problem to get an initial flow profile, and use the Max value of that as an estimate.

@dokken Thank you for the Suggestion. Yes I’m modeling a cerebral bifurcation that looks like this:
image

And in reality, they don’t have the velocity measurements on these arteries. Anyway, I do have some values that I have obtained for mesh size and the time steps by trial-and-error methods.

So, I was wondering whether we can optimize the choice of those values in a way that it doesn’t violate the CFL conditions.

But seems like it doesn’t have a direct way to get an idea about the ratio, \frac{dt}{\Delta x} without knowing the velocity. Am I correct?

I guess you know an upper bound of the fluid velocity an an artery, i would use that as an initial estimate if you dont want to solve stokes eq.

1 Like

Thanks @dokken I will consider that