Algorithmcore
Flux vector splitting
Also called Steger-Warming splitting, van Leer flux splitting.
Splits the flux into parts with nonnegative and nonpositive eigenvalues and upwinds each part, with no Riemann solver.
- Time
- O(m M K) worst
- Space
- O(m M) extra
- Where
- K = the number of time steps (O(M) for a fixed end time and Courant number); M = the number of cells; m = the number of conserved components
- Model
- Real RAM
- Properties
- conservativedeterministicexplicitnot keeps stationary contact
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Joseph L. Steger, R. F. Warming, Bram van Leer, 1981
Flux vector splitting builds an upwind finite volume flux without solving a Riemann problem. It writes the physical flux as a sum , where carries only waves that move right and only waves that move left. At each face it takes the right-moving part from the left cell and the left-moving part from the right cell: . Steger and Warming (1981) split by the signs of the eigenvalues. Van Leer (1982) split by polynomials in the Mach number, so that the parts are smooth at the sonic points. Both give first order schemes that are cheap and robust. They smear contacts, even contacts at rest, because the splitting treats each side alone and never sees the jump.
In plain words
At a cell face, some information flows right and some flows left. Flux vector splitting asks each cell on its own: how much of your flux goes right and how much goes left? The face then takes the right-going part of the left cell and the left-going part of the right cell, and adds them. No cell needs to know about its neighbor, so there is no Riemann problem to solve. When the gas moves faster than sound, everything goes one way and the scheme is plain upwinding. The price is that a jump between two cells is never seen as one wave, so contacts get blurred.
The problem
Given cell averages of the Euler equations with , , , , and , compute face fluxes that make the conservative update consistent and stable, using only the state of each cell to form its part. The Mach number is , and .
The algorithm
STEGER-WARMING(U)- 1
λ <- (u - c, u, u + c); r_1 <- (1, u - c, H - uc); r_2 <- (1, u, u²/2); r_3 <- (1, u + c, H + uc) - 2
return F^± <- (ρ/(2γ)) (λ_1^± r_1 + 2(γ-1) λ_2^± r_2 + λ_3^± r_3) VAN-LEER(U)- 3
if M ≥ 1: return (F(U), 0); if M ≤ -1: return (0, F(U)) - 4
m^± <- ± ρc (M ± 1)²/4 - 5
return F^± <- m^± (1, ((γ-1)u ± 2c)/γ, ((γ-1)u ± 2c)²/(2(γ²-1))) FVS-FLUX(U_L, U_R)- 6
return F^+(U_L) + F^-(U_R) FV-STEP(U, Δt, Δx)- 7
add one ghost cell on each side (copy for outflow, wrap for periodic) - 8
for each face j+1/2: F_{j+1/2} <- FVS-FLUX(U_j, U_{j+1}) - 9
for each cell j: U_j <- U_j - (Δt/Δx)(F_{j+1/2} - F_{j-1/2})
Lines L1 and L2 use the fact that the Euler flux is homogeneous of degree one, so , and that . Splitting each eigenvalue into its positive and negative parts splits . Line L3 makes supersonic flow pure upwinding. Lines L4 and L5 are van Leer's quadratic parts, which join the supersonic values with a matching slope at .
Example
The flux by hand. At the face of Sod's shock tube, and , both states are at rest, so on both sides. With and :
- Steger-Warming: , so , and the face flux is .
- Van Leer: , so , and the face flux is .
The exact Godunov flux is (see the exact Riemann solver). Both splittings give the momentum flux , because each side sees only its own pressure.
Sod's tube. On with the jump at , outflow boundaries and Courant number 0.9, the scheme runs to . The table gives the error of the density against the exact cell averages (a 16-point midpoint rule in each cell), measured with the code on this page.
| cells | steps | Steger-Warming | van Leer |
|---|---|---|---|
| 50 | 24 | 0.02564 | 0.02070 |
| 100 | 48 | 0.01881 | 0.01457 |
| 200 | 97 | 0.01268 | 0.00967 |
For comparison, the Roe solver gives 0.00886 on 97 steps with 100 cells. The splittings are more diffusive, mostly at the contact.
A smooth wave. The density wave , , on a periodic grid is an exact solution. At the van Leer errors for are , , and , and the Steger-Warming errors are , , and . Both have order 1.00 at the finest pair.
A contact at rest. Take for and for , with and . The van Leer mass flux at the jump is , not zero. With 100 cells, after 47 steps (), the densities in cells 47 to 54 are , and a velocity of up to 0.036 has appeared. Roe and HLLC keep this state exactly.
Correctness
The proof is in proofs/correctness.md. Theorem: both splittings satisfy , so the face flux is consistent, and the scheme is conservative; by the Lax-Wendroff theorem, a limit of the scheme is a weak solution. The Steger-Warming parts are , where has the eigenvalues . The van Leer parts are continuous with continuous first derivatives at , because the subsonic has the factor . For a scalar law with nondecreasing and nonincreasing, the scheme is monotone and TVD when .
Proof: The Steger-Warming and van Leer splittings add up to the Euler flux, the van Leer parts are smooth at the sonic points, and the scalar splitting scheme is TVDfull
Setting. The scheme stores cell averages on a uniform grid with width and steps with (line L9). The face flux is (line L6). For the Euler equations, , , , and . The eigenvalues of the Jacobian are , , , with right eigenvectors , and . For a real number , and .
Lemma 1 (the state in eigenvector coordinates). with and .
Proof. Mass: . Momentum: . Energy: . Here , so . Adding gives .
Lemma 2 (homogeneity). for , and .
Proof. Scaling by scales , , and by and leaves unchanged. Each flux component, , and , is then scaled by . Differentiating with respect to at gives (Euler's theorem on homogeneous functions).
Theorem 1 (Steger-Warming). Let (lines L1 and L2). Then , with , the eigenvalues of are and those of are . If then and , and if then and .
Proof. By Lemma 1 and , , and by Lemma 2 this is . Since for each , . The matrix maps to , and its eigenvalues are the entries of . If , all three , so and , which gives and . The case is the mirror.
Written out, . The map has a kink at , so is continuous but its derivative jumps where or .
Theorem 2 (van Leer). For let
(lines L4 and L5), and for let the parts be as in Theorem 1 (line L3). Then for every state, and and are continuous with continuous first derivatives across and .
Proof. Write , and .
Mass: .
Momentum: . The bracket is . So the sum is .
Energy: . Expanding, and . So , and the sum is .
So for , and by Theorem 1 also for . At , the subsonic is the product of and a smooth function of , so and its first derivatives are zero there. The supersonic is identically zero, so is across . Then is there too, because is smooth. The case is the mirror, with in .
Theorem 3 (consistency and conservation). For both splittings, when , and on a periodic grid the sums are kept. So, by the Lax-Wendroff theorem, a limit that the scheme converges to boundedly in is a weak solution.
Proof. Consistency is , which is Theorems 1 and 2. Conservation: each face flux enters cell with the factor and cell with , so the sum over a periodic grid telescopes.
Theorem 4 (scalar law: TVD). Let with nondecreasing, nonincreasing, both Lipschitz, and let . If , then the scheme does not increase , and it is monotone.
Proof. With ,
where and (read as 0 when the difference is 0). Then . By Harten's lemma (Harten 1983), the total variation does not increase. Monotone: the update is nondecreasing in (since is nondecreasing), in (since is nonincreasing), and in , because has slope .
For Burgers' equation the choice , has , so the condition is . The test runs this case with on random data and checks that the total variation does not increase in 40 steps. Monotone schemes converge to the entropy solution (Crandall and Majda 1980).
Proposition 5 (a contact at rest is not kept). Let and with . The van Leer mass flux at the face is and the Steger-Warming one is . Both are nonzero, so the exact steady solution is not a steady solution of the scheme.
Proof. At , the van Leer mass parts are , and the Steger-Warming parts are . So the face mass flux is the difference of the two values times or . With equal pressures, is strictly increasing in , so .
Complexity
Theorem, in the real-RAM model: each split costs operations and one square root per cell, for conserved components, and each cell is split once per step, not once per face. One step costs and the memory is . To reach a fixed time at a fixed Courant number takes steps, so in all. There is no iteration, no Roe average and no eigenvector of a two-state matrix.
Properties
- First order. The measured order on the smooth wave is 1.00.
- Upwind for supersonic flow. If on both sides, the face flux is , as in the upwind scheme.
- Smooth parts (van Leer). The van Leer parts are in . The Jacobian of has the eigenvalue 0 for , and the test checks that the other two eigenvalues are not negative by the signs of the characteristic polynomial. Van Leer chose this so that a steady shock has at most two cells inside it.
- Kinks (Steger-Warming). The Steger-Warming parts have a kink where an eigenvalue is zero, at and . This can give small glitches at sonic points.
- Smears contacts and shear. A contact at rest is not a steady state of the scheme (Proposition 5 in the proof). This is the main weakness, and it is worse for viscous flows, where a boundary layer is a shear layer.
- One cell at a time. Each split depends on one state only, which makes the scheme easy to vectorize and easy to make implicit, since is available in closed form.
Variants and improvements
- AUSM. The AUSM scheme splits the flux into a convective part and a pressure part, and upwinds the convective part with one interface Mach number. It keeps contacts much sharper.
- Hänel's variant. Taking the energy part of van Leer's flux with the total enthalpy, , keeps constant across a steady flow. It is a common change for steady aerodynamics (Toro 2009, Chapter 8).
- High order. Use the split fluxes on reconstructed values from MUSCL, or split the flux at each point and reconstruct and separately, as in finite difference WENO codes. The local Lax-Friedrichs splitting is the usual choice there.
- Riemann solvers. The Roe, HLL and HLLC fluxes use both states together. They cost more per face but keep contacts sharper.
When to use it
Use flux vector splitting when the flux must be cheap and robust, when the scheme is implicit and needs simple flux Jacobians, or as the flux inside a finite difference WENO code. Do not use it at first order for flows where contacts, shear layers or boundary layers must stay sharp. For those, use AUSM, HLLC or Roe.
Pitfalls
- Expecting a sharp contact. Proposition 5 in the proof shows that even a contact at rest moves mass across the face. The smearing is a property of the method.
- Steger-Warming glitches. At a sonic point the Steger-Warming parts are not differentiable, and a small kink can appear in a transonic rarefaction. Van Leer's splitting avoids this.
- Splitting a non-homogeneous flux. The identity holds for the ideal gas law. For a general equation of state it can fail, and then does not add up to . Check before using a splitting.
- The time step. The Courant condition must use over all cells. A split with loses the TVD bound.
- Mixing up the sides. The face flux is . Taking gives a downwind scheme that blows up.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/flux-vector-splitting/. The authors are listed in prov/6X7CE5.jsonl.
"""Flux vector splitting for the 1D Euler equations: Steger-Warming (1981) and van Leer (1982).
The flux is written as F(U) = F+(U) + F-(U), where F+ has only nonnegative and F- only
nonpositive wave speeds. The face flux is F+(U_L) + F-(U_R): each part is taken from the
side it comes from.
"""
from math import sqrt
GAMMA = 1.4
def prim_to_cons(w, g=GAMMA):
rho, u, p = w
return (rho, rho * u, p / (g - 1.0) + 0.5 * rho * u * u)
def cons_to_prim(q, g=GAMMA):
rho, m, e = q
u = m / rho
return (rho, u, (g - 1.0) * (e - 0.5 * m * u))
def euler_flux(q, g=GAMMA):
rho, m, e = q
u = m / rho
p = (g - 1.0) * (e - 0.5 * m * u)
return (m, m * u + p, u * (e + p))
def steger_warming(q, g=GAMMA):
"""Return (F+, F-) of Steger and Warming: the eigenvalues split by sign."""
rho, u, p = cons_to_prim(q, g)
c = sqrt(g * p / rho)
h = (q[2] + p) / rho
lam = (u - c, u, u + c) # @line L1
vecs = ((1.0, u - c, h - u * c), (1.0, u, 0.5 * u * u), (1.0, u + c, h + u * c))
weights = (rho / (2.0 * g), rho * (g - 1.0) / g, rho / (2.0 * g)) # U = sum of weights[k] vecs[k]
parts = []
for sign in (1.0, -1.0):
lp = [0.5 * (x + sign * abs(x)) for x in lam]
parts.append(tuple(sum(lp[k] * weights[k] * vecs[k][i] for k in range(3)) for i in range(3))) # @line L2
return parts[0], parts[1]
def van_leer(q, g=GAMMA):
"""Return (F+, F-) of van Leer: polynomials in the Mach number, smooth at M = -1 and M = 1."""
rho, u, p = cons_to_prim(q, g)
c = sqrt(g * p / rho)
mach = u / c
if mach >= 1.0: # @line L3
return euler_flux(q, g), (0.0, 0.0, 0.0)
if mach <= -1.0:
return (0.0, 0.0, 0.0), euler_flux(q, g)
parts = []
for sign in (1.0, -1.0):
mass = sign * 0.25 * rho * c * (mach + sign) ** 2 # @line L4
a = (g - 1.0) * u + sign * 2.0 * c
parts.append((mass, mass * a / g, mass * a * a / (2.0 * (g * g - 1.0)))) # @line L5
return parts[0], parts[1]
def fvs_flux(ql, qr, split=van_leer, g=GAMMA):
"""The face flux F+(U_L) + F-(U_R)."""
fp, _ = split(ql, g)
_, fm = split(qr, g)
return tuple(a + b for a, b in zip(fp, fm)) # @line L6
def fvs_scalar(ul, ur, fplus, fminus):
"""The same idea for a scalar law f = f+ + f- with f+ nondecreasing and f- nonincreasing."""
return fplus(ul) + fminus(ur)
def step(cells, dt, dx, flux, periodic=False):
"""One forward Euler step of the conservative scheme with one ghost cell on each side."""
ext = ([cells[-1]] + list(cells) + [cells[0]]) if periodic else ([cells[0]] + list(cells) + [cells[-1]]) # @line L7
faces = [flux(ext[j], ext[j + 1]) for j in range(len(ext) - 1)] # @line L8
lam = dt / dx
if isinstance(cells[0], tuple):
return [tuple(q - lam * (b - a) for q, a, b in zip(cells[j], faces[j], faces[j + 1])) for j in range(len(cells))] # @line L9
return [cells[j] - lam * (faces[j + 1] - faces[j]) for j in range(len(cells))]
def solve_euler(cells, dx, t_end, cfl=0.9, g=GAMMA, periodic=False, split=van_leer):
"""March to t_end with dt = cfl dx / max(|u| + c). Returns (cells, number of steps)."""
t, n = 0.0, 0
flux = lambda a, b: fvs_flux(a, b, split, g)
while t < t_end - 1e-14:
smax = 0.0
for q in cells:
rho, u, p = cons_to_prim(q, g)
smax = max(smax, abs(u) + sqrt(g * p / rho))
dt = min(cfl * dx / smax, t_end - t)
cells = step(cells, dt, dx, flux, periodic)
t += dt
n += 1
return cells, n
test_flux_vector_splitting.py 206 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/flux-vector-splitting/. The authors are listed in prov/6X7CE5.jsonl.
import random
from math import cos, log2, pi, sqrt
from flux_vector_splitting import (
cons_to_prim,
euler_flux,
fvs_flux,
fvs_scalar,
prim_to_cons,
solve_euler,
step,
steger_warming,
van_leer,
)
SOD = ((1.0, 0.0, 1.0), (0.125, 0.0, 0.1))
G = 1.4
def exact_solution(left, right, g=1.4):
"""Reference: the exact Riemann solution. Returns a function of xi = x / t giving (rho, u, p)."""
(rl, ul, pl), (rr, ur, pr) = left, right
cl, cr = sqrt(g * pl / rl), sqrt(g * pr / rr)
z = (g - 1.0) / (2.0 * g)
def fk(p, rk, pk, ck):
if p > pk:
return (p - pk) * sqrt(2.0 / ((g + 1.0) * rk) / (p + (g - 1.0) / (g + 1.0) * pk))
return 2.0 * ck / (g - 1.0) * ((p / pk) ** z - 1.0)
lo, hi = 1e-12, 1e4
for _ in range(200):
mid = 0.5 * (lo + hi)
if fk(mid, rl, pl, cl) + fk(mid, rr, pr, cr) + ur - ul > 0.0:
hi = mid
else:
lo = mid
ps = 0.5 * (lo + hi)
us = 0.5 * (ul + ur) + 0.5 * (fk(ps, rr, pr, cr) - fk(ps, rl, pl, cl))
def sample(xi):
rk, uk, pk, ck, sg = (rl, ul, pl, cl, 1.0) if xi <= us else (rr, ur, pr, cr, -1.0)
xs, uss, uks = sg * xi, sg * us, sg * uk
if ps > pk:
if xs <= uks - ck * sqrt((g + 1.0) / (2.0 * g) * ps / pk + z):
return (rk, uk, pk)
r, gg = ps / pk, (g - 1.0) / (g + 1.0)
return (rk * (r + gg) / (gg * r + 1.0), us, ps)
if xs <= uks - ck:
return (rk, uk, pk)
if xs >= uss - ck * (ps / pk) ** z:
return (rk * (ps / pk) ** (1.0 / g), us, ps)
w = 2.0 / (g + 1.0) + (g - 1.0) / ((g + 1.0) * ck) * (uks - xs)
return (rk * w ** (2.0 / (g - 1.0)), sg * 2.0 / (g + 1.0) * (ck + 0.5 * (g - 1.0) * uks + xs), pk * w ** (2.0 * g / (g - 1.0)))
return sample
def sod_l1(m, split, t=0.2):
"""L1 error of the density against exact cell averages (16-point midpoint rule per cell)."""
sample = exact_solution(*SOD)
cells = [prim_to_cons(SOD[0] if (j + 0.5) / m < 0.5 else SOD[1]) for j in range(m)]
cells, _ = solve_euler(cells, 1.0 / m, t, split=split)
err = 0.0
for j, q in enumerate(cells):
ex = sum(sample(((j + (k + 0.5) / 16) / m - 0.5) / t)[0] for k in range(16)) / 16
err += abs(q[0] - ex) / m
return err
def density_wave(m, t):
"""Exact cell averages of rho = 1 + 0.2 sin(2 pi (x - t)), with u = 1 and p = 1."""
dx = 1.0 / m
return [1.0 + 0.2 * (cos(2 * pi * (j * dx - t)) - cos(2 * pi * ((j + 1) * dx - t))) / (2 * pi * dx) for j in range(m)]
def random_state(rng, umax=2.0):
return prim_to_cons((rng.uniform(0.1, 2), rng.uniform(-umax, umax), rng.uniform(0.1, 2)))
def close(a, b, tol=1e-12):
return all(abs(x - y) <= tol * (1.0 + abs(y)) for x, y in zip(a, b))
def jacobian(f, q, h=1e-6):
cols = []
for k in range(3):
a, b = list(q), list(q)
a[k] += h
b[k] -= h
cols.append([(x - y) / (2 * h) for x, y in zip(f(tuple(a)), f(tuple(b)))])
return [[cols[j][i] for j in range(3)] for i in range(3)]
def char_poly(a):
"""Trace, sum of principal 2 by 2 minors, determinant: lambda^3 - t lambda^2 + s lambda - d."""
t = a[0][0] + a[1][1] + a[2][2]
s = sum(a[i][i] * a[j][j] - a[i][j] * a[j][i] for i in range(3) for j in range(i + 1, 3))
d = a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1]) - a[0][1] * (a[1][0] * a[2][2] - a[1][2] * a[2][0]) + a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0])
return t, s, d
def test_sod_interface_by_hand() -> None:
ql, qr = prim_to_cons(SOD[0]), prim_to_cons(SOD[1])
cl, cr = sqrt(G), sqrt(G * 0.1 / 0.125)
# at u = 0: Steger-Warming gives rho c / (2 gamma) and rho c^3 / (2 gamma (gamma - 1)); van Leer rho c / 4 and rho c^3 / (2 (gamma^2 - 1))
sw = ((cl - 0.125 * cr) / (2 * G), 0.55, (cl**3 - 0.125 * cr**3) / (2 * G * (G - 1)))
vl = ((cl - 0.125 * cr) / 4, 0.55, (cl**3 - 0.125 * cr**3) / (2 * (G * G - 1)))
assert close(fvs_flux(ql, qr, steger_warming), sw) and close(fvs_flux(ql, qr, van_leer), vl)
assert abs(sw[0] - 0.375332) < 1e-6 and abs(vl[0] - 0.262732) < 1e-6 and abs(vl[2] - 0.785594) < 1e-6
def test_the_parts_add_up_to_the_flux() -> None:
rng = random.Random(7)
for _ in range(200):
q = random_state(rng, 4.0)
for split in (steger_warming, van_leer):
fp, fm = split(q)
assert close(tuple(a + b for a, b in zip(fp, fm)), euler_flux(q))
assert close(fvs_flux(q, q, split), euler_flux(q))
def test_steger_warming_is_homogeneous() -> None:
rng = random.Random(8)
for _ in range(50):
q, s = random_state(rng), rng.uniform(0.2, 5.0)
sq = tuple(s * x for x in q)
assert close(euler_flux(sq), tuple(s * x for x in euler_flux(q)))
assert close(steger_warming(sq)[0], tuple(s * x for x in steger_warming(q)[0]))
def test_supersonic_flow_is_pure_upwind() -> None:
rng = random.Random(9)
for _ in range(50):
rho, p = rng.uniform(0.1, 2), rng.uniform(0.1, 2)
u = sqrt(G * p / rho) * rng.uniform(1.0, 3.0)
q = prim_to_cons((rho, u, p))
for split in (steger_warming, van_leer):
fp, fm = split(q)
assert close(fp, euler_flux(q)) and all(abs(x) < 1e-12 for x in fm)
qm = prim_to_cons((rho, -u, p))
assert close(split(qm)[1], euler_flux(qm)) and all(abs(x) < 1e-12 for x in split(qm)[0])
def test_van_leer_parts_are_smooth_at_the_sonic_point() -> None:
for eps in (1e-2, 1e-3, 1e-4):
q = prim_to_cons((1.0, (1.0 - eps) * sqrt(G), 1.0))
assert max(abs(x) for x in van_leer(q)[1]) < 3.0 * eps * eps # F- vanishes to second order at M = 1
def test_van_leer_jacobian_has_one_zero_eigenvalue() -> None:
rng = random.Random(10)
for _ in range(30):
rho, p = rng.uniform(0.3, 2), rng.uniform(0.3, 2)
q = prim_to_cons((rho, rng.uniform(-0.95, 0.95) * sqrt(G * p / rho), p))
tp, sp, dp = char_poly(jacobian(lambda z: van_leer(z)[0], q))
tm, sm, dm = char_poly(jacobian(lambda z: van_leer(z)[1], q))
assert abs(dp) < 1e-6 and abs(dm) < 1e-6 # one eigenvalue is 0
assert tp > 0 and sp > -1e-8 and tm < 0 and sm > -1e-8 # the other two: >= 0 for F+, <= 0 for F-
def test_a_contact_at_rest_is_smeared() -> None:
a, b = prim_to_cons((1.0, 0.0, 1.0)), prim_to_cons((0.125, 0.0, 1.0))
assert abs(fvs_flux(a, b)[0] - (sqrt(G) - 0.125 * sqrt(G / 0.125)) / 4) < 1e-12 # mass crosses the face
cells, _ = solve_euler([a if j < 50 else b for j in range(100)], 0.01, 0.1)
assert max(abs(cons_to_prim(q)[1]) for q in cells) > 0.02 # a velocity appears where there should be none
assert sum(1 for q in cells if 0.2 < q[0] < 0.9) >= 5
def test_burgers_splitting_is_tvd() -> None:
fp, fm = (lambda v: max(v, 0.0) ** 2 / 2), (lambda v: min(v, 0.0) ** 2 / 2)
rng = random.Random(11)
u = [rng.uniform(-1, 1) for _ in range(80)]
tv = lambda w: sum(abs(w[j + 1] - w[j]) for j in range(len(w) - 1))
for _ in range(40):
before = tv(u)
dx = 1.0 / 80
u = step(u, 0.9 * dx / max(abs(v) for v in u), dx, lambda a, b: fvs_scalar(a, b, fp, fm)) # lam (f+' - f-') <= 0.9
assert tv(u) <= before + 1e-12
def test_sod_converges() -> None:
e100, e200 = sod_l1(100, van_leer), sod_l1(200, van_leer)
s200 = sod_l1(200, steger_warming)
assert e100 < 0.016 and e200 < 0.011 and s200 < 0.014 and e200 < s200
def test_first_order_on_a_smooth_wave() -> None:
errs = []
for m in (25, 50, 100):
cells = [prim_to_cons((r, 1.0, 1.0)) for r in density_wave(m, 0.0)]
out, _ = solve_euler(cells, 1.0 / m, 0.1, periodic=True)
errs.append(sum(abs(q[0] - e) for q, e in zip(out, density_wave(m, 0.1))) / m)
orders = [log2(errs[i] / errs[i + 1]) for i in range(2)]
assert all(0.9 < o < 1.1 for o in orders)
def test_conservation_on_a_periodic_grid() -> None:
rng = random.Random(12)
cells = [random_state(rng, 0.5) for _ in range(40)]
out, _ = solve_euler(cells, 1.0 / 40, 0.05, periodic=True, split=steger_warming)
for i in range(3):
assert abs(sum(q[i] for q in out) - sum(q[i] for q in cells)) < 1e-11
History
Sanders and Prendergast had used a kinetic splitting for astrophysical flows in 1974. Steger and Warming (1981) gave the splitting of the Euler flux by the signs of the eigenvalues, based on the homogeneity of the flux, and used it in implicit finite difference schemes. Van Leer (1982) pointed out the kinks of that splitting at sonic points and gave a splitting by polynomials in the Mach number that is continuously differentiable. Liou and Steffen (1993) later split the convective and pressure parts apart, which led to the AUSM family.
References
- Joseph L. Steger and R. F. Warming, Flux vector splitting of the inviscid gasdynamic equations with application to finite-difference methods, Journal of Computational Physics 40(2) (1981) 263-293, the splitting by the signs of the eigenvalues and the homogeneity property F = A U; doi:10.1016/0021-9991(81)90210-2
- Bram van Leer, Flux-vector splitting for the Euler equations, in Eighth International Conference on Numerical Methods in Fluid Dynamics, Lecture Notes in Physics 170, Springer, 1982, 507-512, the splitting by polynomials in the Mach number, smooth at the sonic points; doi:10.1007/3-540-11948-5_66
- Eleuterio F. Toro, Riemann Solvers and Numerical Methods for Fluid Dynamics, third edition, Springer, 2009, Chapter 8 (the flux vector splitting approach, with the Steger-Warming and van Leer splittings)
- Ami Harten, High resolution schemes for hyperbolic conservation laws, Journal of Computational Physics 49 (1983) 357-393, the incremental form and the lemma on TVD coefficients; doi:10.1016/0021-9991(83)90136-5
- Michael G. Crandall and Andrew Majda, Monotone difference approximations for scalar conservation laws, Mathematics of Computation 34 (1980) 1-21, convergence of monotone schemes to the entropy solution
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 6X7CE5 Edit this page History Report an error Markdown