• Aucun résultat trouvé

Stability Analysis for Splitting Methods

III.2 Chapter Summaries

6.3 Stability Analysis for Splitting Methods

Let us consider the initial value problem

 on a domain Ω defined as in Sections 3.3 and 5.1, namely Ω is a parallelogram forming an angleα with the horizontal line (see Figure 5.1.1). The Laplacian can be split into two operators which will be treated separately

f(u) = ∆u=f1(u) +f2(u) = ∂2u

∂x2 +∂2u

∂y2.

Let us now give the splitting associated with the DDFV method (4.3.2). We define the terms of Equation (5.1.2) to be in the horizontal (resp. vertical) numerical operator according to whether the term is associated to a “horizontal” (resp. vertical) edge. This leads to the split

DHα(uij) :=ui+1j−2uij+ui−1j We first give a Strang time splitting method which uses the centered finite difference method for the space discretisation. Such a scheme can only be defined on a rectangular grid i.e. the angleα= 0.

Definition 6.3.1 The Strang HE-VI finite difference schemeis given by un+ij 12 −unij

Definition 6.3.2 The Strang HE-VI COSMO methodis given by un+ij 12 −unij

whereDH(unij)andDV(unij) are defined by Equation (3.2.10).

Definition 6.3.3 The Strang HE-VI DDFV methodis given by un+

1 2

ij −unij

∆t/2 =KDαH(unij), un+ij 32 −un+ij 12

∆t =KDαV(un+ij 32), un+2ij −un+ij 32

∆t/2 =KDαH(un+ij 32),

(6.3.5)

whereDHα(unij)andDVα(unij) are defined by Equation (6.3.2).

Proposition 6.3.1 The stability criterion for the Strang HE-VI finite difference scheme defined by Equation (6.3.3) is given by

K∆t

∆x2 ≤1.

Proof The amplification factor of this method is computed in the same way as in Section 6.1. The amplification factor of the first and third step of the method is given by

gh(ξ, ζ) = 1−K∆t

∆x2(1−cos(∆xξ)), and the one of the second step is given by

g(ξ, ζ) =

1 + 2K∆t

∆z2 (1−cos(∆zζ)) −1

, which by composition leads to the amplification factor

g(ξ, ζ) = 1−K∆t∆x2(1−cos(∆xξ))2 1 + 2K∆t∆z2 (1−cos(∆zζ))

where ξ ∈ [−∆xπ , ...,∆xπ ], ζ ∈[−∆zπ , ...,∆zπ ]. The function g has nine critical points and two critical lines

A1= (0,0), A2,3= (0,± π

∆z), A4,5= (± π

∆x,0), A6,...,9= (± π

∆x,± π

∆z), A10,11= (± 1

∆xcos−1(1− ∆x2 K∆t), ζ).

Figure 6.3.1 shows two plots of gwith h= ∆x= ∆z= 1/128,K = 1 and ∆t= 2h2 (resp. ∆t=h2) on the left (resp. right).

We now find a criterion which will ensure that all critical points lie between −1 and 1. We have g(A1) = 1 and g(A10,11) = 0. Sinceg(Ai)>0 fori= 2, ...,9 we only need to make sure g(Ai)≤1.

This is always true forg(A2,3) since ∆x,∆z,∆tandKare strictly positive. We have thatg(A4,5)≤1 if K∆t∆x2 ≤1 andg(A6,...,9)≤1 ifK∆t≤∆x4 ∆z12 +∆x12

. However, if K∆t∆x2 ≤1 then the last equality is always true, which concludes the proof.

Proposition 6.3.2 The stability criterion for the Strang HE-VI COSMO scheme defined by Equation (6.3.4) is given by

K∆t 1

∆x2 + tanα

∆x∆z +tan2α 4∆z2

≤1.

−500

Figure 6.3.1: Amplification factor of the Strang HE-VI finite difference method for ∆t= 2h2 on the left, ∆t=h2on the right.

by their expression using the Fourier inversion formula leads to the amplification factor

g(ξ, ζ) = is equivalent to showing that

− 2

Figure 6.3.2: Amplification factor of the Strang HE-VI COSMO method for ∆t = h2 on the left,

∆t= h2

1+tanα+tan42α on the right.

−500

Figure 6.3.3: Amplification factor of the Strang HE-VI DDFV method for ∆t=h2+ 10−6on the left,

∆t=h2 on the right.

The first inequality gives us the stability criterion and the second inequality can be proved by com-puting the image of the ten critical points of the middle term and showing that they all are negative.

Theorem 6.3.3 The stability criterion for the Strang HE-VI DDFV scheme defined by Equation (6.3.5) is given by

K∆t

∆x2 ≤1.

Proof Replacing each term of Equation (6.3.5) by their expression using the Fourier inversion formula leads to the amplification factor

g(ξ, ζ) =

The denominator ofg(ξ, ζ) is positive if 2K∆t∆x2 ≤1, which is not restrictive. So the scheme is stable ifg(ξ, ζ)≤1. Showingg(ξ, ζ)≤1 is equivalent to showing

The left-hand side of the inequality can be bounded by

− sin(∆xξ2 )

∆x2 in the second term of the above.

Remark 6.3.1 We see that the stability criterion of the Strang HE-VI COSMO method depends on αand∆z, which is not the case for the Strang HE-VI DDFV method.

We define two methods which use theθ-scheme for the time discretisation.

Definition 6.3.4 The θ-COSMOscheme is given by un+1−un

∆t =K

DH(un) + θDV(un+1) + (1−θ)DV(un) , whereDH andDV are defined by Equation (3.2.10).

Definition 6.3.5 The θ-DDFV scheme is given by un+1−un

∆t =K

DαH(un) + θDαV(un+1) + (1−θ)DVα(un) ,

whereDHα (resp. DVα) are the terms associated with a “horizontal” (resp. vertical) sideAj, A0j. Theorem 6.3.4 The stability criterion of theθ-COSMO scheme with constant metric terms is given by We then replace the terms of the form unlj by their expression using the Fourier inversion formula.

Using the uniqueness of the Fourier transform of the exact solutionuwe find that the amplification factor is given by

