Skip to main content

Module two_dimensions

Module two_dimensions 

Source
Expand description

§Two dimensions

Cartesian, two space dimensions. The kernels are the one-dimensional ones, applied along each axis (see Numerical methods), so the one-dimensional validation carries over, and this page adds what only appears with a second axis: transverse invariances, symmetry, splitting error and flows with no exact solution. Problem files are in problems/2d/; test paths are relative to crates/merlin-finite-volume/tests/ unless they start with crates/. All runs use one thread.

CaseReferenceHeadline result
1D embedded in 2Dthe 1D results1D embedded in 2D equals the 1D run bit for bit
Diagonal advectionexact translationorder 1 (upwind) and 2 (MUSCL, Strang Lax-Wendroff)
Isentropic vortexexact smooth solutionorder 2.11
Planar shockRankine-Hugoniotposition within 0.05 cell
Lax-Liu configuration 3symmetry, conservationasymmetry 0
Lax-Liu configuration 6published patternHLLC keeps slip lines sharper
Shock-bubbleinvariantssymmetric to 4e-14, mass balance exact

§One dimension embedded in two

The 2D code must reduce to the 1D code. Four tests compare them exactly:

  • the 2D flux with no transverse flow is bit-identical to the 1D flux (equations/euler_multid.rs: the_two_dimensional_flux_reduces_to_the_one_dimensional_one_without_transverse_flow);
  • Sod’s tube embedded in 2D along either axis is the 1D tube (sods_tube_along_either_axis_is_the_one_dimensional_tube);
  • reversing the transverse velocity reverses only the transverse flux, and a transverse boost adds only the kinetic energy it must (reversing_the_transverse_velocity_reverses_only_the_transverse_flux, a_transverse_boost_adds_only_the_kinetic_energy_it_must);
  • a problem that varies along one axis only is the one-dimensional problem (solver/multidim.rs: a_problem_that_varies_along_one_axis_is_the_one_dimensional_problem).

§Diagonal advection

A wave advected along the diagonal of a periodic square (problems/2d/advection/diagonal.toml), 2D upwind and MUSCL, and Lax-Wendroff with Strang splitting (advection/lax_wendroff.toml).

  • Upwind converges at order 1, MUSCL at order 2, and Lax-Wendroff with Strang splitting at order 2.
  • Lax-Wendroff is refused without splitting, because the scheme contains the time step of one direction; a problem file asking for it is rejected with a message naming numerics.method.
  • Every method conserves the total to round-off, the unsplit method treats the two axes alike, and the results do not depend on the block layout. A 3D version follows the diagonal and conserves.
Tests that enforce this

Enforced by solver/multidim.rs: diagonal_advection_converges_at_first_order_with_upwind, diagonal_advection_converges_at_second_order_with_muscl, lax_wendroff_is_second_order_in_two_dimensions_with_strang_splitting, lax_wendroff_is_refused_without_splitting_in_two_dimensions, every_method_conserves_the_total_to_round_off, the_unsplit_method_treats_the_two_axes_alike, the_time_step_follows_the_method, three_dimensional_advection_follows_the_diagonal_and_conserves.

§Isentropic vortex

A vortex of strength $\beta=5$ on the periodic square $[-5,5]^2$ carried by the uniform flow $(1,1)$ returns to its starting position after $t=10$ (euler/vortex.toml, 100 by 100 cells, 4 blocks). Density, velocity and pressure are all advected unchanged: an exact smooth solution of the Euler equations (Shu 1998; Hu and Shu 1999), so it measures the order of accuracy in two dimensions. The reference and the initial data use values at cell centres.

The vortex at t = 0 After one full period, t = 10: the difference from the first frame is the numerical diffusion

  • Mean absolute density error per cell at $t=1$: 1.90e-3 (32 cells) and 4.39e-4 (64 cells), observed order 2.11.
  • Over the full period, mass, both momenta and energy drift by 9e-14.
Tests that enforce this

Enforced by equations/euler2d.rs: the_isentropic_vortex_converges_at_second_order, the_vortex_is_carried_without_changing_the_conserved_totals; crates/merlin-cli/tests/run/multidim_problems.rs: the_shipped_vortex_conserves_everything_and_stays_smooth.

§Planar shock

A Mach 1.22 shock in a long thin channel (200 by 8 cells), driven by a fixed post-shock inflow, both split and unsplit. The post-shock state follows from Rankine-Hugoniot, and the shock speed from the mass balance.

  • The shock sits within 0.05 of a cell of the Rankine-Hugoniot position.
  • The plateau behind it is the post-shock state to 1e-3, and no transverse velocity appears.
Tests that enforce this

Enforced by equations/euler2d.rs: a_planar_shock_travels_at_the_rankine_hugoniot_speed.

§Lax-Liu configurations 3 and 6

Two of the 19 genuinely different two-dimensional Riemann problems of Lax and Liu (1998), four constant states one per quadrant of the unit square (euler/riemann_config3.toml, euler/riemann_config6.toml; 200 by 200 cells, $t=0.5$). They have no exact solution, so only what can be derived is asserted, and the pictures are for comparison with the published figures.

