Exact solutions¶
splash contains a library of exact or analytic solutions to common test problems that have been used extensively in benchmarking codes (e.g. [PM04], [RP07], [Price12], [Price18]).
Errors¶
The error norms calculated when exact solutions are plotted are as follows: The error for each particle is given by
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
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
Finally the maximum error, or \(L_\infty\) norm is calculated according to
which is the most stringent error norm.
The inset plot of the individual particle errors shows the fractional deviation for each particle given by
Shock tubes (Riemann problem)¶
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.
[Toro92]). The actual subroutine exact_shock
reconstructs the shock profile (consisting of a rarefaction fan, contact
discontinuity and shock, summarised in Fig. 29), 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
where the jump conditions imply
with
Polytrope¶
The subroutine exact_polytrope
computes the exact solution for a
static polytrope with arbitrary \(\gamma\). From Poisson’s equation
assuming only radial dependence this is given by
The momentum equation assuming an equilibrium state (\({\bf v} = 0\)) and a polytropic equation of state \(P = K\rho^{\gamma}\) gives
Combining (Eq. 1) and (Eq. 2) we obtain an equation for the density profile
This equation can be rearranged to give
The program solves this equation numerically by defining a variable
and finite differencing the equation according to
Linear wave¶
The subroutine exact_wave
simply plots a sine function on a given
graph. The function is of the form
where \(k\) is the wavenumber and \(\omega\) is the angular frequency. These parameters are set via the input values of wavelength \(\lambda = 2\pi/k\) and wave period \(P = 2\pi/\omega\).
\(\lambda\) |
wavelength |
\(P\) |
period |
Sedov blast wave¶
The subroutine exact_sedov
computes the self-similar Sedov solution
for a blast wave.
Toy stars¶
The subroutine exact_toystar1D
computes the exact solutions for the
‘Toy Stars’ described in [MP04]. The system is one
dimensional with velocity \(v\), density \(\rho\), and pressure
\(P\). The acceleration equation is
We assume the equation of state is
The exact solutions provided assume the equations are scaled such that \(\Omega^2 = 1\).
Linear solutions¶
The linear solution for the velocity is given by
The density is
where
Non-linear solution¶
In this case the velocity is given by
while the density solution is
where the parameters A, H and C are determined by solving the ordinary differential equations
The relation
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).
MHD shock tubes¶
These are some tabulated solutions for specific MHD shock tube problems at a given time taken from the tables given in [DW94] and [RJ95].
h vs \(\rho\)¶
The subroutine exact_hrho simply plots the relation between smoothing length and density, i.e.,
where \(\nu\) is the number of spatial dimensions. The parameter \(h_{\rm 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.