g(ξ, ζ) = denominator ofg is positive, showing thatg(ξ, ζ)≤1 is equivalent to showing thatf(ξ, ζ)≤0 where f(ξ, ζ) := cos(∆xξ)−1

The functionf has nine easily computed critical points, A1= (0,0), A2,3=

It is then straightforward to show thatf(ξ, ζ)≤0. The stability criterion is obtained by bounding

−g(ξ, ζ) by 1.

Theorem 6.3.5 The stability criterion of theθ-DDFV scheme on a domain of slopeαis given by 2K∆t

0

Figure 6.3.4: Functionf part of the amplification factor of theθ-COSMO method withα= 12 and θ=12 for ∆t=h2/4.

Proof Theθ-DDFV scheme on a domain forming an angleαwith the horizontal line is given by un+1ij −unij

We then replace the terms of the form unlj by their expression using the Fourier inversion formula.

Using the uniqueness of the Fourier transform of the exact solutionuwe find that the amplification factor is given by

g(ξ, ζ) =

The image ofA is positive, under the assumption that 2K∆t∆x2 ≤1 which is not restrictive in our case.

Now that we have proved that the denominator ofg is positive, it remains to show thatg1(ξ, ζ)≤ g2(ξ, ζ) and −g2(ξ, ζ)≤g1(ξ, ζ) where g1 is the numerator andg2 is the denominator ofg. Showing

−500

Figure 6.3.5: Denominator of the amplification factor of theθ-DDFV method withα= 12 andθ=12 for ∆t=h2/2. which is trivial since the left-hand side of the inequality is bounded from above by

−2

We then compare the maximal diffusion coefficient which can be chosen without compromising the stability of the scheme. We see that if θ = 1/2, the θ−DDFV scheme allows a larger diffusion coefficient (see Figure 6.3.6). Whenθ= 7/10, theθ−DDFV scheme allows a larger diffusion coefficient if ∆x= ∆z (see Figure 6.3.7, left). It is however not the case when ∆x >>∆z (see Figure 6.3.7, right). Whenθ= 3/10, theθ−COSMO scheme allows a larger diffusion coefficient (see Figure 6.3.8).

Numerical Results

We consider the initial value problem defined by Equation (6.1.8). We compare the errors of the θ-scheme using the COSMO and the DDFV methods for the space discretisation. The errors of the

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 0

0.05 0.1 0.15 0.2 0.25 0.3 0.35

α Kmax

θ−DDFV θ−COSMO

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

0 0.002 0.004 0.006 0.008 0.01 0.012

α Kmax

θ−DDFV θ−COSMO

Figure 6.3.7: Maximal diffusion coefficient for θ = 7/10, ∆t = ∆x2, ∆x= 1/10 and ∆z = 1/10 on the left, ∆z= 1/100 on the right.

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35

α Kmax

θ−DDFV θ−COSMO

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

0 0.002 0.004 0.006 0.008 0.01 0.012

α Kmax

θ−DDFV θ−COSMO

Figure 6.3.8: Maximal diffusion coefficient for θ = 3/10, ∆t = ∆x2, ∆x= 1/10 and ∆z = 1/10 on the left, ∆z= 1/100 on the right.

10-3 10-2 10-1

h

10-8 10-7 10-6 10-5 10-4

h2 e

C

e

D

10-3 10-2 10-1

h

10-8 10-7 10-6 10-5 10-4 10-3 10-2

h2 e

C

e

D

Figure 6.3.9: Error whenα= 12π on the left andα= 12 on the right with constant ∆z andθ=1/2.

schemes are defined by

eψC =kψCN(u0)−Πu(x, y, T)k, eψD =kψDN(u0)−Πu(x, y, T)k,

where ψCN(u0) is the solution computed using the θ-COSMO method afterN iterations and ψDN(u0) is the solution computed using theθ-DDFV method after N time steps.

We see that when the domain considered is a parallelogram, both methods are of order 2 and have similar errors (see Figures 6.3.9 and 6.3.10). However, when the domain considered is a landscape with a mountain in the middle of it and the spacing between the levels is constant (see Figure 3.5.1, left), the error ofθ-DDFV is of order two for all angles but the error ofθ-COSMO is of order one (see Figure 6.3.11). This is due, as explained in Section 3.5.1, to the fact that the first order derivatives of the solution to the problem are not continuous in the new set of coordinates. As in Section 6.1.1, this problem is not visible when the domain considered is big enough in the vertical direction as can be seen in Figure 6.3.12), where the top of the domain iszT = 8.

10-3 10-2 10-1 on shifted domain containing a mountain.

10-3 10-2 10-1 on shifted domain containing a mountain.

6.4 Conclusion

In this chapter, we have analysed and compared the COSMO and the DDFV schemes as space discretisations when solving time dependent problems on a domain with a constant slope (which is equivalent to assuming that the metric terms are constant in an NWP context).

We have seen that for time-explicit schemes, the COSMO method is less restrictive in the choice of a diffusion coefficient. We then analysed particularθmethods and the maximal diffusion coefficient which can be chosen without compromising the stability of the scheme. We saw that whenθ= 1/2, theθ−DDFV scheme allows a larger diffusion coefficient than theθ−COSMO scheme. Ifθ <1/2, the θ−COSMO scheme allows a larger diffusion coefficient than the θ−DDFV scheme. When θ >1/2, theθ−DDFV scheme allows for a larger diffusion coefficient only if ∆x≤∆z. However, when HE-VI schemes are considered, not only does the DDFV method allow larger diffusion coefficients to be chosen but more importantly it does not depend on the angleα.

Chapter III

Conclusion

Death is the only pure, beautiful conclusion of a great passion.

David Herbert Lawrence

In this thesis we analysed the way turbulent diffusion is treated in the Swiss weather prediction numerical model. We showed that the time-scheme is of order one and the space discretisation operator is, with certain assumptions, also of order one. However, numerical experiments on very simplistic domains show that when sufficiently smooth functions are considered on almost equidistant grids, the scheme is of order two. When more realistic grids are considered i.e. when the distance between the levels grows quadratically, the domain has to be shifted in order to overcome the numerical instabilities which arise at the level zero. Another problem arises when more realistic domains are considered i.e.

