Gresho Test

December 19, 2016

The Gresho vortex test is a notoriously difficult problem for grid-based (and SPH) codes. A rotating vortex is initialized such that the centrifugal force is balanced by the pressure gradient. The solution is time-independent. For these tests, I used the initial conditions described in Liska & Wendroff (2003).


The velocity in the gresho problem is specified in polar coordinates, which I convert to Cartesian to initialize the voretx. Given

$$x = r \mathrm{cos}(\phi) \quad \mathrm{and} \quad y = r \mathrm{sin}(\phi),$$

I get

$$v_{x} = v_{r}\mathrm{cos}\phi - v_{\phi} \mathrm{sin}(\phi) \quad \mathrm{and} \quad v_{y} = v_{r}\mathrm{sin}(\phi) + v_{\phi}\mathrm{cos}(\phi)$$

(where ). Since for the Gresho problem, that gives

$$v_{x} = -v_{\phi}\mathrm{sin}(\phi) \quad \mathrm{and} \quad v_{y} = v_{\phi}\mathrm{cos}(\phi).$$

is calculated from and using and using .

In plotting the data, the conversion goes the other direction, from to . After a similar derivative analysis, I get

$$v_{\phi} = \sqrt{x^2 + y^2} \frac{x v_y - y v_x}{x^2 + y^2}.$$

How about the vorticity? Vorticity is the curl of the velocity field, so in 2D it’s

$$\omega = \nabla \times v = \left(\frac{\delta(v_y)}{\delta x} - \frac{\delta(v_x)}{\delta y}\right)\hat{z},$$

or in polar coordinates

$$\omega = \nabla \times v = \frac{1}{r}\left(\frac{\delta(r v_\phi)}{\delta r} - \frac{\delta(v_r)}{\delta\phi}\right)\hat{z}.$$


I’m running the test until t = 3.0 on a 40x40 grid with transmissive boundaries, PPMC, the exact solver, and CTU. The domain is x = [0, 1], y = [0, 1], with the vortex centered at (x, y) = (0.5, 0.5). The movies below show the evolution in azimuthal velocity (), pressure, and vorticity (). For and , both 1D and 2D projections are shown.

L1 error

The L1 error is a useful measurement of how well the code is doing, as well as the convergence rate for this test. I calculate the L1 error for vorticity and density using the standard definition

$$\delta\mathbf{q} = \frac{1}{N}\sum|\mathbf{q}_i - \mathbf{q}_i^0|,$$

where is the initial solution, and is the total number of points. The L1 errors for density and vorticity are 0.14% and 135% on a grid, and 0.04% and 80% on a grid.