Adaptive time stepping is an important tool for controlling the simulation error and enhancing its efficiency in computational fluid dynamics. In this paper, we introduce two adaptive time-stepping algorithms based on the scalar auxiliary variable scheme for the Navier-Stokes equation. One way is to take equidistribution of energy decay to control the variance of the time steps, and in the other way, the relative error is involved to produce time steps. The numerical experiments show that the computational time is significantly saved by these methods.
We consider an incompressible flow contained in some domain in two dimensions, whose boundary is denoted by . The dynamics of the flow is described by the incompressible Navier-Stokes equations, given in a non-dimensional form as follows
where is the fluid velocity, black is the boundary velocity and is the fluid pressure. The body force is known, and is the kinematic viscosity of the fluid. The system is supplemented by the initial condition
and the following often-used condition to fix the pressure values
There have been extensive works for the Navier-Stokes equations. Semi-implicit splitting type schemes de-couple the computations for the velocity and the pressure fields and enjoy the constant coefficient matrices, but they are only conditionally stable (see Guermond et al.1 and the references therein). To alleviate the time step size constraint, unconditionally energy-stable schemes are preferred, but involve the solution of a system of non-linear algebraic equations or a system of linear algebraic equations with a variable and time-dependent coefficient matrix (see e.g. Labovsky et al.2 and Sanderse3). Recently, by introducing a scalar auxiliary energy variable the authors in4 reformulated the incompressible Navier-Stokes equations (1) to (3) into an equivalent gradient-flow system including a linear constant coefficient system and a nonlinear algebraic equation. However, the cost by solving the above nonlinear equation is negligible since it is about a scalar number, not a field function. Numerical experiments show that the computational cost of this algorithm per time step is approximately twice that of the semi-implicit scheme, but the above auxiliary energy is proven to be unconditionally stable in,4 which allows time steps based on the accuracy requirement only.
In many gradient-flow systems, energy evolution may undergo large and small variations at different time intervals. By enjoying the unconditionally energy stability, the scalar auxiliary variable (SAV) methods can be easily combined with an adaptive strategy. Hence, small time steps are only used when the energy variation is large, while larger time steps can be used when the energy variation is small (see e.g. Cheng and Shen5). Unlike applying variable time steps to first-order schemes without affecting the unconditional stability, we shall construct a new SAV scheme by modifying the scheme in,4 in order to preserve unconditional stability for second-order schemes with variable time steps.
The above adaptive time-stepping technique was developed based on the energy derivative in time in6 and also used in7 for the Cahn-Hilliard problem. In Xu and Tang,8 based on the stabilisation method there, one can use a large time step in the computation. The spectral deferred correction methods were proposed in9 and applied in10 to solve the phase field problems. Recently, adaptive time-stepping methods based on the energy were proposed in,11,12 but only first-order accurate in time. Hence, we shall propose the first adaptive SAV time-stepping algorithm for the above reformulated Navier-Stokes problem (see Algorithm 1), which are based on the auxiliary energy and second-order accurate in time.
Methods to produce time steps in simulations by other ways is also widely considered. The authors in5 presented a multiple SAV (MSAV) scheme for the phase field equations, which are extremely efficient when coupled with adaptive time-stepping. Similarly based on the relative errors for the first- and second-order schemes, the second adaptive time stepping algorithm will be presented to shorten the simulation time (see Algorithm 2). Finally, we shall use the numerical examples to illustrate the algorithms.
SAV algorithm and some properties
Reformulated system and semi-discrete schemes
First, we recall the following equivalent formulation to (1) introduced by Lin et al.,4 which is based on the SAV approach:
Introduce the total blackkinetic energy as
where we choose to be a constant such that for all . Then we define
We derive that from the divergence free condition
where denotes the unit normal vector on .
Therefore, the Navier-Stokes equations (1) can be rewritten into an equivalent form
Thus, to approximate this reformulated equivalent system of equations (7), we present the following first- and second-order schemes for variant time steps by modifying the schemes in4 for constant time steps.
Let be an increasing sequence with , and set . We set the ghost and initial condition as
Then given and , we can compute through the first-order scheme:
or the second-order scheme:
with
and
with the boundary condition to be on .
If denotes a generic variable, then in the above equations is the second order approximation of with defined specifically by (11). Furthermore, defined by (10) denotes a second-order explicit approximation of .
If each time step is a constant, that is, , we have
Thus the schemes (8) and (9) go back to the corresponding ones in.4
The main advantage for the above schemes (8) and (9) lies in that they both enjoy the following unconditional energy stability. In the subsequent analysis, we let and denote the inner product of in the domain and , respectively, and the norm .
4 Theorem 2.1 In the absence of the external force and with zero boundary velocity , the first-order scheme (8) satisfies the following property:
where
The proof for the first-order scheme (8) was blackprovided by Lin et al.4 Theorem 2.1, thus we only give a proof for the second-order scheme (9) as follows.
In the absence of the external force and with zero boundary velocity , the second scheme (9) to (11) satisfies the following property:
where
First, taking the inner product of the first equation in (11) with leads to
where we used the divergence free condition. Then we sum up the above equation and the third equation in (11) to obtain
Finally, combined with the following relation
where we used the definitions (15), we obtain the desired stability result (14). □
Solution algorithm and implementation
Even though at first glance both the schemes (8) and (9) look like coupled and implicit systems of equations, in fact they can be implemented in a very efficient way (cf. Lin et al.4), thanks to the fact that and are scalar numbers, not field functions. We next only explain the details to implement the scheme (8), since the ones for the scheme (9) are similar.
First, we introduce a auxiliary variable to separate and as follows
By substituting (16) into (8), we can separate (8) by two linear subproblems, from which we can solve , respectively
and
Substituting (16) into the third equation of (8), then the unknown can be obtained by solving the following algebraic equation
with
Here we can use the Newton’s method to solve (21) with the initial guess , and the cost of the computation is very small compared to the total cost within a time step since it is a scalar nonlinear algebraic equation for .
With known, we can compute the scalar function from (17) and from (16).
Adaptive time-stepping algorithm
We introduce two adaptive time-stepping methods in this section. First, we shall show how to produce the adaptive time step. Then we proposed the adaptive time-stepping algorithms.
An adaptive time step: based on energy: We first use the energy decay to control the variance of the time steps. A transform of discrete energy identities (12) and (14) are and for the first- and second-order schemes, respectively. As we aim at equidistribution of the energy decay, we allow the numerator or to be a constant . Thus the time step turns to or . But we find there is still an unknown term in the denominator. We therefore replace by (or defined by (10)) for the first- (or second-) order scheme to get a computable adaptive time step
An adaptive time step: based on error: Given the solutions at and , we compute by the first-order scheme (8) and by the second-order schemes (9), respectively. Then we can use the following relative error
as the indicator to control the time step. One simple but effective strategy is to update the time step size by using the formula5
where is a relative error, is the time step, is the error tolerance and is an artificial parameter.
Based on the discussion, two adaptive time stepping Algorithms 1 and 2 on equidistribution of the energy decay and the relative error are proposed as below, respectively.
SAV adaptive time-stepping method: Based on energy
Ensure:
1. Set and , compute the problem (8) or (9) with the minimal time step for some steps. Set as the average of the energy decay and set .
2. At the time , compute the time step with formula (23), and then the problem (8) or (9) with time step .
3. Check if energy decay of two successive steps and . If neither, return to Step 2 with time step .
4. If , adjust with an arithmetic average
and set .
5. Set , set and go to Step 2.
SAV adaptive time-stepping method: based on error
Ensure:
1. Set and , compute the problem (8) with the minimal time step for some steps. Set and .
2. At the time , compute by the first order scheme (8) with .
3. Compute by the second order schemes (9) with and .
4. Calculate by formula (24).
5. If return to Step 2 with time step , else update time step .
6. Set , set and go to Step 2.
Numerical experiments
In this section, we implement the adaptive time-stepping methods, Algorithms 1 and 2, for the Navier-Stokes equations on a single computer serially. We use the first-order Lagrange finite element (cf. Girault and Raviart13) to approximate both the velocity and the pressure fields in the space discretization based on a sufficiently small constant mesh size. The Newton iteration method is used to solve the nonlinear algebraic equation (21). The tolerances for the Newton iteration method is set to be and the artificial parameters , can be chosen arbitrarily.
Taylor-Green vortex
We consider the Taylor-Green vortex model (1) on a square domain with the analytical solution as follows
We choose the parameters and Then, the terms , and can be chosen based on the above analytical solution.
This test problem is historically used to assess accuracy, convergence rates and adaptive time stepping in CFD.14,15 Here we also do detailed research on this problem to show the usability of our adaptive time-stepping algorithms. The numerical results are obtained on a grid in space. For Algorithm 1, we use the average energy decay in the time interval as and for Algorithm 2, we choose the parameters and
The comparison of the unknowns. Some pictures of the unknowns at the final time are shown in Figures 1 to 3. The first two ones of Figures 1 and 2 are the numerical results computed by the first-order scheme (8) and second-order schemes (9) with uniform step, respectively, and the last two are the numerical results computed by the first- and second-order schemes in Algorithm 1, respectively. Then the two ones of Figure 3 are the numerical results computed by Algorithm 2. From the pictures, we can see every unknown looks almost the same, the difference of which in norm is about .
The contour of the Taylor-Green vortex problem using first-order scheme in Algorithm 1: (a) velocity (uniform step ), (b) pressure (uniform step ), (c) velocity (adaptive step ) and (d) pressure (adaptive step ).
The contour of the Taylor-Green vortex problem using second-order scheme in Algorithm 1: (a) velocity (uniform step ), (b) pressure (uniform step ), (c) velocity (adaptive step ) and (d) pressure (adaptive step ).
The contour of the Taylor-Green vortex problem using Algorithm 2: (a) velocity (adaptive step ) and (b) pressure (adaptive step ).
The evolution of the energy, relative error and the corresponding time steps. Figure 4 shows the evolution of energy and relative error as well as the corresponding time steps, which are produced by the first-order and second-order adaptive schemes, (8) and (9), of Algorithm 1, respectively, and Figure 5 are produced by Algorithm 2.
The evolution in Algorithm 1: (a) energy decay, (b) the evolution of time steps and (c) CPU time.
The evolution in Algorithm 2 : (a) relative error between first-order and second-order schemes, (b) the evolution of time steps and (c) CPU time.
The computational time. In Figures 4 and 5, ‘time’ labelled in the horizontal coordinate-axis represents the time variable in equation (1) and ‘CPU time’ labelled in the vertical coordinate-axis is the computation cost, from which we can find both adaptive methods do actually save computational time and only take less than one-third of the time of the uniform method.
Lid-driven cavity flow
In order to show validity of the adaptive SAV method, we test lid-driven cavity flow problem. The computational domain is the unite square domain, and the boundary conditions are
We choose the . The streamlines and the time steps by Algorithm 1 are shown in Figure 6.
The evolution in Algorithm 1: (a) streamlines and (b) the evolution of time steps.
Then we choose the . The streamlines and the time steps by Algorithm 1 are shown in Figure 7.
The evolution in Algorithm 2 : (a) streamlines, (b) the evolution of time steps when and (c) the evolution of time steps when .
From the above figures, it can be found that at the beginning the accuracy can be guaranteed only when the time step is very small. With the development of time, the time step can be larger, which indeed saves the computation time compared with the constant time step.
Footnotes
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship and/or publication of this article.
Funding
This work is in part supported by the National Natural Science Foundation of China (no. 11871410), the Natural Science Foundation of Fujian Province of China (nos. 2021J01034, 2018J01004), the Fundamental Research Funds for the Central Universities (no. 20720180001).
ORCID iD
Hongtao Chen
References
1.
GuermondJMinevPShenJ. An overview of projection methods for incompressible flows. Comput Methods Appl Mech Eng2006; 195: 6011–6045.
2.
LabovskyALaytonWManicaCet al.The stabilized extrapolated trapezoidal finite-element method for the Navier-Stokes equations. Comput Methods Appl Mech Eng2009; 198: 958–974.
3.
SanderseB. Energy-conserving Runge-Kutta methods for the incompressible Navier-Stokes equations. J Comput Phys2013; 233: 100–131.
4.
LinLYangZDongS. Numerical approximation of incompressible Navier-Stokes equations based on an auxiliary energy variable. J Comput Phys2019; 388: 1–22.
5.
ChengQShenJ. Multiple scalar auxiliary variable (MSAV) approach and its application to the phase-field vesivle membrane model. SIAM J Sci Comput2018; 40(6): 3982–4006.
6.
QiaoZZhangZTangT. An adaptive time-stepping strategy for the molecular beam epitaxy models. SIAM J Sci Comput2011; 33(3): 1395–1414.
7.
ZhangZQiaoZ. An adaptive time-stepping strategy for the Cahn-Hilliard equation. Commun Comput Phys2012; 11: 1261–1278.
8.
XuCTangT. Stability analysis of large time-stepping methods for epitaxial growth models. SIAM J Numer Anal2006; 44: 1759–1779.
9.
TangTXieHYinX. High-order convergence of spectral deferred correction methods on general quadrature nodes. J Sci Comput2013; 5(1): 1–13.
10.
FengXTangTYangJ. Long time numerical simulations for phase-field problems using p-adaptive spectral deferred correction methods. SIAM J Sci Comput2015; 37(1): 271–294.
11.
LuoFTangTXieH. Parameter-free time adaptivity based on energy evolution for the Cahn-Hilliard equation. Commun Comput Phys2016; 19(5): 1542–1563.
12.
LuoFXieHXieMet al. Adaptive time-stepping algorithms for molecular beam epitaxy: Based on energy or roughness. Appl Math Lett2020; 99: 105991.
13.
GiraultVRaviartP. Finite Element Methods for Navier-Stokes Equations. Berlin Heidelberg: Springer-Verlag, 1986.
14.
ChorinA. The numerical solution of the Navier-Stokes equations for an incompressible fluid. Bull Amer Math Soc1967; 73(6): 928–931.
15.
DeCariaVLaytonWZhaoH. A time-accurate, adaptive discretization for fluid flow problems. Int J Numer Anal Model2020; 17(2): 254–280.