domains such that the lowest level has varying slopes. The space discretisation on such domains is not well defined at the points where the slope varies because the method relies on a mapping of the lowest level to a horizontal line which is not differentiable (see Section 3.5.1).

We then introduced a finite volume method which converges on almost arbitrary meshes; the Discrete Duality Finite Volume method (DDFV). We proved convergence of DDFV on non-convex domains using a grid which contains non-convex elements in the diamond mesh associated with the grid, with a slight modification to the DDFV method on those elements (see Theorem 4.6.6). In future work, implementing the modified DDFV method might be desirable. We showed that DDFV is better adapted than the actual discrete operator implemented in the COSMO model on realistic domains since it converges with order two regardless of the chosen grid. Moreover, we proposed two refinements which are easily implemented and allow the recovery of optimal order of convergence when the solution of the problem presents a singularity at reentrant corners. Such a refinement cannot be implemented in the actual COSMO model.

We also introduced a coupled DDFV-FV4 scheme which only uses DDFV where it is needed due to the mountain orography (see Section 5.4). We observed that this scheme converges with order two, as the DDFV scheme. The main purpose of this scheme is to gain computational time but this goal is only attained when less than half the domain is treated by DDFV, due to the structure of the matrix to invert.

Finally, we analysed the stability of different schemes involving the two methods mentioned above (the COSMO and the DDFV schemes) when solving a time-dependent problem. The stability criteria were computed under some simplifying hypotheses which are equivalent to restricting the domain to a parallelogram with an equidistant grid. We proved that the stability criterion for the scheme implemented in the COSMO model is less restrictive if the DDFV method is used for the space discretisation. We also proved that if the Strang time-splitting is used together with the DDFV scheme, the stability criterion only depends on the horizontal spacing (see Theorem 6.3.3), unlike the Strang time-splitting combined with the COSMO scheme which depends also on the vertical spacing and the steepness of the domain.

Our results show that the DDFV method is a suitable method to discretise turbulent diffusion in a numerical weather prediction model. Future studies should investigate the 3-D DDFV method in the context of numerical weather prediction. The extension of the DDFV method to 3-D can be

done in different ways (see [Kre10], [CH11], [Her07] and [ABK08]). The DDFV method could then be implemented in the turbulent diffusion routine of the COSMO model. In addition, the implementation of the Strang time splitting method instead of the θ-method in the COSMO model should certainly be tested. Finally, future research could examine the Conjecture 4.7.1 in order to complete its proof.

Appendix A

Code for Section 3.5.1

1 % Code t o s o l v e \D e l t a u = f w i t h L {hh}

2 % V a r i a b l e s d e f i n i n g t h e domain

3 X = 1 ;

4 Y = 1 ;

5 f o r a l = 3 ;

6 a l = p i . / f o r a l ;

7

8 % D e f i n i n g t h e P o i s s o n problem

9 g = −100;

10 x0 = 0 . 8 ; % x−c o o r d i n a t e o f t h e c e n t e r o f t h e G a u s s i a n

11 y0 = 1 ; % y−c o o r d i n a t e o f t h e c e n t e r o f t h e G a u s s i a n

12 ue = @( x , y , a l ) exp( g∗( ( x−x0 ) . ˆ 2 + ( y−y0 ) . ˆ 2 ) ) ;

13 uex = @( x , y ) g∗( 2∗x−2∗x0 ) .∗exp( g∗( ( x−x0 ) . ˆ 2 + ( y−y0 ) . ˆ 2 ) ) ;

14 uey = @( x , y ) g∗( 2∗y−2∗y0 ) .∗exp( g∗( ( x−x0 ) . ˆ 2 + ( y−y0 ) . ˆ 2 ) ) ;

15 f = @( x , y ) 4∗g∗( g∗( ( x−x0 ) . ˆ 2 + ( y−y0 ) . ˆ 2 ) +1) .∗ . . .

16 exp( g∗( ( x−x0 ) . ˆ 2 + ( y−y0 ) . ˆ 2 ) ) ;

17

18 % B u i l d i n g t h e g r i d

19 n = 1 2 8 ; % number o f p o i n t s i n t h e h o r i z o n t a l d i r e c t i o n

20 m = 1 2 8 ; % number o f p o i n t s i n t h e v e r t i c a l d i r e c t i o n

21 dx = X/n ;

22 dy = Y/m;

23

24 xp = 0 : dx :X;

25 yp = 0 : dy :Y;

26 [ XP,YP]=m e s h g r i d( xp , yp ) ;

27

28 % B u i l d i n g t h e g r i d f o r t h e unknowns ( c e l l−c e n t e r e d method )

29 xd = dx / 2 : dx : X−dx / 2 ;

30 yd = dy / 2 : dy : Y−dy / 2 ;

31 [XD,YD]=m e s h g r i d( xd , yd ) ;

32

33 % B u i l d i n g t h e g r i d f o r t h e boundary c o n d i t i o n s

34 [XDP,YDP]=m e s h g r i d( xd , yp ) ;

35 [XPD,YPD]=m e s h g r i d( xp , yd ) ;

36

37 % M o d i f y i n g t h e y−c o o r d i n a t e o f t h e p o i n t s i n \Omega 2

38 i d x s l o p e = n /2+2: n+1;

39 a l = repmat ( a l , 1 ,l e n g t h( i d x s l o p e ) ) ;

40 h = z e r o s(s i z e( i d x s l o p e ) ) + cumsum( dx ∗ t a n( a l ) ) ;

41 h = repmat ( h ,m+1 ,1) ;

42 YP ( : , i d x s l o p e ) = YP ( : , i d x s l o p e ) + h ;

43 YD = (YP( 1 :end−1 , 2 :end) + YP( 1 :end−1 , 1 :end−1) + . . .

44 YP( 2 :end, 2 :end) + YP( 2 :end, 1 :end−1) ) / 4 ;

45 YPD = (YP( 1 :end−1 , : ) + YP( 2 :end, : ) ) / 2 ;

46 YDP = (YP ( : , 2 :end) + YP ( : , 1 :end−1) ) / 2 ;

47

48 % Computing t h e m e t r i c t e r m s

49 d z x i = 1/2 ∗ ( (YP( 1 :end−1 , 2 :end)−YP( 1 :end−1 , 1 :end−1) ) / dx + . . .

50 (YP( 2 :end, 2 :end)−YP( 2 :end, 1 :end−1) ) / dx ) ;

