I have developed my own 3D Finite Volume Navier-Stokes solver based on projection method for nonuniform grid. I am looking to incorporate automatic timestep adjustment at each time step based on velocity. Is there any simple technique or procedure to calculate the size of timestep at each step for this problem?

  • 1
    $\begingroup$ Do you mean a CFL condition? $\endgroup$
    – EMP
    Commented May 27, 2019 at 6:01
  • $\begingroup$ CFL condition and/or grid Fourier condition. How to specify the algorithm for new timestep based on them, especially for nonuniform grid? $\endgroup$ Commented May 27, 2019 at 14:37
  • $\begingroup$ Isn't your equation nonlinear? $\endgroup$
    – nicoguaro
    Commented May 27, 2019 at 15:04
  • $\begingroup$ Are you solving this to steady state or time accurate? How did you develop a 3D FV code without knowing how to implement a feasible timestep? Are you cell or vertex based? What type of elements are you using and what order are you? We need more information. $\endgroup$
    – EMP
    Commented May 27, 2019 at 15:54
  • $\begingroup$ I am solving it to steady state. So far, I had manually calculated the timestep for each case based on the CFL condition. My code is cell-based for a Cartesian grid. And yes, the equation is nonlinear. $\endgroup$ Commented May 28, 2019 at 7:51

2 Answers 2


Yes! Normally what's done is called Method of Lines. Essentially, you discretize in space to get all of your operators, but instead of discretizing the time component, you leave that derivative along. Now you have a system of ODEs. Then you call an ODE solver like SUNDIALS or DifferentialEquations.jl which have tools for handling the sparsity of a PDE-derived ODE system (sparse factorization, preconditioned GMRES, IMEX integrators, etc.).

This describes the approach a bit and the second example in this tutorial shows how to build and optimize an ODE solver for a PDE semi-discretization.


For flow solvers, the general rule is that the time step needs to satisfy some kind of "CFL condition", named after Courant, Friedrichs, and Lewy. This means that $$ \Delta t \le C \min_{K} \frac{h_K}{\|\mathbf u\|_{L^\infty(K)}} $$ In other words, the time step must be proportional to the (minimum over all cells $K$) of the ratio of the mesh size $h_K$ and the velocity on that cell.

For explicit time stepping methods, this is a theoretical requirement: If you violate the condition (i.e., choose the time step too large) then the solution will become unstable. Each time stepping method leads to a particular value of the constant $C$.

For implicit time stepping methods, you can violate the condition without becoming unstable, but you will generally obtain a not-very-accurate solution if you choose the time step too large. That's because, if you think of it in a space-time diagram, a large time step with a small mesh size results in very elongated space-time cells. So people choose $C=1$ or $C=2$, or maybe even moderately larger values, but nothing crazy.

The condition above gives you a way to compute a time step adaptively.

  • $\begingroup$ Thank you for your answer as it is closer to my requirement. But I have found a more comprehensive method. $\endgroup$ Commented May 29, 2019 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.