Upwinding - Universität Stuttgart
Transcription
Upwinding - Universität Stuttgart
Upwinding Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/cover_sheet.tex page 1 of 20 – p. 1/20 Table of contents 1. Introduction Upwinding (Transport Equation) 2. Comparison with the Central Difference Scheme 3. Upwinding (Advection Equation) 4. Courant number 5. Alternative Interpretation 6. Further discretization schemes Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/toc_9.tex page 2 of 20 – p. 2/20 Introduction to upwind methods Before we have mainly considerd centered methods, symmetric about the point where we are updating the solution. These methods are appropriate for all systems, in which the information is travelling uniformly in all directions. Differential equations that are describing these kinds of problems are called elliptic equations. The model example is a stone that is thrown into a lake. The waves are propagating in circles. The Laplace equation of groundwater flow and the heat diffusion equation are examples for this kind of physiccal problems. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/intro_upwind_1.tex page 3 of 20 – p. 3/20 Introduction to upwind methods For hyperbolic problems, however, we expect information to propagate in a certain direction. Supercritical flow in rivers or supersonic speed of an airplane are physical examples. In an advection/diffusion problem, e.g. represented by the transport equation ∂c ∂2c v −D 2 =0 ∂x ∂x we speak of a parabolic equation. This is the type of equation that is lying between the two extremes (elliptic and hyperbolic). The advective term in the equation represents the hyperbolic character, whereas the diffusion term represents the elliptic part. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/intro_upwind_1b.tex page 4 of 20 – p. 4/20 Introduction to upwind methods The Peclet number vL Pe = D describes the relation between the advective and the diffusive part. If the Peclet number is very small the diffusive part dominates and central discretization schemes are the best choice. If, on the ohter hand, the Peclet number is very high, then the advective term is dominating and Upwinding methods are appropriate. Upwinding schemes use backward differences to discretize the advective term. The information is travelling with the flow and it therefore makes sense to take only the upstream information into account. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/intro_upwind_1c.tex page 5 of 20 – p. 5/20 Comparison of upwinding and central scheme In the Upwinding method we consider the upstream and the current node in the advection term: ci − ci−1 ci+1 − 2ci + ci−1 =0 −D v 2 ∆x (∆x) Central difference scheme: ci+1 − ci−1 ci+1 − 2ci + ci−1 v =0 −D 2 2∆x (∆x) Take the upwinding scheme and add and subtract the advection term of the central scheme. ci − ci−1 ci+1 − ci−1 ci+1 − ci−1 ci+1 − 2ci + ci−1 v =0 +v −v −D 2 ∆x 2∆x 2∆x (∆x) Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/comp_upwind_central.tex page 6 of 20 – p. 6/20 Comparison of upwinding and central scheme ci − ci−1 ci+1 − ci−1 ci+1 − ci−1 ci+1 − 2ci + ci−1 v −v +v −D ∆x 2∆x 2∆x (∆x)2 {z } | central scheme ci+1 − ci−1 ci+1 − 2ci + ci−1 2ci − 2ci−1 − ci+1 + ci−1 +v −D v 2∆x 2∆x (∆x)2 −ci+1 + 2ci − ci−1 ci+1 − ci−1 ci+1 − 2ci + ci−1 v +v −D 2∆x 2∆x (∆x)2 v∆x ci+1 − 2ci + ci−1 ci+1 − ci−1 ci+1 − 2ci + ci−1 − +v −D 2 2 (∆x) 2∆x (∆x)2 ci+1 − ci−1 ci+1 − 2ci + ci−1 v∆x D ci+1 − 2ci + ci−1 +v −D − 2 D 2 (∆x) 2∆x (∆x)2 Universität Stuttgart =0 =0 =0 =0 =0 Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/comp_upwin_central2.tex page 7 of 20 – p. 7/20 Comparison of upwinding and central scheme ci+1 − ci−1 ci+1 − 2ci + ci−1 P e ci+1 − 2ci + ci−1 +v =0 −D − D 2 2 2 (∆x) 2∆x (∆x) ci+1 − ci−1 P e ci+1 − 2ci + ci−1 v =0 −D 1+ 2 2∆x 2 ∆x | {z } The diffusion is artificially increased. ⇓ P e ∂2c ∂c − D(1 + ) 2 =0 v ∂x 2 ∂x This diffusion is referred to as numerical diffusion. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/comp_upwin_central3.tex page 8 of 20 – p. 8/20 Combination of the methods One can also try to combine the advantages of the two methods. Use the better accuracy of the central difference scheme with the stability of the upwind scheme. The upwind coefficient α is the weighting factor. Central differences ∂c (ui+1 − ui−1 ) = ∂x centr 2∆x Upwinding: ∂c (ui − ui−1 ) = ∂x upw ∆x Linear interpolation with upwind-coefficient α ∂c (ui − ui−1 ) (ui+1 − ui−1 ) =α + (1 − α) ∂x adv ∆x ∆x Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/comb_methods.tex page 9 of 20 – p. 9/20 Advection equation In a scalar advection problem, e.g. the hyperbolic advection equation ∂c ∂c +v =0 (1) ∂t ∂x the velocity is independent of the concentration. The linear, hyperbolic first-order equation has been studied intensively and several schemes have been proposed to solve this equation. Here we will present some of these. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/adv_eqn.tex page 10 of 20 – p. 10/20 Upwinding (Advection equation) Using an explicit time discretization and a backward difference scheme in space leads to the first-order upwind method for the advection equation 1 v n n+1 n n ui − ui + ui − ui−1 = 0 ∆t ∆x un+1 i tn+1 tn uni−1 uni uni+1 x where the chained lines indicate time and space levels and the solid boxes are the control volumes. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/intro_upwind_3.tex page 11 of 20 – p. 11/20 Upwinding II (Advection equation) The first-order upwind method for the advection equation is conditionally stable. v∆t n n+1 n ui = ui − (ui − uni−1 ). ∆x The ratio v∆t Cr = ∆x is known as the Courant Number. It can be interpreted as the physical velocity v over the grid velocity ∆x/∆t. For Cr = 1 the solution is exact, for smaller Courant numbers the solution is stable but a large amount of numerical diffusion is introduced. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/intro_upwind_3.tex page 12 of 20 – p. 12/20 Alternative interpretation Think of uni as being the value at the grid point, uni ≈ ũ(xi , tn ) in a finite difference setting. Then since u(x,t) is constant along its characteristic, i.e. the path line, we expect: un+1 ≈ ũ(xi , tn+1 ) = ũ(xi − v∆t, tn ) i un+1 i tn+1 ∆t tn x uni−1 uni xi − v∆t Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/altern_interpr_1.tex page 13 of 20 – p. 13/20 Alternative interpretation If un+1 represents the value at a grid point, then we can trace the i characteristic back and interpolate. We approximate this value by a linear interpolation between the grid values uni−1 and uni . un+1 i v∆t n v∆t uni = ui−1 + 1 − ∆x ∆x −→ This is simply the upwind method. Here we can see that we have a weighted average between the two nodes. This makes physical sense as long as the characteristic really intersects the old time level between the two nodes, which is again our condition Cr ≤ 1. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/altern_interpr_2.tex page 14 of 20 – p. 14/20 Central difference scheme The unstable centered method applied to the advection equation with an explicit time discretization scheme yields the following equation v 1 n+1 n n n ui − ui + ui+1 − ui−1 = 0. ∆t 2∆x v∆t n n+1 n n ui = ui − ui+1 − ui−1 . 2∆x Note the slight difference in the advection term. The additional factor 21 and the uni+1 instead of uni . This solution is always unstable! Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/central_diff.tex page 15 of 20 – p. 15/20 Lax Scheme I t unknown known n+1 ∆t n ∆x ∆x i−1 i s i+1 The diffusive (lax) method distinguishes itself from the unstable model insofar as that for the time derivation not uni is used, but a n+1 mean from un+1 and u i−1 i+1 . This scheme is stable for Cr ≤ 1. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/lax_scheme_1.tex page 16 of 20 – p. 16/20 Lax Scheme II uni+1 − uni−1 ∂u ≈ ∂x 2∆x (as in the unstable method) 2un+1 − uni−1 − uni+1 ∂u i ≈ ∂t 2∆t (new compared to the unstable method) or, more general: ∂u ≈ ∂t (0 ≤ α ≤ 1; un+1 i n n n − αui + (1 − α) ui−1 + ui+1 /2 ∆t for α = 1 results the unstable model). u ≈ uni Universität Stuttgart uni−1 + uni+1 or u ≈ 2 Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/lax_scheme_2.tex page 17 of 20 – p. 17/20 Preissmann Scheme t k+1 Θ ∆t unknown known (1− Θ )∆ t approximated k i ∆ x ij 2 ∆ x ij 2 j s ∆ x ij The Preissmann scheme differs from the before mentioned schemes by also averaging the time derivative. The first derivatives are depictable in the point + in the space and time direction. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/preismann_1.tex page 18 of 20 – p. 18/20 Preissmann Scheme II u+ ′x u+ ′t k+1 uk+1 − u ukj − uki ∂u+ j i + (1 − Θ) , ≈Θ = ∂x ∆xij ∆xij ! k+1 k+1 k k uj + ui ∂u+ 1 uj + ui = ≈ − ∂t ∆t 2 2 1 k+1 k+1 k k = uj − uj + ui − ui . 2∆t For the quantity of state in the calculation point, the mean value is established: k+1 k+1 k k u + u + u u i j j i + (1 − Θ) . u+ ≈ Θ 2 2 The method is stable for Θ > 0, 5. yields best results between: Θ ≈ 0, 55 − 0, 6. and creates numeric damping for larger values. Universität Stuttgart Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/preismann_2.tex page 19 of 20 – p. 19/20 Further schemes Leap-frog un+1 −un−1 i i 2∆t + n un i+1 −ui−1 v 2∆x = 0. Lax Wendroff un+1 −un i i ∆t + n un i+1 −ui−1 v 2∆x − n n n 2 ∆t ui+1 −2ui +ui−1 v 2 ∆x2 = 0. Beam-Warming un+1 −un i i ∆t + n n 3un i −4ui−1 +ui−2 v 2∆x − n n n 2 ∆t ui −2ui−1 +ui−2 v 2 ∆x2 = 0. Crank-Nicholson un+1 −un i i ∆t Universität Stuttgart + n+1 un+1 i+1 −ui−1 θv 2∆x + (1 − n un i+1 −ui−1 θ)v 2∆x = 0. Institut für Wasserbau, Lehrstuhl für Hydromechanik und Hydrosystemmodellierung home/lehre/VL-MHS-1-E/FOLIEN/VORLESUNG/9_UPWINDING/further_schemes.tex page 20 of 20 – p. 20/20