51 d z z e t a = 1/2 ∗ ( (YP( 2 :end, 2 :end)−YP( 1 :end−1 , 2 :end) ) / dy + . . .

52 (YP( 2 :end, 1 :end−1)−YP( 1 :end−1 , 1 :end−1) ) / dy ) ;

53 z e t a x = −d z x i . / d z z e t a ;

54 z e t a z = 1 . / d z z e t a ;

55

56 d 2 z x i 2 = 1/2 ∗ ( ( (YP( 2 :end, 4 :end)−YP( 2 :end, 2 :end−2) ) / ( 2∗dx )−. . .

57 (YP( 2 :end, 3 :end−1)−YP( 2 :end, 1 :end−3) ) / ( 2∗dx ) ) / dx + . . .

58 ( (YP( 1 :end−1 , 4 :end)−YP( 1 :end−1 , 2 :end−2) ) / ( 2∗dx )−. . .

59 (YP( 1 :end−1 , 3 :end−1)−YP( 1 :end−1 , 1 :end−3) ) / ( 2∗dx ) ) / dx ) ;

60 d 2 z x i 2 l = 1/2 ∗ ( ( (YP( 2 :end, 3 )−YP( 2 :end, 1 ) ) / ( 2∗dx )−. . .

61 (YP( 2 :end, 2 )−YP( 2 :end, 1 ) ) / dx ) / ( dx / 2 ) + . . .

62 ( (YP( 1 :end−1 ,3)−YP( 1 :end−1 ,1) ) / ( 2∗dx )−. . .

63 (YP( 1 :end−1 ,2)−YP( 1 :end−1 ,1) ) / dx ) / ( dx / 2 ) ) ;

64 d 2 z x i 2 r = 1/2 ∗ ( ( (YP( 2 :end,end)−YP( 2 :end,end−1) ) /dx−. . .

65 (YP( 2 :end,end)−YP( 2 :end,end−2) ) / ( 2∗dx ) ) / ( dx / 2 ) + . . .

66 ( (YP( 1 :end−1 ,end)−YP( 1 :end−1 ,end−1) ) /dx−. . .

67 (YP( 1 :end−1 ,end)−YP( 1 :end−1 ,end−2) ) / ( 2∗dx ) ) / ( dx / 2 ) ) ;

68 d 2 z x i 2 = [ d 2 z x i 2 l d 2 z x i 2 d 2 z x i 2 r ] ;

69

70 d 2 z x i z e t a = 1/ dx ∗ ( (YP( 2 :end, 2 :end)−YP( 1 :end−1 , 2 :end) ) / dy −. . .

71 (YP( 2 :end, 1 :end−1)−YP( 1 :end−1 , 1 :end−1) ) / dy ) ;

72

73 d 2 z z e t a 2 = 1/2 ∗ ( ( (YP( 4 :end, 2 :end)−YP( 2 :end−2 , 2 :end) ) / ( 2∗dy )−. . .

74 (YP( 3 :end−1 , 2 :end)−YP( 1 :end−3 , 2 :end) ) / ( 2∗dy ) ) / dy + . . .

75 ( (YP( 4 :end, 1 :end−1)−YP( 2 :end−2 , 1 :end−1) ) / ( 2∗dy )−. . .

76 (YP( 3 :end−1 , 1 :end−1)−YP( 1 :end−3 , 1 :end−1) ) / ( 2∗dy ) ) / dy ) ;

77 d 2 z z e t a 2 b = 1/2 ∗ ( ( (YP( 3 , 2 :end)−YP( 1 , 2 :end) ) / ( 2∗dy )−. . .

78 (YP( 2 , 2 :end)−YP( 1 , 2 :end) ) / dy ) / ( dy / 2 ) + . . .

79 ( (YP( 3 , 1 :end−1)−YP( 1 , 1 :end−1) ) / ( 2∗dy )−. . .

80 (YP( 2 , 1 :end−1)−YP( 1 , 1 :end−1) ) / dy ) / ( dy / 2 ) ) ;

81 d 2 z z e t a 2 t = 1/2 ∗ ( ( (YP(end, 2 :end)−YP(end−1 , 2 :end) ) /dy−. . .

82 (YP(end, 2 :end)−YP(end−2 , 2 :end) ) / ( 2∗dy ) ) / ( dy / 2 ) + . . .

83 ( (YP(end, 1 :end−1)−YP(end−1 , 1 :end−1) ) /dy−. . .

84 (YP(end, 1 :end−1)−YP(end−2 , 1 :end−1) ) / ( 2∗dy ) ) / ( dy / 2 ) ) ;

85 d 2 z z e t a 2 = [ d 2 z z e t a 2 b ; d 2 z z e t a 2 ; d 2 z z e t a 2 t ] ;

86

87 z e t a x x = ( 1 . / d z z e t a ) .∗ (−d 2 z x i 2 − 2∗d 2 z x i z e t a .∗ z e t a x − . . .

88 d 2 z z e t a 2 .∗ z e t a x . ˆ 2 ) ;

89 z e t a z z = −(1./ d z z e t a ) .∗ d 2 z z e t a 2 .∗ z e t a z . ˆ 2 ;

90

91 z e t a x = [z e r o s( 1 , n ) ; z e t a x ; z e r o s( 1 , n ) ] ;

92 z e t a z = [z e r o s( 1 , n ) ; z e t a z ; z e r o s( 1 , n ) ] ;

93 z e t a x x = [z e r o s( 1 , n ) ; z e t a x x ; z e r o s( 1 , n ) ] ;

94 z e t a z z = [z e r o s( 1 , n ) ; z e t a z z ; z e r o s( 1 , n ) ] ;

95 z e t a x = z e t a x ( : ) ;

96 z e t a z = z e t a z ( : ) ;

97 z e t a x x = z e t a x x ( : ) ;

98 z e t a z z = z e t a z z ( : ) ;

99

100 z e t a x 2 = z e t a x . ˆ 2 ;

101 z e t a z 2 = z e t a z . ˆ 2 ;

102

103 % Computing t h e normal v e c t o r p o i n t i n g downwards

