Understanding the Importance of the CFL Condition in CFD Simulations
When running computational fluid dynamics simulations, we want to make sure that our simulations are accurate. This is important when delivering results at a high fidelity level for mission-critical operations such as when deciding on a final design or feeding Deep Learning with simulation. Whether you work in simulations at an applied mathematics centre or are a CFD user in the industry, we will introduce a core concept linking spatial and temporal resolutions.
One of the crucial factors in high-fidelity CFD (Computational Fluid Dynamics) is a stability condition. The condition is known as the Courant-Friedrichs-Lewy ratio, or simply CFL.
This fundamental concept is rooted in advanced applied mathematics. In fact, CFL governs such parameters as the time step size, grid spacing, and velocity at inlets, among other factors.
In practice, ensuring that the solution updates are in sync with the physical constraints of the flow, the CFL condition allows CFD experts to deliver reliable simulations for various engineering applications. We will explore the meaning of CFL for everyone involved in CFD, without going into too much mathematical detail.
CFL Core Concept
At the heart of the Courant-Friedrichs-Lewy condition is the linear convection equation, which describes the transport of a scalar quantity in a fluid flow. This equation is a cornerstone of CFD simulations. The equation highlights the importance of the characteristic speed of the flow in determining the stability of the numerical method.
The CFL condition stipulates that:
The time step size δ t must be chosen such that the information propagates causally, with the distance traveled in one time step being less than or equal to the grid spacing δ x.
As a stability criterion, CFL ensures that the solution remains bounded and avoids unphysical oscillations or instabilities.
This condition prevents the solution from "leaping" over grid points, maintaining consistency with the entire domain of the problem being simulated. Violating the CFL condition can lead to inaccurate or incorrect results, and loss of numerical stability, rendering the simulation unreliable.
The condition was first described in 1928 by Richard Courant, Kurt Friedrichs, and Hans Lewy; a 1967 version of their seminal paper in English is available (see Bibliography - [1]; the paper is highly mathematical, dealing with topics as hyperbolic PDEs and so on).
The Mathematics of CFL (Simple Version)
We will keep mathematics to a bare minimum in this section.
In CFD simulations, we have a physical domain i.e. the object of the simulation, like a wind tunnel with a car.
The domain is discretized into a grid, or mesh, with a grid spacing denoted as δ x. With a smaller value of δ x, we talk of a finer spatial resolution of the simulation.
Now, many physical situations are static, but in reality, most cases should be time-variable i.e. apart from the three dimensions xyz (lumped into a vector x), we do have to take into consideration also the time variable "t".
Thus, the temporal domain of dependence is also discretized into time steps denoted as δ t, which represents the duration between successive time levels. The smaller the value of δ t, the smaller the time increment and the more accurate the time integration of the solution.
The CFL condition is derived from the requirement that the information should not propagate faster than the physical wave speed in the simulation.
We define the Courant number (Cou) as "C δ t / δ x" where
- C is the wave speed,
- δ t is the time step,
- δ x is the spatial grid spacing
Thus, the physical meaning of the "C δ t" term is how far a fluid element can travel during a single time step δ t, relative to the grid spacing δ x.
Mathematically, the CFL condition is expressed as:
Cou = C × δ t / δ x ≤ CFL_max,
where CFL_max is the maximum allowable Courant number. The value of CFL_max depends on the numerical scheme used to calculate it in the simulation and the stability criterion of the PDE being solved.
What Happens with Courant Number > CFL_max?
- If the CFL number exceeds the maximum allowable value (i.e., CFL > CFL_max), the simulation may become unstable, leading to numerical oscillations or blow-up of the solution.
What Happens with Courant Number < CFL_max?
- On the other hand, if the Courant number is kept below the maximum allowable value (i.e., Courant number ≤ CFL_max), the simulation remains stable and the solution remains accurate.
In Summary - What is the Relationship Between δ x and δ t?
- The relationship between δ x and δ t in the Courant Friedrichs Lewy condition implies that decreasing the grid spacing (i.e., smaller δ x) requires a smaller time step (i.e., smaller δ t) to maintain stability. This is because a smaller grid spacing allows more information to be propagated in a shorter distance, requiring a smaller time step to ensure that the information does not propagate faster than the physical wave speed. Therefore, the CFL condition imposes a constraint on the selection of δ x and δ t, and the two parameters are interrelated.
In this chapter, we laid a simple mathematical guideline for selecting appropriate values of δ x and δ t to ensure numerical stability and accuracy. In summary, the CFL condition establishes a relationship between the grid spacing (δ x) and the time step (δ t) and imposes a constraint on their values to limit and prevent the information from propagating faster than the physical wave speed.
Spatial Grid Spacing δ x of Numerical Domain: Practical Examples and Effect on CFL
We have seen that the spatial grid spacing, denoted as δ x, is a crucial parameter in CFD analysis, as it directly affects the accuracy and efficiency of the solution. Now, let us explore some practical examples of how the spatial grid spacing δ x can affect the CFL condition in CFD simulations.
Example 1: Incompressible Flow Simulation
Consider a CFD simulation of incompressible flow over a flat plate using a finite difference method. The grid spacing δ x is chosen to be large, resulting in a coarse grid. In this case, the CFL condition requires a small time step δt to maintain stability, as the information needs to propagate across larger distances due to the coarse grid. This can significantly increase the computational cost of the simulation, as a small time step may be required for stability, resulting in a longer simulation time.
Example 2: Compressible Flow Simulation
In a CFD simulation of compressible flow, such as supersonic flow over an airfoil, a finer grid spacing δ x is typically required to accurately capture the complex shock waves and other flow features. The CFL condition, in this case, may allow for a larger time step δ t compared to the incompressible flow case, as the finer grid allows information to be propagated across shorter distances. This can result in a more efficient simulation with a shorter computational time.
Example 3: High-Speed Flow Simulation
For simulations involving high-speed flows, such as hypersonic flow, the Courant Friedrichs Lewy condition can impose even stricter constraints on the spatial grid spacing δ x. The shock waves and other flow features in high-speed flows can have very steep gradients, requiring a very fine grid to accurately capture the flow physics. This may result in a significantly smaller δ x, which in turn may require a smaller δ t to satisfy the CFL condition, leading to increased computational cost.
Example 4: Transient Simulations
Generally, during transient simulations, where the flow is changing with time, the CFL condition needs to be satisfied at each time step to maintain numerical stability. If the spatial grid spacing δ x is chosen too large, it may result in the CFL condition being violated, leading to numerical instabilities and inaccurate results. On the other hand, a finer grid spacing δ x may allow for larger time steps δ t, resulting in more efficient simulations.
Numerical Scheme and CFL
Explicit schemes are widely used in CFD simulations due to their simplicity and ease of implementation. In explicit schemes, the solution at the next time step is explicitly computed from the solution at the current time step. The time step δ t is typically chosen based on the CFL condition to ensure numerical stability.
Explicit Methods (More Restrictive)
Explicit schemes are computationally efficient as they allow for larger time steps, but they may be limited by the CFL condition, which imposes constraints on the maximum time step that can be used to solve them. If the time step is chosen too large, the solution may become unstable and produce inaccurate results.
Implicit Methods (Less Restrictive)
On the other hand, implicit schemes are known for their stability and ability to handle stiff or highly transient problems. In implicit schemes, the solution at the next time step is obtained through the solution of a system of equations, where the coefficients are computed implicitly based on the solution at the current and/or next time steps. Implicit schemes do not have strict constraints on the time step as they do not rely solely on the CFL condition for stability. However, implicit methods are computationally more expensive compared to explicit schemes, as they often require the solution of a large system of equations, which can increase the computational cost.
When it comes to the CFL criterion on the Courant Number, implicit schemes are less restrictive compared to explicit schemes. The CFL condition for implicit schemes depends on the characteristics of the numerical scheme and the problem being solved. In some cases, implicit schemes may allow for larger time steps compared to explicit schemes, resulting in more efficient simulations.
CFL Practical Implications
To illustrate the practical implications of the Courant-Friedrichs-Lewy condition, consider a CFD simulation of a wave phenomenon in one dimension. The CFL condition determines the appropriate time step size to accurately capture the propagation of the wave, ensuring that the solution aligns with the physical behavior of the wave equation. This is particularly important for simulations involving rapidly changing flow features, where the characteristic speed of the flow can significantly impact the stability and accuracy of the results.
The CFL condition also comes into play in the context of initial conditions and inlet velocity. The stability of the numerical method depends on the consistency between the initial conditions and the inlet velocity of the flow. If the velocity is too high, the CFL criterion on the Courant Number may require a smaller time step size to ensure that the information propagates causally and the numerical solution remains stable. Similarly, if the initial conditions are not properly accounted for, the CFL condition may need to be adjusted to ensure accurate results.
The CFL condition is often mistaken for either linear stability conditions or nonlinear stability conditions. However, it is crucial to stress that the CFL condition is not adequate in determining the stability of a numerical scheme. In fact, other stability conditions are typically more stringent than the CFL condition.
It is essential to understand that the CFL condition is a necessary condition for the stability of certain numerical methods, particularly those that are based on explicit time integration. This condition determines the maximum allowable time step size that can be used to ensure the stability of the numerical solution.
On the other hand, linear and nonlinear stability conditions are more general stability criteria that can be applied to a wide range of numerical methods, including those based on implicit time integration. These conditions impose additional constraints on the time step size, spatial resolution, and numerical parameters that must be satisfied to guarantee the stability and accuracy of the solution.
Therefore, while the CFL condition is an essential tool for determining the time step size in explicit time integration methods, it should not be regarded as the only stability condition. Other stability criteria, such as linear and nonlinear stability conditions, are equally important and must be considered in the design and analysis of numerical schemes for solving partial differential equations.
The Possible Role of AI
The implications of the CFL condition extend beyond just the stability and accuracy of numerical methods in CFD simulations.
In recent years, there has been growing interest in leveraging artificial intelligence (AI) in CFD simulations to enhance the predictive capabilities and efficiency of simulations. This is already helping several organizations speed up design cycles.
The Courant-Friedrichs-Lewy condition can play a very important role in guiding the development of AI algorithms for CFD simulations, by influencing the choice of time step size and the grid spacing used in training data and prediction steps. The trained AI predictor will then be both inspired by high-fidelity CFD and available for designers.
By implicitly integrating the CFL condition into AI-based CFD simulations, it may be possible to improve the accuracy and efficiency of AI predictions.
Sailing and Marine Engineering
A notable application of CFL is in the field of sailing and marine engineering simulation. For instance, in America's Cup, one of the oldest and most prestigious sailing competitions, CFD simulations play a crucial role in designing and optimizing the performance of sailing vessels. CFL is utilized to determine the appropriate time step size and grid spacing in simulating the complex flow dynamics around the sails, hull, and appendages of the vessels. By accurately capturing the flow behavior, CFD simulations help in improving the performance and efficiency of the vessels, leading to a competitive advantage in the races.
CFD+VoF+CFL...
Most commonly, the type of applications in the marine industry involves both a gaseous (air) and a liquid phase, therefore there is a 2-phase condition where the fluid is quite distinct because of gravity. The interface between air and water should be as crisp as possible. A method to consider both phases is the so-called VoF method. VoF is based on the advection of a phase field function that tracks the interface between two fluids, typically a liquid and a gas phase. The accuracy of the VoF simulation depends on the ability of the numerical scheme to accurately capture the motion of the interface. However, the position of the interface can change rapidly due to complex fluid dynamics, which may cause numerical errors and instability in the solution.
To ensure the stability of the solution, the CFL criterion is applied by limiting the time step size to a fraction of the maximum allowable step size based on the local flow conditions. In VoF simulations, the maximum allowable time step size is often determined by the local interface thickness and the local fluid velocity. By constraining the time step size in this way, the numerical scheme is able to accurately capture the motion of the interface and prevent the formation of unphysical numerical artifacts, such as overshooting and undershooting of the interface position.
A CFL number between 0.5 and 1.0 is often used in VoF simulations, although higher values may be used in some cases. A higher CFL number does not necessarily lead to a faster or more accurate simulation, since it may produce instability and loss of accuracy due to numerical errors.
Conclusions
Understanding the Courant number and associated CFL condition is essential for CFD experts, either working in an applied mathematics center or in engineering departments, as it is a fundamental concept.
Without using high-end mathematics, we have shown how the CFL conditions ensure the stability, accuracy, and reliability of numerical simulations. CFL guides the choice of time step size, grid spacing, and velocity, among other factors, and directly impacts the quality of the results obtained from CFD simulations.
Looking into the future, the role of the CFL condition in CFD simulations will remain important. As CFD continues to evolve and advance, the accuracy, reliability, and efficiency of simulations will continue to be paramount for a wide range of applications, from aerospace and automotive engineering to marine and environmental simulations.
The CFL criterion will continue to serve as a fundamental principle that guides CFD experts in choosing appropriate parameters to ensure stable and accurate simulations.
Bibliography
[1] R. Courant, K. Friedrichs, and H. Lewy, "On the partial difference equations of mathematical physics," IBM J. Res. Develop., 11 (1967), pp. 215–234.