Nov 13, 2007 - time stepping approach developed by Müller and Stiriba in [17] in ...... [7] Albert Cohen, Mahmoud S. Kaber, Siegfried Müller, and Marie Postel.
Local time stepping applied to implicit-explicit methods for hyperbolic systems F. Coquel∗, Q. L. Nguyen†, M. Postel∗ and Q. H. Tran† November 13, 2007
Abstract In the context of systems of nonlinear conservation laws it can be crucial to use adaptive grids in order to correctly simulate the singularities of the solution over long time ranges while keeping the computing time within acceptable bounds. The adaptive space grid must vary in time according to the local smoothness of the solution. More sophisticated and recent methods also adapt the time step locally to the space discretization according to the stability condition. We present here such a method designed for an explicit-implicit Lagrange projection scheme, addressing physical problems where slow kinematic waves coexists with fast acoustic ones. Numerical simulations are presented to validate the algorithms in terms of robustness and efficiency.
keywords: Hyperbolic PDE, Time varying adaptive grid, Local Time Stepping, implicitexplicit
1 Introduction Our scope of interest is the accurate numerical simulation of highly nonlinear conservative laws. The solutions of such systems of PDEs exhibit localized and moving singularities which require costly numerical schemes. At the same time realistic applications often require simulation of the phenomenon on very long time range. As developed in [1], we are interested in multiphase flows applications presenting the particularity of two scale wavelengths: a slow kinematic one which is the phenomenon of interest for the engineers, and fast acoustic waves arising from the highly nonlinear physics. This will induce very small time steps when treated explicitly. This discrepancy between kinematic and acoustic speeds can be advantageously dealt with in a Lagrangian projection formulation, as detailed in [10, 9]. This allows to resolve the acoustic part of the solution with an implicit scheme, therefore relaxing the time step bound. The kinematic components are solved explicitly, ensuring in turn the required precision. ∗ Laboratoire Jacques-Louis Lions, CNRS et Universit´e Pierre et Marie Curie, B.C. 187, 75252 Paris Cedex 05, France † D´epartement Math´ematiques Appliqu´ees, Institut Franc¸ais du P´etrole, 1 et 4 avenue de Bois-Pr´eau, 92852 Rueil-Malmaison Cedex, France
1
This setup is a very good candidate for adaptive methods, such as the one introduced by Harten in the 1990’s [14], which was specially designed for the speed-up of finite volume schemes. The gist of the method consists in analyzing the smoothness of the solution by performing a wavelet-like transformation. In the context of finite volume schemes this relies on a dyadic hierarchy of discretizations. The size of the coefficients in the multiscale basis is tested against a threshold parameter. This information on the local smoothness of the solution can be used in several manners. It can trigger different numerical schemes, like limited non linear and costly fluxes in the vicinity of singularities and linear high order cheaper fluxes in smooth areas. It can also be used to design an adaptive grid by locally selecting the coarsest level of discretization beyond which the coefficients are negligible. The adaptive grid must evolve at each time step in order to follow the displacement of the singularities of the solution. This evolution strongly relies on the hyperbolic nature of the equations that ensures a finite speed of propagation. The time step is monitored by the smallest space grid step and the CFL-like stability condition. Design and study of fully adaptive scheme can be found in [7, 16]. Use of the multiresolution technique is described at length in [12] and [1] and is also implemented in the Lagrangian case in [10, 11]. Simulations exhibits that it can significantly speed-up the computation. The goal of the present paper is to describe a further enhancement to the multiresolution technique: the local time stepping. Numerical schemes designed on non uniform —moving or fixed— grids can be sped up by using different time steps in different areas of the grid, according to the local mesh size. First developments in this direction can be found in [19] for fixed non-uniform grid just before the development of Adaptive Mesh Refinement technique in [5, 4]. In the context of the multiresolution technique previously described, it has been developed and implemented for one-dimensional scalar conservation laws in [17] and extended to the two-dimensional shallow water equations in [15], with promising CPU time gains. A macro time step, fit for the coarsest level of discretization, is subdivided into intermediate time steps. At a given intermediate time step, the solution is updated only on cells belonging to the current synchronization level or finer. Transition zones are defined in order to deal with the synchronization of the solution at the border between consecutive levels of discretization. Straightforward application of this method to our system of PDEs in the explicit scheme case, was first presented in [11]. It is now extensively tested for robustness and performances in this paper. We also endeavor here to adapt the local time stepping idea to our semi-implicit scheme, where two wave speeds interplay in the sense that fast acoustic waves are treated implicitly with a CFL condition number much larger than one, and kinematic waves are treated explicitly, with a time step verifying a standard CFL condition with a CFL number less than one. The resulting scheme departs from the original one in [17] and will be described in details. The implicit version of the local time stepping algorithm presented in [17], or an alternative to it described by the same authors in [18] cannot be readily applied to our problem where we have to deal with transient fast acoustic waves. In particular, the prediction of the adaptive grid from one time step to the next needs to take into account the fast wave speed. Another originality of our setup is the splitting of our operator into a Lagrangian step and an Euler projection step which requires some extra synchronization during the time integration. We first present the model equations and the numerical algorithms on a fixed non 2
uniform grid. The next section summarizes the multiresolution setup and its application to a finite volume scheme, as described at length in [12, 1]. The section 4 is devoted to the local time stepping enhancement in the case of the explicit scheme. This part makes full use of the notations established in [17]. The semi-implicit scheme, which requires a new approach, is treated at last in section 5. Numerical simulations are described in sections 4.3 and 5.2. They allow to compare the efficiency of the different schemes with and without local time stepping, in term of accuracy and computing time.
2 Modeling of the physical problem Previous works have shown that a relaxation method can be used efficiently for numerical modeling of two-phase flow, see Baudin et al. [2]. Furthermore, it was shown that a semi-implicit version of the relaxation method is better suited for accurate description of the transport phenomena than the explicit or implicit versions, see Baudin et al. [3]. A significant speed-up of the computation can be achieved by employing the adaptive multiresolution (MR) technique, see Coquel et al. [12]. Realistic simulations in varying geometry pipelines have demonstrated the ability of the model to capture complicated physical behavior, including the so-called “severe slugging” phenomenon (see Andrianov et al. [1]). We use here a a modified semi-implicit scheme based on a Lagrangian formulation, for which an explicit stability condition on the time step can be obtained, ensuring positivity of physical quantities (see [10, 11, 9]). The density of the mixture ρ, velocity v and the gas mass fraction Y are solution of the following problem FindV in ΩV = {V = (ρ, ρY, ρv) ∈ R, ρ > 0, Y ∈ [0, 1], v ∈ R} s.t. ∂t (ρ) + ∂ x (ρu) = 0, ∂ (ρY) + ∂ (ρYu) = 0, t x ∂ (ρu) + ∂ (ρu2 + P) = 0. t x
(2.1)
The thermodynamical closure law P(ρ, Y) appearing in (2.1) can be in real applications very costly to evaluate, and should satisfy c2 (V) = ∂ρ P(ρ, Y)|Y > 0. Under this assumption, the system (2.1) is hyperbolic with three distinct eigenvalues u − c < u < u + c. The intermediate eigenvalue corresponds to the slow transport wave and is linearly degenerated, the remaining ones are much bigger and correspond to genuinely nonlinear acoustic waves. Improving the previous numerical treatments of the system (2.1), the scheme we use here ensures the positivity of the density and physical bounds on the gas mass fraction. It can be expressed as a flux scheme, which makes local time stepping techniques applicable. The main idea consists in decomposing the flux in an acoustic part, associated with the genuinely nonlinear waves, and a transport part, associated to the linearly degenerated waves. This is introduced for instance in [13] using Lagrangian coordinates for gas dynamics and detailed in [10, 9] in the case of our more involved 3
relaxed system of equations. Eventually the Lagrange step where we deal with the acoustic part of the flux will be treated implicitly, which will enable us to use a larger time step, basically driven by the transport phenomenon, which will still be treated explicitly for better accuracy. We will first present the explicit version of the scheme, for which we adapt the local time stepping enhancement proposed by M¨uller et al [17].
2.1 Discretization The Lagrange-Projection splitting is performed at the numerical level in a two-step scheme which we present in this section without the intermediate details for which we refer to [10, 9]. We discretize the domain in J cells Ω j = [x j−1/2 , x j+1/2 ] of size ∆x j , P such that L = J−1 j=0 ∆x j and of center x j = (x j−1/2 + x j+1/2 )/2 for j = 0, . . . , J − 1. n We denote by V j = ρnj (1, Y nj , unj ) the numerical solution on cell Ω j at time n and by n♯ n♯ n♯ Vn♯ j = ρ j (1, Y j , u j ) the numerical solution at the end of the Lagrange step.
2.1.1
Explicit scheme
Explicit Euler scheme for the Lagrange step gives n unj−1/2 e unj+1/2 − e τn♯ j − τj n − ρj ∆t ∆x j n Y n♯ − Y j j ρnj ∆t n♯ en en u − unj P j+1/2 − P j−1/2 n j + ρ j ∆t ∆x
= 0, (2.2)
= 0 = 0,
j
en where τ denotes the co volume 1/ρ and e unj+1/2 and P j+1/2 are the solution of the Rien n mann problem between states V j and V j+1 en = P j+1/2 unj+1/2 = e
Pnj + Pnj+1 2 unj + unj+1 2
− −
an
unj+1 − unj
2 Pnj+1 − Pnj 2an
, (2.3)
.
In (2.3), an is a stabilizing coefficient coming from the relaxation formulation of problem (2.1) as described in [2, 9]. It is set globally for all cells at each time step by the Whitham condition a2n >
max −∂τ P(τnj , Y nj ).
j=0,...,J−1
(2.4)
The Euler projection step advects the conservative state Vn♯ with the edge velocities e un 1 . Combining the two steps together provides the locally conservative flux formuj± 2
lation
Vn+1 = Vnj − j
∆t n F j+ 1 − Fnj− 1 , ∆x j 2 2 4
(2.5)
where en 1 )T + (e unj− 1 )+ Vn♯ unj− 1 )− Vn♯ Fnj− 1 = (0, 0, P j . j−1 + (e j− 2
2
2
(2.6)
2
In the above definition of the fluxes, the superscript (.)+ (respectively (.)− ) denotes the positive (respectively negative) part. We will admit here the following theorem (see [13] and [8]) Theorem 2.1. Suppose that condition (2.4) is satisfied and that ∆t ≤ min j
min(∆x j , ∆x j−1 ) . max unj−1 − an ρnj−1 , unj + an ρnj , e unj−1/2
(2.7)
Then, if ρnj > 0 and 0 ≤ Y nj ≤ 1 for all j = 0, . . . , J − 1, the solution of (2.5) satisfies ρn+1 > 0 and 0 ≤ Y n+1 ≤ 1 for all j = 0, . . . , J − 1. j j 2.1.2
Implicit scheme
The semi-implicit version of the Lagrange-Projection scheme has been derived in [10, 9] and we merely recall the important steps here. Implicitation of the Lagrange step leads to n e un♯ un♯ τn♯ j+1/2 − e j−1/2 j − τj n − = 0, ρj ∆t ∆x j n Y n♯ j − Yj (2.8) n = 0, ρj ∆t en♯ − P en♯ un♯ − unj P j j+1/2 j−1/2 n = 0, ρ j ∆t + ∆x j
where the interface quantities are n♯ Pn♯ j + P j+1 n♯ e P = j+1/2 2 n♯ u j + un♯ j+1 n♯ e u j+1/2 = 2
− an −
n♯ un♯ j+1 − u j
2
n♯ Pn♯ j+1 − P j
2an
, (2.9)
.
n♯ en♯ and e We replace P u j+1/2 in (2.8) by their expressions (2.9) and obtain a system for j+1/2 n♯ n♯ τn♯ j , u j and P j . We then eliminate this last unknown, by implicitating the equilibrium
n♯ n♯ at the end of the Lagrange state Pn♯ j = P(τ j , Y j ) and by replacing all (Pτ ) j by a global lower bound −an 2 defined by (2.4), so that n 2 n♯ n Pn♯ j = P j − an (τ j − τ j ).
(2.10)
Introducing auxiliary unknowns defined by −,n♯ n♯ − a τ = 21 un♯ n Cj j , j C +,n♯ = 1 un♯ + an τn♯ , j
2
5
j
j
(2.11)
some straightforward algebra leads eventually to the following system +,n♯ C j−1 +,n♯ n n C = S +,n 0 1 + a α −a α n n j j j j C +,n♯ j+1 −,n♯ C j−1 −,n♯ = S −,n −an αnj 1 + an αnj 0 C j j −,n♯ C j+1
(2.12)
where
αnj =
∆t ∆x j ρnj
(2.13)
and the right hand side is S +,n j
C +n j
=
+
S −,n = C −n j − j
αnj 2 αnj
Pnj + an 2 τnj − Pnj+1 − an 2 τnj+1 , Pnj + an 2 τnj − Pnj−1 − an 2 τnj−1 .
(2.14) 2 We impose here non reflective boundary conditions, adequate to treat initial value −,n♯ problems. We will set C−1 = C0−,n♯ in the first equation for the lower bidiagonal +,n♯
+,n♯
system, and C J = C J−1 in the upper bidiagonal system. The Euler projection step computes the conservative state at time n + 1: ∆t n,♯ , F j+1/2 − Fn,♯ Vn+1 = Vnj − j j−1/2 ∆x j
(2.15)
where T n♯ n♯ n♯ n♯ n,♯ en♯ + (e u j−1/2 )+ V j−1 + (e u j−1/2 )− V j . F j−1/2 = 0, 0, P j−1/2
(2.16)
Introducing the coefficients
j
⇀ mn j
= min ⇀ wnk ,
n j ⇀ M = max ⇀ wn ,
↼ mn
↼n , = min w k
n J−1 n ↼ M = max ↼ w
j
k=0 J−1 k= j
j
j
k=0
k= j
k
k
where ⇀n = Pn + a un , w n j j j
⇀n = Pn − a un w n j j j
(2.17)
we have the following theorem (see [9]) Theorem 2.2. If ρnj > 0 and 0 ≤ Y nj ≤ 1 for all j = 0, . . . , J − 1 and if we impose condition (2.4), and the following CFL condition on the time step ∆t =
maxJ−1 j=0 max
↼n 0, M j
2an ∆x n ⇀ n ⇀n ↼ −m − min 0, m − M j+1 j j+1
(2.18)
then the scheme (2.15) has a unique solution which satisfies ρn+1 > 0 and 0 ≤ Y n+1 ≤1 j j for all j = 0, . . . , J − 1. 6
Additionally to (2.18), we impose to the time step another bound depending solely on the fast acoustic wave speed, but with a CFL number CFLimp = 10 or even larger, in order to control the distortion of the acoustic waves. ∆t ≤ CFLimp min j
min(∆x j−1 , ∆x j ) . max(u j−1 − aρ j−1 , u j + aρ j )
(2.19)
3 Adaptive multiresolution It is well known that since the fast acoustic waves are treated implicitly, they are smoothed out very early in the computation (see [12]). The wave of interest which moves with the slow speed and is computed explicitly, may present on the other hand singularities that we want to compute as precisely as possible. It is of course natural to discretize the solution finely in the vicinity of these singularities and more coarsely elsewhere where it is smooth. In answer to this observation, we have adapted the multiresolution techniques devised for explicit schemes in [7] and based on ideas introduced in the context of systems of conservation laws by Harten [14] at the beginning of the nineties. The multiscale analysis of the solution is used to design an adaptive grid by selecting the correct level out of a hierarchy of nested grids according to the local smoothness of the solution. This non-uniform grid evolves with time, with a strategy based on the prediction of the displacement and formation of the singularities in the solution. The wavelet basis used to perform the multiscale analysis enables to reconstruct the solution at any time back to the finest level of discretization, within an error tolerance controlled by a threshold parameter. The coupling of multiresolution with the semi-implicit Euler relaxation scheme is detailed in [12] for the non-drift model and in [1] for the complete model with drift and friction. The adaptation of the method to the Lagrange projection scheme is straightforward. The important point for our present work is the enhancement to local time stepping. In the previous works [7, 12, 1] the time step is dictated by the size of the smallest cell in the adaptive grid which enters into a CFL stability condition. We first describe how to adapt the local time stepping approach developed by M¨uller and Stiriba in [17] in the framework of the explicit Lagrange projection scheme. The design of the local time stepping algorithm for the implicit version of the Lagrange projection method is the original part of this work and is described in details. First we briefly recall in section 3.1 the basics of the multiresolution analysis. It is then used, in section 3.2, to monitor a time varying adaptive grid for a conservative finite volume scheme. Technical details and examples can be found in [16].
3.1 Basics of multiresolution analysis We consider a uniform mesh with step size ∆x, Ω0j = [x0j−1/2 , x0j+1/2 ]. Starting from this coarsest discretization labeled 0 we define a hierarchy of K + 1 nested grids (S k )k=0,...,K k+1 k+1 k by dyadic refinement, with cells Ωkj = Ωk+1 2 j ∪ Ω2 j+1 and interfaces x2 j−1/2 = x j−1/2 , k k k+1 with new mid points x2 j+1/2 = (x j−1/2 + x j+1/2 )/2. Initially, the piecewise constant vector-valued function V is defined on the finest grid, numbered K, where it is represented by the sequence of its mean values VK = consists in (VK, j ) j on the cells ΩKj = [xKj−1/2 , xKj+1/2 ]. The coarsening operator Pk−1 k 7
cell averaging from one grid to the coarser one, i.e., k Vk−1 = Pk−1 k V
with Vk−1, j =
1 (Vk,2 j + Vk,2 j+1 ). 2
(3.1)
The inverse operator consists in recovering the mean values on grid level k, given the mean values on the coarser level k − 1. This involves an approximation —or prediction— operator Pkk−1 which we define here as bk V
=
Pkk−1 Vk−1
with
(
bk,2 j = Vk−1, j − 1 (Vk−1, j+1 − Vk−1, j−1 ), V 8 bk,2 j+1 = Vk−1, j + 1 (Vk−1, j+1 − Vk−1, j−1 ). V 8
(3.2)
We define the detail vector Dk with
bk,2 j . Dk, j = Vk,2 j − V
(3.3)
The two vectors Vk and (Vk−1 , Dk ) are of same length and we can use Dk along with Vk−1 to recover Vk entirely. Iterating this encoding operation from the finest level down to the coarsest provides the multiscale representation MK = (V0 , D1 , . . . , DK ) = MVK . The indices of the multiscale representation MK vary in ∇K = {[0, . . . , N0 ], [0, . . . , N0 ], . . . , [0, . . . , 2K−1 N0 ]} The interest of the multiscale representation lies in the fact that the local regularity of the function is reflected by the size of its details. We can use this property to compress the function in the multiscale domain by dropping all details smaller than a given threshold. To clarify this idea, we first define a threshold operator TΓ acting on the multiscale representation M K , depending on a subset Γ ⊂ ∇K of indices γ = (k, j), by ( 0 if γ ∈ Γ, (3.4) TΓ (Dγ ) = Dγ otherwise. Given level-dependent threshold values ε = (εk )k=0,...,K , and extending the notation D0 = V0 , we introduce the subset Γε = Γ(ε1 , · · · , εK ) := {γ s.t. |Dγ | ≥ ε|γ| }, where |γ| = |(k, j)| = k. This completes the definition of the threshold operator Tε := TΓε , and gives rise to an approximating operator Aε := M−1 Tε M acting on the physical domain representation. In practice, we take advantage of the fact that the remaining fine-scale details will be concentrated near singularities. This is not such a trivial result because the operator Aε is nonlinear since Γε depends on VK through the threshold scheme. We refer to [6] for a thorough investigation of nonlinear approximation and the proof of the main result with VεK = Aε VK ,
| VK − VεK | L1 < Cε,
(3.5)
valid when εk = 2k−K ε. This allows us to define an adaptive grid S ε where the local size of the cell will be the grid step corresponding to the finest non negligible detail. n S ε = (k, j), k ∈ {0, . . . , K}, j ∈ {0, . . . , 2k N0 }, s.t. (k, ⌊ j/2⌋) ∈ Γε and (k + 1, j) < Γε } ,
where ⌊ j⌋ denotes the integer part of j. 8
(3.6)
The representation Vε of the solution on this adaptive grid is obtained from the encoded multiscale representation MεK = Tε MVK by the following Algorithm 3.1 Partial decoding Starting from Tε MV on Γε for level k = 1 ր K do if (k, j) ∈ Γε then bk,2 j using (3.2), V bk,2 j + Dk, j , compute Vk,2 j = V Vk,2 j+1 = 2Vk−1, j − Vk,2 j . end if end for Note, in particular, that the representation by its mean value Vk, j on an intermediate level k does not mean that the function is locally constant on this cell of width 2k ∆x, but simply that its mean values on the finest grid in this area can be recovered —within the ε accuracy— using the mean values on this intermediate level and the reconstruction operators Pll−1 for l = k + 1, . . . , K. The reverse transformation is performed as follow Algorithm 3.2 Partial encoding Starting from V on S ε for level k = K − 1 ց 0 do if (k + 1, 2 j)(∈ Γε then Vk, j using (3.1), compute bk+1,2 j using (3.2). Dk+1, j = Vk+1,2 j − V end if end for
3.2 Application to a finite volume scheme We now briefly describe how to use the multiresolution analysis in the context of a finite volume scheme, written in conservative form on the most refined level of discretization K as n n Vn+1 K, j = V K, j − λK B K, j
(3.7)
where λK = ∆t/∆x and the flux balance is defined as BnK, j = FnK, j+1/2 − FnK, j−1/2 .
(3.8)
The numerical flux FnK, j+1/2 between cells ΩKj and ΩKj+1 is computed using r values of the solution on each side of the interface xKj+1/2 n n n b Vn FnK, j+1/2 = F K, j+1−r , . . . , V K, j , V K, j+1 , . . . , V K, j+r .
(3.9)
In our case it will be defined by (2.6) or (2.16). Due to the nestedness of the dyadic grids, we can define the numerical fluxes on coarser levels k from the fluxes defined at 9
the same location on finer scales Fnk, j−1/2 = Fnk+1,2 j−1/2 = . . . = FnK,2K−k j−1/2 .
(3.10)
This allows us to define the flux balances by induction for all levels k = 0, . . . , K by Bnk, j = Fnk, j+1/2 − Fnk, j−1/2 = FnK,2K−k ( j+1)−1/2 − FnK,2K−k j−1/2 =
2K−kX ( j+1)−1
FnK,ℓ+1/2 − FnK,ℓ−1/2
ℓ=2K−k j
2K−k ( j+1)−1
=
X
ℓ=2K−k j
BnK,ℓ
=
2K−k X−1
BnK,2K−k j+ℓ .
(3.11)
ℓ=0
After normalization by the step size 2 K−k ∆x at level k, we can apply the same projection (3.1) and prediction (3.2) schemes on the flux balances as on the solution itself and we obtain the fully adaptive scheme in 1D as n+1 n n Vε k, j = Vε k, j − λk Bε k, j ,
(k, j) ∈ S ε
(3.12)
where λk = 2k−K λK . The important point here is that the adaptive grid S ε must be adequate to represent the solution at both times n and n + 1. More specifically, if we denote by Γnε the graded tree obtained by applying Aε to VnK , then Γnε can be inflated into e Γεn+1 containing Γεn+1 as well as Γnε , ensuring that estimation (3.5) is valid at both M. Setting e Γεn+1 to ∇K does the trick times n and n + 1 when using Aε = M−1 TeΓn+1 ε but it is not very interesting in practice. The inflated tree e Γεn+1 should be as small as n possible. An economical way to ensure (3.5) both for V and Vn+1 was heuristically described by Harten in [14]. In [7], we added some gradualness property, necessary to ensure computational efficiency. Algorithm 3.3 Prediction of the adaptive grid e Γεn+1 Prediction: for level k = K ց 1 do if (k, j) ∈ Γnε and Dkj ≥ εk then (k, j + l) ∈ e Γεn+1 for l = −s, . . . , s k if D ≥ 2εk then j
(k + 1, 2 j) and (k + 1, 2 j + 1) ∈ e Γεn+1 end if end if end for Gradualness: for level k = K ց 1 do if (k, j) ∈ e Γεn+1 then for |ℓ| ≤ g do (k − 1, ⌊ j/2⌋ + ℓ) ∈ e Γεn+1 end for end if end for 10
Let us comment on the choice of s and g: in Harten’s strategy the number of cells added on each side of important details to account for displacement of the solution during one time step is s = 1, thanks to the CFL < 1 for explicit schemes. This is an important point of discussion in the extension of the adaptive algorithm to implicit schemes with CFL larger than one and the value of the parameter s has been discussed in [12]. It turns out that s = 1 remains valid in the semi-implicit case becasue the fast waves are severely damped out by the implicit scheme and can therefore be well represented at the coarser levels of discretization. Concerning the gradualness accounted for by the second step of algorithm 3.3, the multiresolution stencil should always be readily available in order to apply the reconstruction formula (3.2) so in our case g = 1. Below is the actual adaptive algorithm we implement Algorithm 3.4 Adaptive algorithm Initialization: encoding of the initial solution and definition of Γ0ε for time step n = 0, . . . , N − 1 do Prediction of e Γεn+1 using Algorithm 3.3. Γεn+1 using (3.6)). Partial decoding of Vnε on Seεn+1 (derived from e Evolution of Vnε to Vεn+1 on the adaptive grid Sen+1 using (3.12). Definition of Γεn+1 by partial encoding of Vεn+1 . end for Decoding of VεN on the finest grid S K . The evolution step of this algorithm can be implemented in several ways which have now been extensively studied and compared (see for instance [7] and [1]). We can now address the purpose of the present paper which is to couple the multiresolution algorithm with local time stepping.
4 Local time stepping In the adaptive scheme presented in the previous section the time step is the same everywhere in the grid and is determined in order to ensure stability. It must obey some CFL condition and therefore depends on the smallest space grid size ∆x. We now address the problem of using different time steps depending on the local size of the adaptive grid cell. We rely on the assumption that if the stability criterion leads to a time step ∆t on the finest grid of size ∆xK = ∆x at level K, then the scheme can be applied in coarser regions where the grid size is ∆xk = 2K−k ∆x using a correspondingly larger time step ∆tk = 2K−k ∆t and still be stable since the ratio λ = ∆t k /∆xk remains the same (see Figure 1). The obvious difficulty arising from this discrepancy in time steps is that the solution is not synchronized after one time step and something special must be done at interfaces between regions of different grid size. We retain here the formalism of [17] and summarize in the first section the algorithm in the explicit case. The second section is devoted to the semi implicit scheme for which a specific implementation of the local time stepping is designed.
11
2δ t δt 2δx
δx
Fig. 1. Using a different time step according to the grid size
4.1 Local time stepping for the explicit scheme We note ∆t0 = 2K ∆t the macro time step which can be used on cells at the coarsest level. The discrete times tn = n∆t 0 are subdivided into 2K intermediate time steps tn+i2−K for i = 1, . . . , 2K with step size ∆t. At time tn+2−K i the smallest synchronization level is determined by ki := min{k; 0 ≤ k ≤ K, i mod 2K−k = 0}. All cells belonging to levels finer than ki are updated during the intermediate step i. This partial updating makes uses of sets of indices which will be updated at each change of the adaptive grid • The index sets Ck , k = 0, . . . K of cells at level k that can be evolved in time by one time step with step size ∆t k = 2K−k ∆t, i.e. for k = K − 1 ց 0 do n o Ck := (k, j) ∈ Seεn+1 ; ∄(k + 1, ℓ) ∈ Seεn+1 : j ∈ Σℓ , end for n o CK := (K, j); (K, j) ∈ Seεn+1 . • The range of dependence Σℓ , determined by the stencil of the 2r−point flux (3.9) and the multiscale local prediction (3.2) as Σℓ := {⌊(ℓ − r)/2⌋ − 1, . . . , ⌊(ℓ + r)/2⌋ + 1} . • The complement sets, or transition zones, i.e. n o ek \Ck , I ek := (k, j); (k, j) ∈ Sen+1 . Ck := I ε
With these definitions, illustrated in figure 2,the evolution of the solution during a macro time step is performed in a loop on intermediate time steps (see Figure 3). At each intermediate time step i the solution is updated on all active cells belonging to levels k ≥ ki , using time step ∆tk = ∆t2K−k , except for the cells in the transition regions where a half time step is used. It is also updated on cells in the transition region of the immediately coarser level ki − 1, using a half time step. (here 2K−ki ∆t). Thanks to the explicit nature of the scheme, and of the flux computation (2.6), we can use the conservation property depicted in Figure 4 to synchronize the solution in the manner detailed in the following algorithm
12
C
C K−1
K−1
11111 00000 00000 11111 00000 11111 Σl
CK l
11111 00000 00000 11111 00000 Σm m11111
Fig. 2. Definition of index set C K−1 and C K , transition zone C¯ K−1 and ranges of dependence Σℓ and Σm for the cells (K, ℓ) and (K, m).
Algorithm 4.1 Synchronized time evolution for time step tn+i2−L for each intermediate time step i = 1, . . . , 2K do • Initialization for k = K ց ki do Update indices sets Ck , Ck end for • Update fluxes on cells that have been modified at previous time step: for levels k = K ց ki−1 do for j s.t. (k, j) ∈ Seεn+1 do n+(i−1)2−K using (2.3-2.6) Compute Fk, j−1/2 end for end for for (ki−1 − 1, j) ∈ Cki−1 −1 s.t. (ki−1 , 2 j − 1) ∈ Seεn+1 do −K using (2.3-2.6) Compute Fkn+(i−1)2 −1, j−1/2 i−1 end for • Time evolution for levels k = L ց ki do use full time step ∆t k for (k, j) ∈ Ck do −K
Vn+i2 k, j
−K
n+(i−1)2 = Vk, j
end for end for for levels k = L ց ki − 1 do use half time step for (k, j) ∈ Ck do −K
Vn+i2 k, j
−K
n+(i−1)2 = Vk, j
−
λ 2
n+(i−1)2 − Fk, j−1/2
−K
n+(i−1)2 − Fk, j−1/2
n+(i−1)2 Fk, j+1/2
end for end for Elsewhere the solution remains unchanged end for
13
−K
−K
n+(i−1)2 − λ Fk, j+1/2
−K
,
,
4.2 Regriding at intermediate time steps An important point in the local time stepping algorithm is the evolution of the adaptive grid. In [17], it is shown that a prediction of the grid from one macro time step to the next is not efficient when the number of levels is large since the size of the adaptive grid increases geometrically. The alternative consists in predicting the evolution of the grid at even intermediate time steps, for all levels above the synchronization level and perform a partial encoding/decoding of the solution, in the manner described in the following algorithm Algorithm 4.2 Intermediate regriding for intermediate time step i = 2, 4, . . . , 2K − 2 do • 1. Prediction: for levels k = K ց ki do −K and Dkj ≥ εk then if (k, j) ∈ Γn+i2 ε −K
(k, j + ℓ) ∈ e Γεn+(i+1)2 k if D j ≥ 2εk then
for |ℓ| ≤ s
−K
(k + 1, 2 j) and (k + 1, 2 j + 1) ∈ e Γεn+(i+1)2 end if end if end for • 2. Gradualness: for levels k = K ց ki do −K if (k, j) ∈ e Γεn+(i+1)2 then −K
then if (k − 1, ⌊ j/2⌋ + ℓ) ∈ Γn+i2 ε n+(i+1)2−K e (k − 1, ⌊ j⌋ + ℓ) ∈ Γε for |ℓ| ≤ g end if end if end for • 3. for levels k = ki + 1 ր K do Check that we always have g cells at level k − 1 between two sets of cells at level k. Otherwise refine to level k. end for end for for intermediate step i = 2K do Perform algorithm 3.3 with gradualness g. Perform step 3. end for The prediction s should be equal to the maximum displacement of a singularity in one time step. In the explicit case, it is therefore equal to 1 as in the standard multiresolution algorithm 3.3. We will see that for the semi implicit case, it is necessary to take into account the fast wave and assume a speed larger than 1. The gradualness parameter g must ensure the possibility of regriding and still preserve the transition 14
λ/2
λ
λ
λ/2
λ
λ
λ
λ
λ/2
λ
λ
λ
λ
λ/2
λ
λ
λ
λ
λ/2
λ
λ
λ
λ
λ t λ/2
λ
λ
i=4 k4=0 i=3 k3=2 i=2 k2=1 i=1 k1=2
x
Fig. 3. A three level adaptive grid with transition zones of width 1 represented with dotted lines. The intermediate step number is denoted by i = 1, . . . , 4, ki denotes the synchronization level. The red and green arrows indicate the fluxes that are computed at the corresponding time step
n+1 V k,j−1
n+1 Vk+1,2j
1F n 2 k,j−3/2 n+1/2 V k,j−1
n+1/2 F k+1,2j−1/2
n+1 V k,j−2
n F k,j−3/2
F
k,j−1/2
1 n F 2 k,j−3/2 n V k,j−1
n V k,j−2
n+1/2 V k+1,2j
n
F
n k+1,2j−1/2 n V k+1,2j
Fig. 4. Flux conservation at interface between level k and k + 1 implies n+1/2 2Fnk, j−1/2 = Fnk+1,2 j−1/2 + Fn+1/2 k+1,2 j−1/2 . The solution Vk, j−1 is used to compute Fn+1/2 k+1,2 j−1/2
zone. It is therefore linked to the parameter s through s + r g= +1 2
(4.1)
This rule is illustrated in Figure 5 for speeds 1, 2 and 3. For each example, the predicted tree e Γε is represented at the beginning of the macro time step, with the single non negligible detail symbolized with a _. Then the resulting adaptive grid S ε is represented at the different intermediate time steps, along with the progression of the singularity, marked with a 3. The dotted lines indicate the transitions zones.
4.3 Numerical simulations for the explicit scheme In this section we validate the algorithms on a test case. We compare the uniform finite volume scheme (U) with two versions of the multiresolution algorithm: (MR) denotes the algorithm with global time stepping based on the smallest cell, (LTS) denotes the local time stepping with partial regriding at each intermediate time step. The simulation is set in a 32km long pipeline. At the initial time the density of the mixture is 500kg/m3 until x = 16km and 400kg/m3 beyond. The gas mass fraction is 15
t S
a)
ε
x
~ Γε t Sε
b)
~ Γ
x
ε
t Sε x c)
~ Γε Fig. 5. Grid prediction at intermediate time steps. e Γε indicates the tree at the beginning of the macro time step, with a single non negligible detail _. The evolution of the adaptive grid S ε includes intermediate regriding every two intermediate time steps. The singularity is marked with a 3. The grid propagation speed is (a) s = 1, (b) s = 2, (c) s = 3.
respectively 0.2 and 0.4 and the speed is uniform and equal to −10m/s. The transport wave moves slowly toward the left at a speed −29m/s while two acoustic waves are visible on the density and speed components moving in opposite directions at roughly −263m/s and +238m/s. The pressure the law corresponds to a perfect gas and incompressible liquid P(ρ, ρY) = a2g
ρl ρY . ρl − ρ(1 − Y)
(4.2)
Figure 6 displays the density field obtained after 42s of propagation with the uniform, the multiresolution, and the local time stepping schemes. The grid has 5 levels of refinement, which amounts to J = 4096 grid points on the smallest level of refinement. We use a constant elementary time step on the finest level throughout the simulation, determined by taking the minimum time step during a previous uniform simulation. For the 4096 points simulations we use ∆t = 0.0096s. The MR and LTS results are obtained with a threshold parameter ε = 0.005. The crosses for the multiresolution and circles for the local time stepping denote the level of refinement used locally to discretize the solution. It is read on the right hand side vertical axis. In Figure 7 the range of abscissa is zoomed in in the three regions of interest. The quality of approximation of the transport wave is the same for the two algorithms. The local time stepping does a slightly better job than the standard multiresolution as far as the acoustic waves are concerned. This is because there are less projection steps performed and therefore less diffusion. 16
560
520
560
6
Ini U MR tree
540
5
500
520 500
4
6 5 4
480
460
3
ρ
480 ρ
Ini U LTS tree
540
460
3
440
440 2
420 400
2
420 400
1
1
380
380 360 0
10000
20000 x
30000
360
0 40000
(a)
0
10000
20000 x
30000
0 40000
(b) Fig. 6. Density field and grid refinement at t = 42s, for ε = 0.005. (a) Explicit multiresolution scheme (MR) against uniform solution (U) on finest (5th ) level and initial solution (Ini) (b) Local time stepping (LTS) scheme. The symbols + and ◦ indicate the level of refinement used locally, to be read on the right hand side vertical axis
To study the performance and the robustness of the algorithm we perform a parameter study. We test two discretizations: J = 4096 points on a hierarchy of 5 levels and J = 8192 with 6 levels. The range of the ε threshold goes from 0 to 10−2 . For each set of parameters we compute the solution at t = 42s with the three algorithms and calculate the relative error between the adaptive solution reconstructed on the finest level at the final time and the solution computed on the uniform finest grid. The error is computed for the component ρ which is sensitive to both transport and acoustic phenomena and for the gas mass fraction which sees only the transport effect.
E1 (ρε ) =
J X
|ρεj − ρ j |
j=0
J X
,
E1 (Yε ) =
J X
|Y εj − Y j |
j=0
|ρ j |
j=0
J X
.
(4.3)
|Y j |
j=0
We also compute the error with respect to a reference solution computed on a uniform mesh at the 9th level of discretization (on 65536 points), that is 8 times finer than the simulation on 8192 points. It will be considered as the exact solution.
re f
E1 (ρε ) =
J X
|ρεj − ρ¯j |
j=0
J X
,
re f
E1 (Yε ) =
|ρ¯j |
j=0
J X
|Y εj − Y¯ j |
j=0
J X
.
(4.4)
|Y¯ j |
j=0
In (4.4), ρ¯j and Y¯ j denote the average of the reference solution on the 8 or 16 cells covering cell j. In Figure 8 we display the graph of the error (4.3) with respect to the uniform solution on the finest level versus the threshold parameter. Both schemes (MR) and (LTS) converge with respect to the threshold parameter ε which corroborates the theoretical estimate (3.5). 17
560
520 500
545
6
Ini U LTS MR tree LTS tree MR
540
5 535 530
4
480
6 5 4
525
460
3
3
ρ
ρ
Ini U LTS MR tree LTS tree MR
540
520
440
515
2
420
2
510
400
1
1 505
380 360 14500
14700
14900
15100
500 3000
0 15300
4000
x
(a)
5000 x
6000
0 7000
(b) 400 395 390 ρ
6
Ini U LTS MR tree LTS tree MR
5 4
385
3
380
2
375
1
370 22000
24000
26000 x
28000
0 30000
(c) Fig. 7. Density field and grid refinement at t = 42s. Zoom on (a) transport wave, (b) left going acoustic wave (c) right going acoustic wave .
0.01
1e-06
1e-06
E(ρ)
E(Y)
0.01
1e-10
1e-10
MR LTS
1e-14 1e-10
(a)
1e-06
MR LTS
1e-14 1e-10
0.01
1e-06
0.01
ε
ε
(b) Fig. 8. Convergence versus ε for 6 levels. Relative error with respect to the uniform solution on the 6th level(4.3) on (a) ρ (b) Y, with the standard multiresolution (MR) and the local time stepping strategy (LTS)
In Figure 9 we notice that as expected, the error with respect to the reference solution (4.4) is bounded below by the error between the uniform solution on the 6th level and the reference solution. In Figure 10 we study the dependence between the precision and the speed of the algorithm, by displaying the relative errors between the adaptive and uniform grid 18
0.1
0.01
0.01
Eref(ρ)
Eref(Y)
0.1
0.001
0.001
MR LTS
0.0001 1e-10
1e-06
MR LTS
0.0001 1e-10
0.01
1e-06
0.01
ε
ε
(a)
(b) Fig. 9. Convergence versus ε for 5 levels. Relative error with respect to the reference solution (4.4) on (a) ρ (b) Y, with the standard multiresolution (MR) and the local time stepping strategy (LTS)
solutions as a function of the gain in computing time. The gain is the ratio between the computing time required for the uniform scheme on the finest level of discretization and the computing time required by the multiresolution (MR) or the local time stepping (LTS) scheme for a given threshold ratio. Each point on these curves corresponds to a different value of the threshold parameter ε. The best CPU gain are achieved for the highest value of ε, but also correspond to the highest error The CPU gain can be as high as 10 for a relative error of one per cent for the standard multiresolution and the local time stepping goes yet more than twice as fast for a given error level.
0.01
1e-06
1e-06
E(ρ)
E(Y)
0.01
1e-10
1e-10 MR LTS U
1e-14 0
10 20 30 CPU(unif)/CPU(adapt)
MR LTS U
1e-14 0
40
10
20
30
40
CPU(unif)/CPU(adapt)
(a)
(b) Fig. 10. Convergence versus CPU gain for 6 levels. Relative error with respect to uniform solution on (a) ρ (b) Y.
In Figure 11 we display the error with respect to the reference solution, as a function of the CPU gain, for both the 4096 and 8192 points simulations. Here again, each point corresponds to a different value of ε. The CPU gain is computed with respect to the CPU for the uniform simulation on the 5th (respectively 6th ) level for the multiresolution (MR) and local time stepping (LTS) simulations on the 5 level-hierarchy (resp. 19
6 level-hierarchy). Both (MR) and (LTS) simulations converge to the error level of the uniform grid simulation when ε goes to 0 which is roughly 10−3 for 4096 points and 5.10−4 for 8192 points. Since the uniform simulation on 8192 points costs roughly 4 times as much as the one on 4096 points, all multiresolution simulations on the 6 level hierarchy which exhibit a CPU gain superior to 4 and an error below 10−3 are doing a better and faster job than the uniform simulation on the 5th level. 0.008
MR LTS MR LTS
MR LTS MR LTS
0.006 Eref(Y)
Eref(ρ)
0.006
0.008
5 5 6 6
0.004
5 5 6 6
0.004
0.002
0.002
0
0 0
10 20 30 CPU(unif)/CPU(adapt)
0
40
(a)
10 20 30 CPU(unif)/CPU(adapt)
40
(b) Fig. 11. Convergence versus CPU gain for 5 and 6 levels. Relative error with respect to reference solution on (a) ρ (b) Y.
5 Local time stepping for the semi-implicit scheme The main difficulty to implement local time stepping for the semi implicit scheme lies in the discrepancy between speeds of acoustic and kinematic waves. Actually, if we use a time step designed on the fast wave speed instead of the slow transport speed as in (2.18) the M¨uller and Stiriba algorithm [17] designed for implicit schemes and CFL= 1 is convenient. In that case however, we completely miss the advantage of using an implicit scheme for the Lagrange phase of the algorithm, which is meant to enable us to use a very large time step. The second stability condition (2.19), which is enforced with a very large CFL number (CFLimp = 10 to 20), enables us to design the stencil of influence (S.I.) of a given location with respect to the acoustic waves knowing that these waves can travel at most CFLimp cells in one time step. At intermediate time step i all cells in levels k ≥ ki are updated and therefore enter the implicit system at the Lagrangian step. Some additional cells belonging to coarser levels k = ki −1 ց 0 must be included in the linear systems (2.12) on each side of Di = {Ck }k=ki ,...K to compute the Lagrangian phase (see Figure 12). They are the cells in the stencil of influence of cells at the border of Di . Equipped with (2.18) and (2.19) we can safely restrict this area S .I to a zone of width ⌊CFLimp ⌋ on the borders of Cki not contiguous to C ki , measured in number of cells of size ∆xki . The solution of the Lagrange phase is used to compute the Euler projection fluxes (2.16) in a manner described in Algorithm 5.4 but only for the cells on which the solution should actually be updated. As in the explicit scheme these are the cells belonging to the levels above the current synchronization level ki , plus some contiguous cells in 20
the level immediately coarser, forming the transition zone Cki −1 (of length r + 1 in number of cells at level ki − 1 in Figure 12). We will see later that cells at the boundaries of the transition zone require a special treatment at the Euler projection step. To locate them more easily, we introduce the distances between a given cell (k, j) and a finer level k′ on its right and on its left ′ + k −k ′ , (5.1) dl (k, j, k′ ) = ′ min j2 − ℓ − 1 ℓ ,(k′ ,ℓ′ )∈Ck′ + ′ dr (k, j, k′ ) = ′ min ℓ′ − ( j + 1)2k −k . (5.2) ′ ′ ℓ ,(k ,ℓ )∈Ck′
The overall algorithm equivalent of algorithm 4.1 in the semi implicit case is the following
t
S.I.
i=1, k1=2
x
C1
t
S.I.
i=2, k 2=1
x
t
C0
S.I C1
i=3, k =2 3 x
t
i=4, k 4 =0 x Fig. 12. Transition zones (C k ) and implicit stencil S.I.. The intermediate step number is denoted by i = 1, . . . , 4, the corresponding synchronization level by ki .
Algorithm 5.1 Synchronized time evolution for intermediate time step i = 1, . . . , 2K do Lagrange step. Compute right hand side (2.14) for (2.12) (see Algorithm 5.2). Compute linear system coefficients for (2.12) and solve linear systems (see Algorithm 5.3). Compute Euler projection fluxes (see Algorithm 5.4) Time evolution and synchronization (see Algorithm 5.5) end for 21
The interface quantities are computed at the beginning of each macro time step on the synchronized solution. The right hand side of (2.12) should be computed according to the following algorithm Algorithm 5.2 Right hand side for the linear systems for levels k = K ց ki do for (k, j) ∈ Ck do compute right hand side using (2.14), for a full time step advance ∆tk . end for for k < K and (k, j) ∈ Ck do compute right hand side for a half time step advance ∆t k /2. end for end for for levels k = ki − 1 ց 0 do for cells (k, j) s.t. dl (k, j, ki ) ≤ z or dr (k, j, ki ) ≤ z do compute right hand side for a reduced time step advance ∆tki = ∆tk 2k−ki end for end for We denote by S i the stencil of the implicit systems. It can be a union of disconnected chunks. The upper and lower bidiagonal matrices M + and M − of the linear systems are formed as follows Algorithm 5.3 Linear systems for levels k = K ց ki do −K compute αn+i2 using ∆t k if (k, j) ∈ Ck else using ∆t k /2. k, j end for for level k = ki − 1 ց 0 do −K compute αn+i2 using ∆t ki . k, j end for Impose non reflective boundary condition at end of blocks : if (k, j + 1) ∈ S i then −K −K ) and Mk;+ j, j+1 = −αn+i2 Mk;+ j, j = (1 + αn+i2 k,i k, j else Mk;+ j, j = 1 and Mk;+ j, j+1 = 0 end if if (k, j − 1) ∈ S i then −K −K Mk;− j, j = (1 + αn+i2 ) and Mk;− j, j−1 = −αn+i2 k, j k, j else Mk;− j, j = 1 and Mk;− j, j−1 = 0 end if In order to compute the Euler projection fluxes (2.16), the interface quantities e Pk, j+1/2 and e uk, j+1/2 are computed directly from the Lagrangian phase solution (with the pressure updated using (2.10), with (2.9).
22
Algorithm 5.4 Euler projection fluxes (2.16) for levels k = K ց ki do for (k, j) ∈ Ck do −K −K ,♯ en+(i−1)2 ,♯ and e Compute P un+(i−1)2 using (2.9). j−1/2 j−1/2 Save fluxes at the previous intermediate time step for transition zone end points Compute fluxes using (2.16) end for end for for level k = ki − 1 do ek and dl (k, j, ki ) ≤ r + 1 or dr (k, j, ki ) ≤ r + 1 do for (k, j) ∈ I −K n+i2−K ,♯ en+i2 ,♯ and e Compute P u j−1/2 using (2.9). j−1/2 Compute fluxes using (2.16) end for end for In the case of the explicit scheme the fluxes at the end of the transition zone C¯ k are not modified and the conservation property depicted in Figure 4 can be used in a very simple manner. In case of the semi-implicit scheme, it is not the case anymore, since the solution has been modified during the Lagrangian step, therefore a special synchronization must be done on levels k, for ki ≤ k < K, at the interface between cells (k, j) and (k, j + 1) if dl (k, j, k + 1) = r + 1 or at the interface between cells (k, j − 1) and (k, j) if dr (k, j, k + 1) = r + 1. • If dl (k, j, k + 1) = r + 1, the solution on cell (k, j) is updated over ∆tk /2 while n+(i−1)2−K ,♯ the solution on cell (k, j + 1) is updated over ∆tk . The flux Fk, j+1/2 has been computed using the synchronized Lagrange step solution and can be used straightforwardly in (2.15) for cell (k, j + 1). However, solution on cell (k, j) has already been advanced with a half time step at a previous intermediate time step ′ −1)2−K ,♯ i′ = i − 2K−k , using flux Fn+(i . This quantity has not been tampered with k, j+1/2 since then. Therefore, on (k, j) the update formula (2.15) should be replaced by −K
Vn+i2 k, j −
−K
n+(i−1)2 = Vk,i
′ −1)2−K ,♯ ∆t n+(i−1)2−K ,♯ n+(i−1)2−K ,♯ . 2Fk, j+1/2 − Fn+(i − F k, j+1/2 k, j−1/2 2∆x
(5.3)
• Similarly if dr (k, j, k+1) = r+1, the solution on cell (k, j−1) is updated over ∆tk n+(i−1)2−K ,♯ while the solution on cell (k, j) is updated over ∆tk /2. The flux Fk, has j−1/2 been computed using the synchronized Lagrange step solution and can be used straightforwardly in (2.15) for cell (k, j − 1). However, solution on cell (k, j) has already been advanced with a half time step at a previous intermediate time ′ −1)2−K ,♯ step i′ = i − 2K−k , using flux Fn+(i . Therefore, on (k, j) (2.15) should be k, j−1/2 replaced by −K
Vn+i2 k, j −
−K
n+(i−1)2 = Vk, j
∆t n+(i−1)2−K ,♯ n+(i′ −1)2−K ,♯ n+(i−1)2−K ,♯ . Fk, j+1/2 − 2Fk, j−1/2 + Fk, j−1/2 2∆x 23
(5.4)
The time evolution algorithm takes into account this special synchronization and also prepares right hand side corrections for the linear systems at the next intermediate time step. Algorithm 5.5 Time evolution and synchronization for levels k = L ց ki do full time step ∆t k for (k, j) ∈ Ck −K
−K
n+(i−1)2−K ,♯
n+(i−1)2 ∆t Fk, j+1/2 − ∆x Vn+i2 = Vk, k, j j end for for levels k = L ց ki − 1 do half time step for (k, j) ∈ Ck
n+(i−1)2−K ,♯
− Fk, j−1/2
−K n+(i−1)2−K ,♯ n+(i−1)2−K ,♯ n+(i−1)2−K ∆t − = V . Vn+i2 F − F 2∆x k, j k, j k, j+1/2 k, j−1/2 if k >= ki then special evolution equations should be used at the end of transition zone, (5.4) if dr (k, j, k + 1) = r + 1 and (5.3) if dl (k, j, k + 1) = r + 1. end if Elsewhere the solution remains unchanged end for
5.1 Grid prediction and regriding The time step used in the semi implicit scheme is designed according the stability condition (2.18) which ensures that the slow transport wave can be handled with a maximum principle by the explicit projection step. For this part of the solution, the prediction of the tree assuming a displacement of a singularity of at most one cell per time step is relevant. The fast acoustic waves being treated implicitly at the Lagrange step, a singularity in this part of the solution will smooth out in all the domain of computation in a single time step, losing of course most of its singular nature. To quantify this property we study the simple case of the first order forward implicit scheme applied to a linear scalar equation with speed one ∂t U + ∂ x U = 0. U n+1 = U nj − λ(U n+1 − U n+1 j j j−1 ).
(5.5)
We consider a solution at time tn built from a single detail at position J on level K − 1 in the multiresolution domain: V0 = 0,
D1 = . . . = DK−2 = 0,
DK−1 = δ Jj , j
DK = 0.
After transformation into the physical space using the decoding operator M−1 , the solution is advanced in time using the implicit scheme (5.5) and then transformed back in the multiscale representation using the encoding operator M. We display in Figure 13 (a) different details of this solution on level K − 1, as a function of the coefficient λ = ∆t/∆x. The strength of the initial detail DK−1 decreases rapidly and is below 10% J of its initial value for λ > 10. The next detail in the direction of the propagation DK−1 J+1 has a significant amplitude for λ ∈ [0, 5]. We then represent the two following details K−1 DK−1 J−1 and D J+2 . They are already very small, and all others are negligible. The curve K−1 has propagated at a speed higher corresponding to DK−1 J+1 indicates that detail D J 24
than 1 in a manner that cannot be completely neglected at level K − 1. In Figure 13 (b), the details at the coarser level K − 2 are displayed. The strength of the detail on cell J/2 + 1 is comparable to that on the cell J/2, which also means that some of the solution has actually moved with speed 2. This elementary example illustrates that the details are damped by the implicit scheme, which is good because it means that they will be captured by coarser levels in the multiresolution hierarchy. Nevertheless, to ensure that the regriding at intermediate time step does not deteriorate in the manner described in Figure 5 (b), we modify the prediction of the grid and assume that the speed s in the prediction step of Algorithm 4.2 is in fact 3 instead of 1, which will have the effect of broadening the tree thanks to the gradualness rule (4.1).
1.0
0.02
J−1 J J+1 J+2
0.8
0.00
0.6
−0.02
0.4
−0.04
0.2
−0.06
0.0
−0.08
−0.2 0
2
4
6
(a)
8
−0.10 0
10 12 14 16 18 20 λ
J/2−1 J/2 J/2+1 J/2+2
2
4
(b)
6
8
10 12 14 16 18 20 λ
K−1 K−2 Fig. 13. Details at time ∆t as a function of λ (a) d J+m and (b) d J/2+m for m = −1, . . . , 2
5.2 Numerical simulations for the implicit scheme 560
Ini U MR tree
540 520 500
520
420
7 6
5
500
5
4
480
4
460 440
Ini U LTS tree
540
6
ρ
ρ
480
560
7
460
3
440
3
2
420
2
400
400 1
380 360 0
10000
20000 x
30000
1
380 360
0 40000
0
(a)
10000
20000 x
30000
0 40000
(b)
Fig. 14. Density field and grid refinement computed with the semi-implicit schemes at time t = 41.6s, for ε = 0.005. (a) multiresolution scheme (b) Local time stepping scheme.
To illustrate the algorithm presented above we use the same test case as in subsection 4.3 for the explicit scheme. In the case of the semi-implicit scheme the coefficient 25
560
Ini U LTS MR tree LTS tree MR
540 520 500
400
6
395
5
Ini U LTS MR tree LTS tree MR
390
460
420
2
14500
14700
14900
15100
2
375
1
360
5
3 380
400 380
6
385
3
440
7
4
4 ρ
ρ
480
7
1
370 22000
0 15300
24000
x
(a)
26000 x
28000
0 30000
(b) 545
7
Ini U LTS MR tree LTS tree MR
540 535 530
6 5 4
520
3
ρ
525
515
2
510 1
505 500
0 4000
5000 x
6000
(c)
0.01
0.01
1e-04
1e-04 E(Y)
E(ρ)
Fig. 15. Density field computed with the semi-implicit schemes at time t = 41.6s, for ε = 0.01. Zoom on (a) kinematic wave (b) right going acoustic wave (c) left going acoustic wave.
1e-06
1e-06
1e-08
1e-08
MR LTS
MR LTS 1e-10
1e-10
1e-06 ε
1e-06 ε
(a)
(b) Fig. 16. Error on (a) density, (b) gas mass fraction with respect to uniform solution versus threshold parameter ε for 6 levels grid hierarchy.
an must be set globally on the all x range at each time step. The uniform scheme provides us with a time step ensuring stability throughout the simulation ∆t = 0.065s hence roughly seven times larger than the one used for the explicit schemes simulations. Figure 14 displays the density field computed with the uniform scheme and the 26
0.01
1e-04
1e-04 E(Y)
E(ρ)
0.01
1e-06
1e-06
1e-08
1e-08
MR LTS U
MR LTS U 0
4
8 12 16 CPU(unif)/CPU(adapt)
0
20
(a)
4
8 12 16 CPU(unif)/CPU(adapt)
20
(b) Fig. 17. Error on (a) density, (b) gas mass fraction with respect to uniform solution versus CPU gain for 6 levels grid hierarchy.
0.01
MR LTS MR LTS
0.009
0.008
0.007
0.007
0.006
0.006
0.005 0.004
0.004 0.003
0.002
0.002
0.001
0.001 4
8
12
16
20
0
CPU(unif)/CPU(adapt)
(a)
5 5 6 6
0.005
0.003
0
MR LTS MR LTS
0.009
Eref(Y)
Eref(ρ)
0.008
0.01
5 5 6 6
4
8 12 16 CPU(unif)/CPU(adapt)
(b) Fig. 18. Error on (a) density, (b) gas mass fraction with respect to uniform reference solution versus CPU gain for 5 and 6 levels grid hierarchy.
adaptive schemes (MR) and (LTS) The zoom on the three different waves displayed in Figure 15 show the robustness of the new algorithm. The kinematic wave is reproduced as well, if not better as with the standard (MR) scheme. The acoustic waves are also well handled even though they are more smoothed out with the local time stepping algorithm than with the standard multiresolution. A parameter study for varying values of the threshold ε is presented in Figures 16 to 18. In Figure 16 we display the relative error (4.3) between the density or the gas mass fraction obtained using the uniform scheme or the different adaptive schemes. As in the explicit case, the MR and LTS schemes both exhibit a monotonous convergence in O(ε). We also observe that the relative error on the gas mass fraction is two orders of magnitude smaller than the error on the density. This is quite normal since the gas mass fraction is driven by the slow kinetic wave and actually explicitly computed in the semi-implicit scheme. The adaptive grid is retains almost all details in the vicinity of the discontinuity in the gas mass fraction, which accounts for a much smaller error. On the other hand the density sees acoustic waves which are more sensitive to the
27
20
adaptivity of the grid because they are computed with the implicit scheme. Figure 17 displays the same relative errors versus the gain in CPU time. For the best error level that can be achieved with the local time stepping algorithms we have a CPU gain of more than 17, while the gain using the standard multiresolution is around 11. Eventually we display, in Figure 18, the error between the adaptive solution and a reference solution obtained using the uniform scheme on a grid corresponding to the 9th level. The abscissa is the gain in CPU with respect to the uniform solution on the finest level. As expected, both schemes MR and LTS converge to the error level corresponding to the error Eu between the uniform solution on the finest level, the 5th or the 6th , and the reference solution on the 9th level. Compared to the similar curves with the explicit scheme in Figure 11, the local time stepping enhancement seems to be more advantageous, knowing that the gas mass fraction is the only component where precision really matters: all values of threshold tried on the six level hierarchy lead to a relative error below that obtained with the uniform scheme on the 5th level. In order to compare all the schemes tested in this study we collect in the following table the performances of the six level simulations, in term of computing times, for both the explicit and implicit schemes. The number in parenthesis are the ratio between the uniform and the adaptive performances. The gain is significant between the uniform and adaptive scheme: 9 in the explicit case and 6 in the implicit one. With the global time stepping enhancement it becomes spectacular: 15 in both case. The number of calls to the equilibrium state laws is also reported in the table, along with the computing times. These figures indicate the potential performances of the algorithms when realistic thermodynamical closure laws will be used —instead of the model one (4.2). One should also note that for the test case presented in this table, we have used for the explicit scheme a constant time step ∆t = 0.0048 and for the implicit one ∆t = 0.0325 that is roughly 7 times larger. These values are the minimum values provided by the stability conditions (2.7) and (2.18) throughout a uniform computation. The larger time step in the implicit case is counterbalanced by the cost of solving the linear systems (2.12) and both schemes end up costing roughly the same in terms of computing times in the uniform case. Explicit
Uniform
Multiresolution
CPU(s) State law
31.55 10493
3.54 (8.9) 1105 (9.5)
Semi-implicit
Uniform
Multiresolution
CPU(s) State law
33.5 17698
5.8 (5.8) 2411 (7.3)
Local time stepping 2.14 (14.7) 237 (44.3) Local time stepping 2.11 (15.9) 345 (51.3)
Table 1 Computing times and number of calls to state laws comparison for the different algorithms. Threshold parameter ε = 0.005 and a 6-levels hierarchy.
28
6 Conclusion We have described in details several algorithms to compute the solution of the one dimensional multiphase flow, in the framework of a Lagrange–Euler projection formulation of the equations. Both explicit and semi-implicit schemes are presented, and for each one, two adaptive enhancement methods are described. The first one is the standard multiresolution method already implemented in more complicated cases. It is tested here versus the local time stepping algorithm. The robustness of the two algorithms has been checked by doing a parameter study. Several values have been tried of the threshold parameter ε and for the number of levels. The relative errors between the different adaptive solutions and the uniform one present the expected behaviors. The benefits of the local time stepping enhancement in terms of computing time are encouraging.
Acknowledgments: this work was supported by the Minist`ere de la Recherche under grant ERT-20052274: Simulation avanc´ee du transport des hydrocarbures and by the Institut Franc¸ais du P´etrole. The authors also wish to thank S. M¨uller and S.-M. Kaber for fruitful discussions on the redaction of this paper.
References [1] Nikolay Andrianov, Fr´ed´eric Coquel, Marie Postel, and Quang Huy Tran. A relaxation multiresolution scheme for accelerating realistic two-phase flows calculations in pipelines. Internat. J. Numer. Methods Fluids, 54(2):207–236, 2007. [2] Micha¨el Baudin, Christophe Berthon, Fr´ed´eric Coquel, Roland Masson, and Quang-Huy Tran. A relaxation method for two-phase flow models with hydrodynamic closure law. Numer. Math., 99:411–440, 2005. [3] Micha¨el Baudin, Fr´ed´eric Coquel, and Quang-Huy Tran. A semi-implicit relaxation scheme for modeling two-phase flow in a pipeline. SIAM J. Sci. Comput., 27(3):914–936, 2005. [4] Marsha J. Berger and Phillip Collela. Local adaptive mesh refinement for shock hydrodynamics. Journal of Computational Physics, 82:64–84, 1989. [5] Marsha J. Berger and Joseph Oliger. Adaptive mesh refinement for hyperbolic partial differential equations. Journal of Computational Physics, 53:484–512, 1984. [6] Albert Cohen. Numerical analysis of wavelet methods, volume 32 of Studies in Mathematics and its Applications. North-Holland Publishing Co., Amsterdam, 2003. [7] Albert Cohen, Mahmoud S. Kaber, Siegfried M¨uller, and Marie Postel. Fully adaptive multiresolution finite volume schemes for conservation laws. Math. Comp., 72(241):183–225 (electronic), 2003.
29
[8] Fr´ed´eric Coquel, Edwige Godlewski, Benoˆıt Perthame, Arun In, and Paul Rascle. Some new Godunov and relaxation methods for two-phase flow problems. In Godunov methods (Oxford, 1999), pages 179–188. Kluwer/Plenum, New York, 2001. [9] Fr´ed´eric Coquel, Quang-Long Nguyen, Marie Postel, and Quang-Huy Tran. Positivity-preserving Lagrange-projection method with large time-steps for multiphase flows and Euler IBVPs. submitted. [10] Fr´ed´eric Coquel, Quang-Long Nguyen, Marie Postel, and Quang-Huy Tran. Large time-step positivity-preserving method for multiphase flows. To appear in proceedings of HYP2006, 2006. [11] Fr´ed´eric Coquel, Quang-Long Nguyen, Marie Postel, and Quang-Huy Tran. Time varying grids for gas dynamics. To appear in proceedings of ECMI2006, 2006. [12] Fr´ed´eric Coquel, Marie Postel, Nicole Poussineau, and Quang Huy Tran. Multiresolution technique and explicit-implicit scheme for multicomponent flows. J. Numer. Math, 14(3):187–216, sep 2006. [13] Edwige Godlewski and Pierre-Arnaud Raviart. Numerical approximation of hyperbolic systems of conservation laws, volume 118 of Applied Mathematical Sciences. Springer Verlag, New-York, USA, 1996. [14] Ami Harten. Multiresolution algorithms for the numerical solutions of hyperbolic conservation laws. Comm. Pure Appl. Math., 48:1305–1342, 1995. [15] Philipp Lamby, Siegried M¨uller, and Youssef Stiriba. Solution of shallow water equations using fully adaptive multiscale schemes. Int. Journal for Numerical Methods in Fluids, 49, No.4:417–437, 2005. [16] Siegfried M¨uller. Adaptive Multiscale Schemes for Conservation Laws, volume 27 of Lecture Notes on Computational Science and Engineering. Springer, 2002. [17] Siegried M¨uller and Youssef Stiriba. Fully adaptive multiscale schemes for conservation laws employing locally varying time stepping. Journal for Scientific Computing, pages 493–531, 2007. Report No. 238, IGPM, RWTH Aachen. [18] Siegried M¨uller and Youssef Stiriba. A multilevel finite volume method with multiscale-based grid adaptation for steady compressible flows. Journal of Computational and Applied Mathematics, 2007. to appear in the special issue ”Emergent wavelet-based algorithms in science and engineering” ECCOMAS 2006. [19] Stanley Osher and Richard Sanders. Numerical approximations to nonlinear conservation laws with locally varying time and space grids. Math. Comp., 41(164):321–336, 1983.
30