104 v1y = YP( [ 1 end] , 2 :end)−YP( [ 1 end] , 1 :end−1) ;

105 v1x = XP( [ 1 end] , 2 :end)−XP( [ 1 end] , 1 :end−1) ;

106 normv1 = s q r t( v1x . ˆ 2 + v1y . ˆ 2 ) ;

107 ntx = 1 . / normv1 .∗ v1y ;

108 nty = −1./ normv1 .∗ v1x ;

109 ntx = ntx ( : ) ;

110 nty = nty ( : ) ;

111

112 % Computing t h e Neumann c o e f f i c i e n t s

113 d z x i n = (YP( [ 1 end] , 2 :end)−YP( [ 1 end] , 1 :end−1) ) / dx ;

114 d z z e t a n = 1/2 ∗ ( (YP( [ 2 end] , 2 :end)−YP( [ 1 end−1 ] , 2 :end) ) / dy + . . .

115 (YP( [ 2 end] , 1 :end−1)−YP( [ 1 end−1 ] , 1 :end−1) ) / dy ) ;

116 z e t a x n = −d z x i n . / d z z e t a n ;

117 z e t a z n = 1 . / d z z e t a n ;

118 z e t a x n = z e t a x n ( : ) ;

119 z e t a z n = z e t a z n ( : ) ;

120

121 n t 1 = ntx ;

122 n t 2 = ntx .∗ z e t a x n + nty .∗ z e t a z n ;

123

124 n t 1 = kron(s p e y e( n , n ) ,s p a r s e( [ 1 m+ 2 ] , [ 1 2 ] , [ 1 1 ] ,m+2 ,2) ) ∗ n t 1 ;

125 n t 2 = kron(s p e y e( n , n ) ,s p a r s e( [ 1 m+ 2 ] , [ 1 2 ] , [ 1 1 ] ,m+2 ,2) ) ∗ n t 2 ;

126

127 % E v a l u a t i n g boundary c o n d i t i o n s

128 gb = [ ue (XPD( : , 1 ) ,YPD( : , 1 ) , a l ) ; ue (XPD( : ,end) ,YPD( : ,end) , a l ) ] ;

129

130 gc = [ ue (XP( 1 , 1 ) ,YP( 1 , 1 ) , a l ) ; ue (XP(end, 1 ) ,YP(end, 1 ) , a l ) ;

131 ue (XP( 1 ,end) ,YP( 1 ,end) , a l ) ; ue (XP(end,end) ,YP(end,end) , a l ) ] ;

132

133 p h i = [ ntx ( 1 , : ) .∗uex (XDP( 1 , : ) ,YDP( 1 , : ) )+nty ( 1 , : ) .∗uey (XDP( 1 , : ) ,YDP( 1 , : ) )

; . . .

134 −ntx ( 2 , : ) .∗uex (XDP(end, : ) ,YDP(end, : ) )−nty ( 2 , : ) .∗uey (XDP(end, : ) , YDP(end, : ) ) ] ;

135 p h i = p h i ( : ) ;

136

137 % E v a l u a t i n g t h e r i g h t−hand s i d e o f t h e P o i s s o n problem

138 f p = [z e r o s( 1 , n ) ; f (XD,YD) ; z e r o s( 1 , n ) ] ;

139 f p = f p ( : ) ;

140

141 % B u i l d i n g t h e Matrix a s s o c i a t e d w i t h t h e L {hh} scheme

142 % Axx

143 e = o n e s ( n , 1 ) ;

144 Axx = 1/ dx ˆ2 ∗ kron(s p d i a g s( [ e −[ 3 ; 2∗o n e s ( n−2 ,1) ; 3 ] e ] ,−1 : 1 , n , n ) , . . .

145 s p d i a g s( [ 0 ; o n e s (m, 1 ) ; 0 ] , 0 ,m+2 ,m+2) ) ;

146 % Ay

147 e = o n e s (m, 1 ) ;

148 Aym = s p d i a g s( [−[ e ;z e r o s( 2 , 1 ) ] z e r o s(m+2 ,1) . . .

149 [z e r o s( 2 , 1 ) ; e ] ] ,−1 : 1 ,m+2 ,m+2) ;

150 Ay = 1/ dy /2 ∗ kron(s p e y e( n ) ,Aym) ;

151 Ay = b s x f u n ( @times , z e t a x x+z e t a z z , Ay) ;

152

153 % Axy

154 Axyn = [−o n e s ( n , 1 ) z e r o s( n , 1 ) o n e s ( n , 1 ) ] ;

155 Axyn = s p d i a g s( Axyn ,−1 : 1 , n , n ) ;

156 Axym = [−o n e s (m, 1 ) z e r o s(m, 1 ) o n e s (m, 1 ) ] ;

157 Axym = s p d i a g s(Axym, 0 : 2 , m,m+2) ;

158 Axym = [z e r o s( 1 ,m+2) ; Axym ; z e r o s( 1 ,m+2) ] ;

159 Axy1 = kron( Axyn , Axym) ;

160

161 Axyn2 = s p a r s e( [ 1 n ] , [ 1 n ] , [ 1 −1] , n , n ) ;

162 Axym2 = [ [ 0 ;−o n e s (m−1 ,1) ] [−1 ;z e r o s(m−2 ,1) ; 1 ] [ o n e s (m−1 ,1) ; 0 ] ] ;

163 Axym2 = s p d i a g s(Axym2 , 0 : 2 , m,m+2) ;

164 Axym2 = [z e r o s( 1 ,m+2) ; Axym2 ; z e r o s( 1 ,m+2) ] ;

165 Axy2 = kron( Axyn2 , Axym2) ;

166 Axy = Axy1 + Axy2 ;

167 Axy = b s x f u n ( @times , z e t a x /2/ dx /dy , Axy ) ;

168

169 % Ayy

170 Ayym = [ o n e s (m, 1 ) −2∗o n e s (m, 1 ) o n e s (m, 1 ) ] ;

171 Ayym = s p d i a g s(Ayym, 0 : 2 , m,m+2) ;

172 Ayym = [z e r o s( 1 ,m+2) ; Ayym ; z e r o s( 1 ,m+2) ] ;

173 Ayy = kron(s p e y e( n , n ) ,Ayym) ;

