Test cases and validation
This section provides information about the test cases located in the exm
folder. The necessary files to run each of the cases are provided so that users may use them as a starting point for similar cases or to test additional developments. Plotting tools are provided for some of the cases.
One-dimensional cases
1) Periodic entropy wave advection
This case solves the one-dimensional gas dynamics equations on a periodic domain:
The files for this case are located in the exm/1d_entropywave
folder. The initial non-dimensional density, pressure and velocity are set to \((\rho/\rho_0, p/p_0, u/c_0) = (1,1,0.5)\). A sinusoidal perturbation of the density field is imposed. The amplitude of the perturbation \(\epsilon\) is kept small in this example i.e. \(\epsilon=10^{-3}\) to minimise non-linear effects. The case is run for 10 times the characteristic flow time. This test case complements the quick-start guide in the sense that this case is periodic. No specification of a boundary condition in a given direction in the genRhs.py
defaults to the domain being periodic in that direction. Periodicity is enforced via the swap
operations. The resulting x-t diagram for the density field is shown in Fig. 4 for the 10 characteristic flow times.
2) Korteweg-De Vries example
To illustrate higher-than-second-order derivatives, the one-dimensional Korteweg-De Vries equation is implemented in dNami and integrated in time. The general form of the equation is:
For this test case, the scaling coefficients are set to \(\epsilon=6\) and \(\mu=1\). To compute the third derivative of \(u\) in dNami, first the second derivative is computed and stored and then a first derivative of this intermediate variable is taken when specifying the right-hand side as illustrated in the following code block:
varstored = { 'u_xx' : {'symb':' [u]_2xx ','ind':1, 'static': False } }
...
RHS = {'u' : ' epsilon * u * [ u ]_1x + mu * [ u_xx ]_1x ',}
The case of two colliding solitons is simulated here for which there is an analytical solution on an infinite domain [TA84]. The exact solution is given by:
where the function \(f\) is defined by:
with:
Following [TA84], the coefficients in the previous equations are taken to be:
The domain is restricted to the segment \(x \in [-20,20]\), taken to be periodic and discretised with \(n_x=500\) points. At the start of the simulation, the \(u\) field is initialised using the analytical solution for \(t=0\). Fig. 5 shows the solution after 6 time units.
Two-dimensional cases
1) Periodic vortex advection on a wavy mesh
This case solves the two-dimensional gasdynamics equations in curvilinear coordinates on a doubly-periodic domain using a wavy mesh for a strong conservative formulation. This case appears widely in the literature (see e.g. [VG02]). The files for this case can be found in exm/2d_wavy_mesh
. The governing equations in curvilinear formulation are:
where \(J\) is the Jacobian of the transformation between computational and physical space:
where \(U\) and \(V\) are the contra-variant velocities (i.e. the projection of the velocities onto the curvilinear coordinates):
The computational space \((x,y)\) is related to physical space \((\xi, \eta)\) with the mapping:
where the distances are specified relative to the vortex radius \(r_v\):
The metrics are computed with the same finite difference stencil and order as the derivatives in the governing equations. A vortex is initialised at the center of the domain at \((\xi_c, \eta_c)=(0,0)\). The initial flow field is then specified as:
The pressure and density are initialised based on isentropic ideal gas relations:
The baseflow and vortex speed are specified via the Mach numbers \(M_i=0.5\) and \(M_v=0.5\) respectively. The mesh and initial density condition are shown in Fig. 6. The case is run at a fixed grid size and timestep for various finite-difference schemes and orders. The same 11-point, 10th order filter is used for every case. The results for standard finite difference schemes from 2nd to 10th order are shown in Fig. 7.
2) Non-reflective vortex advection throught the boundaries
This case solves the two-dimensional advection of a vortex through the boundaries of the domain using a non-reflective characteristic-based boundary condition implementation. It is commonly used to validate non-reflective boundary condition implementations (see e.g. [LDV08]). The files for this test case can be found in the exm/2d_vortex_exit
folder. The two-dimensional Euler equations in cartesian coordinates are:
supplemented with the ideal gas law:
The edge and corner boundaries are updated using a locally one-dimensional non-reflective boundary condition. For example, the upper boundaries are computed using the following expressions
where:
The initial flow field is set using:
where the derivatives of the potential \(\psi\) and the pressure fluctuation \(p'\) are set by:
The vortex is initially centered in the domain i.e. \((x_0,y_0)=(0.5L_x, 0.5L_y)\). The vortex strength \(\Gamma\) is set using \(\Gamma = U_{v}R \sqrt{e}\) where \(U_{v} = 0.25\). Fig. 8 shows the density fluctuations as the vortex is advected out of the domain via the upper boundary. The governing equations are discretised using a 9 point, 8th order centered finite difference scheme and the conservative variables are filtered using a standard 11 point, 10th order filter. The aim of this test case is to show the ability of the boundary conditions to evacuate the vortex while generating the least amount of spurious noise. With the quasi-one dimensional approach shown here, the density fluctuation do not exceed 3.5%.
Three-dimensional cases
1) Compressible Taylor-Green vortex case
This case solves the compressible Navier-Stokes equations in 3D which are:
where \(\textbf{d}\) is a vector of diffusive terms.
The particular problem solved here is the Taylor-Green vortex flow. The files for this case can be found in exm/3d_tgv
. The initial conditions for this flow are:
The incompressible pressure solution is projected onto an isochore in thermodynamic space to set the initial internal energy. The case is setup to run with a reference Mach number of \(Ma = 0.45\) and a Reynolds number of \(Re = 1600\). Fig. 9 shows an animation of a cut of the x-direction velocity field at \(z=z_{max}/2\) as the flow starts its transition from the smooth initial condition. The grid size is set to \((n_x, n_y, n_z) = (128,128,128)\).
The more common low-Mach validation case with \(Ma=0.1\) is run. The complexity of the case arises as the flow transitions to turbulence. A lack of spatial resolution quickly leads to a degradation of the solution due to dissipation and dispersion. A more detailed discussion can be found here [DeB13]. A commonly used measure involves tracking the enstrophy (i.e. the domain integral of the squared vorticity) over time. This is strongly affected by numerical methods (e.g. the amount of filtering or the numerical dissipation introduced by the discretisation). With dNami pseudo-code, different formulations of the governing equations can easily be implemented. The equations.py
file for the 3D TGV case contains two versions of the equations. Fig. 10 shows a comparison between conservative and skew-symmetric formulations for various grid sizes and a comparison to a spectral method based reference [WFA+13] of the enstrophy over reduced time. All three finite-difference based computations presented in the graph use an 11 point, 10th order scheme.