- C.1 Errors
- C.2 Shock tubes (Riemann problem)
- C.3 Polytrope
- C.4 Linear wave
- C.5 Sedov blast wave
- C.6 Toy stars
- C.7 MHD shock tubes
- C.8 h vs $ρ$

The error norms calculated when exact solutions are plotted are as follows: The
error for each particle is given by
$$
e_i = f_i - f_exact,
(9)$$
where the exact solution $f_exact(x)$ is the solution returned from the exact
solution subroutines (with resolution adjustable in the exact solution options menu
option) interpolated to the position of the current particle $x_i$ via a simple linear
interpolation. The absolute $L_1$ error norm is simply the average of the errors across
the domain, calculated according to
$$
∥e ∥_L_1 = 1/N f_max ∑_{i=1}^{N} |e_i |,
(10)$$
where $f_max$ is the maximum value of the exact solution in the region in which the
particles lie (also only particles in the current plot are used) which is used to
normalise the error estimate. A better error norm is the $L_2$ or *Root Mean Square*
(RMS) norm given by
$$
∥e ∥_L_2 = [1/N ( 1/f_max^2 ∑_{i=1}^{N} |e_i
|^2 )]^1/2.
(11)$$
Finally the maximum error, or $L_∞$ norm is calculated according to
$$
∥e ∥_L_∞ = 1/f_max max_i |e_i |.
(12)$$
which is the most stringent error norm.

The inset plot of the individual particle errors shows the fractional deviation for each particle given by $$ e_i,frac = (f_i - f_exact) / f_exact. (13)$$

The subroutine `exact_shock`

plots the exact solution for a one-dimensional shock tube
(Riemann problem). The difficult bit of the problem is to determine the jump in
pressure and velocity across the shock front given the initial left and right
states. This is performed in a separate subroutine (riemannsolver) as there are
many different methods by which this can be done (see e.g. ???).
The actual subroutine exact_shock reconstructs the shock profile (consisting of
a rarefaction fan, contact discontinuity and shock, summarised in Figure
??), given the post-shock values of pressure and
velocity.

The speed at which the shock travels into the `right' fluid can be computed from the post shock velocity using the relation $$ v_shock = v_post(ρ_post/ρ_R)/(ρ_post/ρ_R)- 1, (14)$$ where the jump conditions imply $$ ρ_post/ρ_R = (P_post/P_R) + β/1 + β(P_post/P_R) (15)$$ with $$ β= γ- 1/γ+ 1. (16)$$

The algorithm for determining the post-shock velocity and pressure is taken from ???.

The subroutine `exact_polytrope`

computes the exact solution for a static polytrope with
arbitrary $γ$. From Poisson's equation
$$
∇^2 φ= 4πG ρ,
(17)$$
assuming only radial dependence this is given by
$$
1/r^2 d/dr (r^2 dφ/dr ) = 4πG ρ(r).
(18)$$

The momentum equation assuming an equilibrium state ($v = 0$) and a polytropic equation of state $P = Kρ^γ$ gives $$ dφ/dr = - γK/γ-1d/dr [ρ^(γ-1) ] (19)$$ Combining (??) and (??) we obtain an equation for the density profile $$ γK/4πG (γ- 1) 1/r^2 d/dr [r^2 d/dr( ρ^γ-1 ) ] + ρ(r) = 0. (20)$$ This equation can be rearranged to give $$ γK/4πG (γ- 1) d^2/dr^2 [rρ^γ-1] + rρ= 0. (21)$$ The program solves this equation numerically by defining a variable $$ E = r ρ^γ-1 (22)$$ and finite differencing the equation according to $$ E^i+1 - E^i + E^i-1/(Δr)^2 = 4πG (γ- 1)/γK r (E/r)^1/(γ-1). (23)$$

The subroutine `exact_wave`

simply plots a sine function on a given graph.
The function is of the form
$$
y = sin(k x - ωt)
(24)$$
where $k$ is the wavenumber and $ω$ is the angular frequency. These
parameters are set via the input values of wavelength $λ= 2π/k$ and
wave period $P = 2π/ω$.

$λ$ & wavelength $P$ & period

The subroutine `exact_sedov`

computes the self-similar Sedov solution for a blast wave.

The subroutine `exact_toystar1D`

computes the exact solutions for the `Toy
Stars' described in ???. The system is one dimensional with velocity $v$, density $ρ$, and pressure
$P$. The acceleration equation is
$$
dv/dt = - 1/ρ ∂P/∂x - Ω^2 x,
(25)$$
We assume the equation of state is
$$
P = K ρ^γ,
(26)$$

The exact solutions provided assume the equations are scaled such that $Ω^2 = 1$.

The static structure is given by $$ ρ= 1- x^2, (27)$$

The linear solution for the velocity is given by $$ v = 0.05 C_s G_n(x) cosωt ) (28)$$ density is $$ ρ= ρ + η (29)$$ where $$ η= 0.1 C_s ωP_n+1(x) sin(ωt)) (30)$$

In this case the velocity is given by $$ v = A(t) x, (31)$$ whilst the density solution is $$ ρ^γ-1 = H(t) - C(t) x^2. (32)$$ where the parameters A, H and C are determined by solving the ordinary differential equations $$

$Ḣ\@PAM=\@PAM-AH(γ-1), \@PAM (33)$ | ||||||

| ||||||

$Ċ\@PAM=\@PAM-AC(1+ γ), \@PAM (35)$ | ||||||

$$ |

$$ The relation $$ A^2 = -1 - 2 σC/γ-1 + kC^2/γ+1, (36)$$ is used to check the quality of the solution of the differential equations by evaluating the constant $k$ (which should remain close to its initial value).

These are some tabulated solutions for specific MHD shock tube problems at a given time taken from the tables given in ??? and ???.

The subroutine exact_hrho simply plots the relation between smoothing length and density, i.e., $$ h = h_fact (m/ρ)^1/ν (37)$$ where $ν$ is the number of spatial dimensions. The parameter $h_fact$ is output by the code into the header of each timestep. For particles of different masses, a different curve is plotted for each different mass value.

SPLASH: A visualisation tool for SPH data ©2004–2014 Daniel Price.

http://users.monash.edu.au/~dprice/splash/