174 Ayy = b s x f u n ( @times , z e t a z 2+z e t a x 2 , Ayy ) /dy ˆ 2 ;

175

176 % N

177 e = o n e s ( n , 1 ) ;

178 Nxn1 = s p d i a g s([−e z e r o s( n , 1 ) e ] ,−1 : 1 , n , n ) ;

179 Nxm1 = s p d i a g s( [ [z e r o s(m, 1 ) ;−1 ; 0 ] [ 1 ;z e r o s(m, 1 ) ;−1 ] . . .

180 [ 0 ; 1 ;z e r o s(m, 1 ) ] ] ,−1 : 1 ,m+2 ,m+2) ;

181 Nxn2 = s p d i a g s( [ 1 ;z e r o s( n−2 ,1) ;−1 ] , 0 , n , n ) ;

182 Nxm2 = s p d i a g s( [ [z e r o s(m, 1 ) ;−2 ; 0 ] z e r o s(m+2 ,1) . . .

183 [ 0 ; 2 ;z e r o s(m, 1 ) ] ] ,−1 : 1 ,m+2 ,m+2) ;

184 Nx = b s x f u n ( @times , nt1 , 1/4/ dx ∗ (kron( Nxn1 , Nxm1) + kron( Nxn2 , Nxm2) ) ) ;

185

186 Nym = s p a r s e( [ 1 1 m+2 m+ 2 ] , [ 1 2 m+1 m+2] ,[−1 1 1 −1] ,m+2 ,m+2) ;

187 Ny = b s x f u n ( @times , nt2 ,kron(s p e y e( n , n ) ,Nym) ) / dy ;

188

189 % Gxx

190 Gxxn = [ [ 1 ; z e r o s( n−1 ,1) ] [z e r o s( n−1 ,1) ; 1 ] ] ;

191 Gxxm = [z e r o s( 1 ,m) ; s p e y e(m) ; z e r o s( 1 ,m) ] ;

192 Gxx = 2/ dx ˆ2 ∗ kron( Gxxn , Gxxm) ;

193 Gxx = Gxx ∗ gb ;

194

195 % Gxy

196 Gxyn = [ [ 1 ; z e r o s( n−1 ,1) ] [z e r o s( n−1 ,1) ;−1 ] ] ;

197 Gxym = [ o n e s (m, 1 ) z e r o s(m, 1 ) −o n e s (m, 1 ) ] ;

198 Gxym = s p d i a g s(Gxym,−1 : 1 ,m,m) ;

199 Gxym = [z e r o s( 1 ,m) ; Gxym ; z e r o s( 1 ,m) ] ;

200 Gxylr = kron( Gxyn , Gxym) ∗ gb ;

201 Gxym2 = [ [ 0 ; 1 ;z e r o s(m, 1 ) ] [z e r o s(m, 1 ) ;−1 ; 0 ] ] ;

202 Gxyc = kron( Gxyn , Gxym2) ∗ gc ;

203 Gxy = z e t a x / dy / dx .∗ ( Gxylr + Gxyc ) ;

204 205 % Fn

206 Fnm = [ [ 1 ; z e r o s(m+1 ,1) ] [z e r o s(m+1 ,1) ; 1 ] ] ;

207 Fn = kron(s p e y e( n , n ) ,Fnm) ;

208 Fn = Fn ∗ p h i ;

209 210 % Gx

211 Gxn = [ [ 1 ;z e r o s( n−1 ,1) ] [z e r o s( n−1 ,1) ;−1 ] ] ;

212 Gxm1 = s p a r s e( [ 1 m+ 2 ] , [ 1 m] , [−1 1 ] ,m+2 ,m) ;

213 Gxm2 = [ [−1 ;z e r o s(m+1 ,1) ] [z e r o s(m+1 ,1) ; 1 ] ] ;

214 Gx = b s x f u n ( @times , nt1 , 1 / 2 / dx ∗ (kron( Gxn , Gxm1) ∗ gb + kron( Gxn , Gxm2) ∗ gc ) ) ;

215

216 A = Axx + Ay + Axy + Ayy + Nx + Ny ;

217 b = f p − Gxx − Gxy + Fn − Gx ;

218

219 % S o l v i n g Au=b

220 u=A\b ;

221

222 U a l l = r e s h a p e( u ,m+2 ,n ) ;

223 U = U a l l ( 2 :m+ 1 , : ) ;

224

225 % P l o t t h e computed s o l u t i o n

226 f i g u r e

227 mesh(XD,YD,U)

228 t i t l e( ’ Computed s o l u t i o n ’ )

229

230 % P l o t t h e e x a c t s o l u t i o n

231 f i g u r e

232 mesh(XD,YD, ue (XD,YD) )

233 t i t l e( ’ Exact s o l u t i o n ’ )

234

235 % P l o t t h e e r r o r

236 f i g u r e

237 mesh(XD,YD, ue (XD,YD)−U)

238 t i t l e( [ ’ E r r o r o f L {hh} f o r \D e l t a u= ’ , f u n c 2 s t r ( f ) , ’ w i t h \a l p h a=\p i / ’ , num2str( f o r a l ) , ’ and h=1/ ’ ,num2str( n ) ] )

Appendix B

Code for Section 3.4.1

> restart;

> o:=5;

> u1 := mtaylor(u(xi+h, zeta), [h = 0, k = 0], o);

> u2 := mtaylor(u(xi-h, zeta), [h = 0, k = 0], o);

> u3 := mtaylor(u(xi+h, zeta+k), [h = 0, k = 0], o);

> u4 := mtaylor(u(xi+h, zeta-k), [h = 0, k = 0], o);

> u5 := mtaylor(u(xi-h, zeta+k), [h = 0, k = 0], o);

> u6 := mtaylor(u(xi-h, zeta-k), [h = 0, k = 0], o);

> u7 := mtaylor(u(xi+h, zeta+2*k), [h = 0, k = 0], o);

> u8 := mtaylor(u(xi+h, zeta-2*k), [h = 0, k = 0], o);

> u9 := mtaylor(u(xi, zeta+2*k), [h = 0, k = 0], o);

> u10 := mtaylor(u(xi, zeta-2*k), [h = 0, k = 0], o);