2 ρ = 0.5323 (u, v) = (1.206, 0) p = 0.3 1 ρ = 1.5 (u, v) = (0, 0) p = 1.5 3 ρ = 0.138 (u, v) = (1.206, 1.206) p = 0.029 4 ρ = 0.5323 (u, v) = (0, 1.206) p = 0.3 Configuration 3: four shocks every interface launches a shock; crossing at (0.8, 0.8) 2 ρ = 2 (u, v) = (0.75, 0.5) p = 1 1 ρ = 1 (u, v) = (0.75, -0.5) p = 1 3 ρ = 1 (u, v) = (-0.75, 0.5) p = 1 4 ρ = 3 (u, v) = (-0.75, -0.5) p = 1 Configuration 6: four slip lines every interface is a contact (p = 1); crossing at (0.5, 0.5)

The initial states of the two configurations, one per quadrant (drawn with equal quadrants; the crossing is at $(0.8,0.8)$ for configuration 3 and $(0.5,0.5)$ for configuration 6). Each of the four interfaces launches a 1D wave fan like the one-dimensional one: a shock in configuration 3, a contact in configuration 6.

Configuration 3 (four shocks meeting at $(0.8,0.8)$, as set up by Kurganov and Tadmor 2002):

Density at t = 0.5 Schlieren image of the density

  • Exact symmetry about the diagonal (asymmetry 0, at 64 by 64 and 200 by 200, unsplit).
  • The lower-left corner keeps its initial state (density 0.138).
  • Split and unsplit agree to 1e-7 in mean density, and pointwise within 2.4 % of the peak density at 200 by 200.
  • The solution converges as the grid is refined.

Configuration 6 (four slip lines):

Schlieren image of the density, t = 0.5

The slip lines roll up into the expected spiral, and HLLC keeps them sharper than HLL (steepest density jump 17 % larger).

Tests that enforce this

Enforced by equations/euler2d.rs: configuration_3_stays_symmetric_about_the_diagonal_and_physical, configuration_3_converges_as_the_grid_is_refined, split_and_unsplit_solutions_agree_on_configuration_3, configuration_6_slip_lines_are_kept_sharper_by_hllc_than_by_hll, the_unsplit_method_is_exactly_symmetric_under_swapping_the_axes; crates/merlin-cli/tests/run/multidim_problems.rs: the_shipped_riemann_problem_is_symmetric_about_the_diagonal.

§Shock-bubble interaction

A Mach 1.22 shock hits a disc of density 0.138 in pressure equilibrium (euler/shock_bubble.toml, 400 by 100 cells on $[0,2]\times[0,0.5]$, $t=2$; Haas and Sturtevant 1987; Quirk and Karni 1996). The bubble here is the same gas at a lower density, a stand-in for their helium bubble, which needs two materials. The problem is symmetric about $y=0.25$.

bubble undisturbed gas shock, Mach 1.22 shocked symmetry line y = 0.25 outflow outflow walls at y = 0 and 0.5 behind the shock ρ = 1.376, u = 0.395, p = 1.570; bubble ρ = 0.138; elsewhere ρ = 1, p = 1

The set-up. The shocked region fills $0\le x\le0.25$; the bubble has the same pressure as the gas around it.

Density at t = 2 Schlieren image: the bubble is squeezed into a crescent, with the transmitted and reflected waves

  • The mass gained equals the inflow through the fixed end; density and pressure stay positive.
  • Symmetric about the mid-line to 4e-14.
  • The bubble edge converges under refinement.
Tests that enforce this

Enforced by equations/euler2d.rs: the_bubble_problem_balances_mass_stays_symmetric_and_physical, the_bubble_position_converges_under_refinement; crates/merlin-cli/tests/run/multidim_problems.rs: the_shipped_shock_bubble_stays_symmetric_about_its_axis.

§What holds in every 2D problem

  • Block layout and threads: any layout and any thread count gives the same bits (equations/euler2d.rs: results_do_not_depend_on_the_block_layout; solver/threads.rs: a_two_dimensional_gas_is_identical_on_any_number_of_threads_for_every_boundary).
  • Conservation: closed boxes conserve mass and energy to round-off (closed_boxes_conserve_mass_and_energy_in_two_dimensions).
  • Restart: a restarted 2D run ends where the uninterrupted run does, bit for bit, split and unsplit (crates/merlin-driver/tests/drive/restart.rs: two_dimensional_euler_restarts_exactly_with_strang_splitting, two_dimensional_euler_restarts_exactly_unsplit).

§References

  • Lax, P. D. and Liu, X.-D. (1998), Solution of two-dimensional Riemann problems of gas dynamics by positive schemes, SIAM J. Sci. Comput. 19.
  • Kurganov, A. and Tadmor, E. (2002), Solution of two-dimensional Riemann problems for gas dynamics without Riemann problem solvers, Numer. Methods Partial Differential Equations 18.
  • Shu, C.-W. (1998), lecture notes in Advanced Numerical Approximation of Nonlinear Hyperbolic Equations, Springer LNM 1697; Hu, C. and Shu, C.-W. (1999), Weighted essentially non-oscillatory schemes on triangular meshes, J. Comput. Phys. 150.
  • Haas, J.-F. and Sturtevant, B. (1987), Interaction of weak shock waves with cylindrical and spherical gas inhomogeneities, J. Fluid Mech. 181; Quirk, J. J. and Karni, S. (1996), On the dynamics of a shock-bubble interaction, J. Fluid Mech. 318.