> u11 := mtaylor(u(xi-h, zeta+2*k), [h = 0, k = 0], o);

> u12 := mtaylor(u(xi-h, zeta-2*k), [h = 0, k = 0], o);

> u13 := mtaylor(u(xi, zeta+k), [h = 0, k = 0], o);

> u14 := mtaylor(u(xi, zeta-k), [h = 0, k = 0], o);

> zz1 := mtaylor(zz(xi,zeta+k/2),[h=0,k=0],o);

> zz2 := mtaylor(zz(xi,zeta-k/2),[h=0,k=0],o);

> zx1 := mtaylor(zx(xi+h/2,zeta),[h=0,k=0],o);

> zx2 := mtaylor(zx(xi-h/2,zeta+k),[h=0,k=0],o);

> zx3 := mtaylor(zx(xi-h/2,zeta-k),[h=0,k=0],o);

> zx4 := mtaylor(zx(xi+h/2,zeta+k),[h=0,k=0],o);

> zx5 := mtaylor(zx(xi+h/2,zeta-k),[h=0,k=0],o);

> zx6 := mtaylor(zx(xi-h/2,zeta),[h=0,k=0],o);

> COSMO := (u1-2*u(xi,zeta)+u2)/h^2 + (zz1+zz2)/2/k^2*(zz1*(u13-u(xi,zeta)) - zz2

*(u(xi,zeta)-u14)) + 1/4/h/k*(zx1*(u13-u14+u3-u4)-zx6*(u5-u6+u13-u14)) + (zx6+zx1)/8/h/k

*(u3-u4-u5+u6) + (zx6+zx1)/16/2/k^2*(zx2*(u11-u2+u9-u(xi,zeta))-zx3*(u2-u12+u(xi,zeta) -u10)+zx4*(u9-u(xi,zeta)+u7-u1)-zx5*(u(xi,zeta)-u10+u1-u8));

> collect(COSMO,[h,k],factor);

> k:=h;

> zx:=(xi,zeta)->-(1/3)*Y^2*tan(al)*zeta^(-2);

> zz:=(xi,zeta)->(1/3)*Y^2*zeta^(-2);

> teCosmo:=coeff(resCosmopoly,h,2);

> simplify(teCosmo);

Bibliography

[ABH04] Boris Andreianov, Franck Boyer and Florence Hubert. “Finite Volume Schemes for the p–Laplacian on Cartesian Meshes”. In:Mathematical Modelling and Numerical Analysis 38 (Nov. 2004), pp. 931–959.

[ABH07] Boris Andreianov, Franck Boyer and Florence Hubert. “Discrete Duality Finite Volume Schemes for Leray-Lions-Type Elliptic Problems on General 2D Meshes”. In:Numerical Methods for Partial Differential Equations23 (Jan. 2007), pp. 145 –195.

[ABH13] Boris Andreianov, Mostafa Bendahmane and Florence Hubert. “On 3D DDFV Discretiz-ation of Gradient and Divergence Operators. II. Discrete Functional Analysis Tools and Applications to Degenerate Parabolic Problems.” In:Computational Methods in Applied Mathematics 13 (Oct. 2013).

[ABK08] Boris Andreianov, Mostafa Bendahmane and Kenneth Hvistendahl Karlsen. “A Gradient Reconstruction Formula for Finite Volume Schemes and Discrete Duality”. In: Finite volumes for complex applications V (2008), pp. 161–168.

[AHK11] Boris Andreianov, Florence Hubert and Stella Krell. “Benchmark 3D: A Version of the DDFV Scheme with Cell/Vertex Unknowns on General Meshes”. In:Springer Proceedings in Mathematics 4 (June 2011).

[AL77] Akio Arakawa and Vivian R. Lamb. “Computational Design of the Basic Dynamical Processes of the UCLA General Circulation Model”. In:Methods in computational physics 17 (1977), pp. 173–265.

[And+12] Boris Andreianov et al. “On 3D DDFV Discretization of Gradient and Divergence Op-erators. I. Meshing, Operators and Discrete Duality”. In: IMA Journal of Numerical Analysis32 (Oct. 2012).

[Bal08] Michael Baldauf. “Stability Analysis for Linear Discretisations of the Advection Equation with Runge-Kutta Time Integration”. In:J. Comput. Phys.227.13 (June 2008), pp. 6638–

6659.

[Bal10] Michael Baldauf. “Linear Stability Analysis of Runge–Kutta-Based Partial Time-Splitting Schemes for the Euler Equations”. In:Monthly Weather Review138.12 (2010), pp. 4475–

4496.

[Bal1908] Walter William R. Ball.A Short Account of the History of Mathematics. Dover Books on Mathematics Series. Dover Publications, 1908.

[BB16] Michael Baldauf and Slavko Brdar. “3D Diffusion in Terrain-following Coordinates: Test-ing and Stability of Horizontally Explicit, Vertically Implicit Discretizations”. In: 142 (Mar. 2016).

[BH08a] Franck Boyer and Florence Hubert. “Benchmark for Anisotropic Problems. the DDFV

”Discrete Duality Finite Volumes” and m–DDFV Schemes”. In: (June 2008).

[BH08b] Franck Boyer and Florence Hubert. “Finite Volume Method for 2D Linear and Nonlinear Elliptic Problems with Discontinuities”. In:SIAM J. Numerical Analysis46 (Jan. 2008), pp. 3032–3070.

[BH08c] Franck Boyer and Florence Hubert. “Finite Volume Method for Nonlinear Transmission Problems”. In:Lecture Notes in Computational Science and Engineering 60 (Jan. 2008).

[BH08d] Franck Boyer and Florence Hubert. “The DDFV ”Discrete Duality Finite Volumes” and m–DDFV Schemes”. In:Finite Volumes for Complex Applications5 (Jan. 2008), pp. 735–

750.

[BHK08] Franck Boyer, Florence Hubert and Stella Krell. “Non–Overlapping Schwarz Algorithm for DDFV Schemes on General 2D Meshes”. In: (June 2008).

[BHK09] Franck Boyer, Florence Hubert and Stella Krell. “Non–Overlapping Schwarz Algorithm for Solving 2D m–DDFV Schemes”. In: Ima Journal of Numerical Analysis – IMA J NUMER ANAL29 (Oct. 2009).

[BKN15] Franck Boyer, Stella Krell and Flore Nabet. “Inf–Sup Stability of the Discrete Duality Finite Volume Method for the 2D Stokes Problem”. In:Mathematics of Computation 84 (Jan. 2015).

[BKN17] Franck Boyer, Stella Krell and Flore Nabet. “Benchmark Session: The 2D Discrete Du-ality Finite Volume Method”. In: May 2017, pp. 163–180.

[BR87] Randolph Bank and Donald Rose. “Some Errors Estimates for the Box Method”. In:

SIAM J. Numer. Anal.24.4 (Aug. 1987), pp. 777–787.

[Bre87] Ha¨ım Brezis.Analyse Fonctionnelle. Masson, 1987.

[CCHK17] Cl´ement Canc`es, Claire Chainais-Hillairet and Stella Krell. “Numerical Analysis of a Nonlinear Free–Energy Diminishing Discrete Duality Finite Volume Scheme for Con-vection Diffusion Equations”. In:Computational Methods in Applied Mathematics (May 2017).

[CFL28] Richard Courant, Kurt Friedrichs and Hans Lewy. “ ¨Uber die Partiellen Differenzengleichun-gen der Mathematischen Physik”. In:Mathematische Annalen100.1 (Dec. 1928), pp. 32–

74.

[CGR12] Carsten Carstensen, Joscha Gedicke and Donsub Rim. “Explicit Error Estimates for Courant, Crouzeix-Raviart and Raviart-Thomas Finite Element Methods”. In:Journal of Computational Mathematics30.4 (2012).

[CH11] Yves Coudi`ere and Florence Hubert. “A 3D Discrete Duality Finite Volume Method for Nonlinear Elliptic Equations”. In:SIAM Journal on Scientific Computing 33.4 (2011), pp. 1739–1764.

[Che] Long Chen.Lecture Notes on Finite Volumes.http://www.math.uci.edu/~chenlong/

226/FVM.pdf.

[CHKM14] Claire Chainais-Hillairet, Stella Krell and Alexandre Mouton. “Convergence Analysis of a DDFV Scheme for a System Describing Miscible Fluid Flows in Porous Media”. In:

Numerical Methods for Partial Differential Equations31 (Aug. 2014).

[CHM11] Yves Coudi`ere, Florence Hubert and Gianmarco Manzini. “A CeVeFE DDFV Scheme for Discontinuous Anisotropic Permeability Tensors”. In:Proceedings on Finite Volume for complex applications VI 4 (June 2011).

[Cia78] Philippe G . Ciarlet.The Finite Element Method for Elliptic Problems. Studies in math-ematics and its applications 4. North-Holland, 1978.

[DDO07] Sarah Delcourte, Komla Domelevo and Pascal Omnes. “A Discrete Duality Finite Volume Approach to Hodge Decomposition and Div-Curl Problems on Almost Arbitrary Two-Dimensional Meshes”. English. In: SIAM Journal on Numerical Analysis 45.3 (2007), pp. 1142–1174.

[Del07] Sarah Delcourte. “D´eveloppement de M´ethodes de Volumes Finis pour la M´ecanique des Fluides.” PhD thesis. Universit´e Paul Sabatier, Toulouse, 2007.

[Del09] Sarah Delcourte. “A Discrete Duality Finite Volume Method for Elliptic Problems with Corner Singularities”. In:International Journal on Finite Volumes 6.1 (2009).

[DO05] Komla Domelevo and Pascal Omnes. “A Finite Volume Method for the Laplace Equation on Almost Arbitrary Two-dimensional Grids”. In:ESAIM: Mathematical Modelling and Numerical Analysis39.06 (2005), pp. 1203–1249.

[DO15] Sarah Delcourte and Pascal Omnes. “A Discrete Duality Finite Volume Discretization of the Vorticity–Velocity–Pressure Formulation of the 2D Stokes Problem on Almost Arbit-rary Two–Dimensional Grids”. In:Numerical Methods for Partial Differential Equations 31 (Jan. 2015).

[DO17] Sarah Delcourte and Pascal Omnes. “Numerical Results for a Discrete Duality Finite Volume Discretization Applied to the Navier–Stokes Equations”. In: May 2017, pp. 141–

161.

[Dom11] G¨unther. Doms. “Dynamics and Numerics”. In: A Description of the Nonhydrostatic Regional COSMO-Model (2011).

[EGH00] Robert Eymard, Thierry Gallou¨et and Rapha`ele Herbin. “Finite Volume Methods”. In:

Handbook of numerical analysis 7 (2000), pp. 713–1018.

[Eva98] Lawrence C. Evans. Partial Differential Equations. Graduate studies in mathematics.

American Mathematical Society, 1998.

[FGM18] Oliver Fuhrer, Martin J. Gander and Sandie Moody. “Domain Decomposition Coupling of FV4 and DDFV for Numerical Weather Prediction”. In:Domain Decomposition Methods in Science and Engineering XXV. Submitted. Springer, 2018.

[FLT16] Menso Folkerts, Dieter Launert and Andreas Thom. “Jost B¨urgi’s Method for Calculating Sines”. In:Historia Mathematica 43.2 (2016), pp. 133 –147.

[GA00] Ricardo G. Duran Gabriel Acosta. “The Maximum Angle Condition for Mixed and Non-conforming Elements: Application to the Stokes Equations”. In:SIAM Journal on Nu-merical Analysis37.1 (2000), pp. 18–36.

[Gan+16] Martin J. Gander et al. “DDFV Ventcell Schwarz algorithms”. In:Domain Decomposition Methods in Science and Engineering XXII. Springer, 2016, pp. 481–489.

[GCS75] Tzvi Gal-Chen and Richard C. J. Somerville. “On the Use of a Coordinate Transform-ation for the Solution of the Navier-Stokes EquTransform-ations”. In:J. Comput. Phys.17 (1975),

[GCS75] Tzvi Gal-Chen and Richard C. J. Somerville. “On the Use of a Coordinate Transform-ation for the Solution of the Navier-Stokes EquTransform-ations”. In:J. Comput. Phys.17 (1975),

Documents relatifs