# Riemann Particle Interaction Scheme

The Riemann problem can be defined as a category of initial value problems that involve a conservation equation and a piecewise data set with a single discontinuity.

In terms of SPH, you can solve a Riemann problem for each pair of particles, yielding a more isotropic particle distribution and smoother gradients in the solution. The following depiction is based on the work of C. Zhang. Given the Riemann problem definition, you start off by constructing a unit vector ${e}_{ij}$ between two particles $i$ and $j$ . The two particles can then be assumed to be the left and right sides of the Riemann problem, such that the physical values of density ( $\rho$ ), velocity ( $U$ ) and pressure ( $p$ ) are expressed as:(1)
$\begin{array}{l}\left({\rho }_{L},{U}_{L},{p}_{L}\right)=\left({\rho }_{i},{v}_{i}\cdot {e}_{ij},{p}_{i}\right)\\ \left({\rho }_{R},{U}_{R},{p}_{R}\right)=\left({\rho }_{j},{v}_{j}\cdot {e}_{ij},{p}_{j}\right)\end{array}$
Where, $v$ is the velocity vector of the respective particle, which is illustrated in Figure 1. C. Zhang
The discontinuity is assumed to be located at the interface (Figure 1), half way between the particles. Assuming that particles are moving with arbitrary velocity vectors, the consequent solution of their motion is either a rarefaction or compression wave. However, there is a third wave solution at the interface denoted with * exponent, where ${U}_{L}^{\ast }={U}_{R}^{\ast }={U}_{}^{\ast }$ and ${p}_{L}^{\ast }={p}_{R}^{\ast }=p$ , as indicated by the dashed link in Figure 2.
From these basic assumptions, you can derive the ${U}^{*}$ and ${p}^{*}$ values as:(2)
${U}^{*}={U}_{avg}+\frac{1}{2}\frac{\left({p}_{L}-{p}_{R}\right)}{{p}_{avg}{C}_{0}}$
(3)
${p}^{*}={p}_{avg}+\frac{1}{2}{p}_{avg}{C}_{0}\left({U}_{L}-{U}_{R}\right)$

Where, the $avg$ index denotes the mean value of the respective value between the two particles.

With these two solutions to the Riemann problem, you can modify the continuity equation and the pressure gradient term in the momentum equation as follows:(4)
$\begin{array}{l}\frac{d{p}_{i}}{dt}=2{p}_{i}\sum _{j}\frac{{m}_{j}}{{p}_{j}}\left({v}_{i}-{v}^{*}\right)\cdot {\nabla }_{i}{W}_{ij}\\ \frac{d{v}_{i}}{dt}=2\sum _{j}{m}_{j}\left(\frac{{p}^{*}}{{p}_{i}{p}_{j}}\right){\nabla }_{i}{W}_{ij}\end{array}$

Where, ${v}^{*}={U}^{*}{e}_{ij}+\left({v}_{avg-ij}-{U}_{avg}{e}_{ij}\right)$ .

It is well-known that 1st order Riemann solvers such as the one illustrated here are dissipative. To that extent, nanoFluidX is using a limiter so that the Riemann solutions are provided only when the fluid is under compression. This effectively reduces the dissipation and has been shown to improve the results in various situations. C. Zhang
Note: Although the Riemann solver option is experimental, canonical test cases, simple geometries, and problems involving single phase runs such as tank sloshing or water management should still greatly benefit from the new formulation. However, industrial gearboxes and violent multiphase flows in complex moving geometries in general are likely to experience local instabilities. This will be addressed in the coming versions of nanoFluidX.
Density filtering is an integral part of the Riemann solver implementation. In SPH simulation, the consistency between mass, density, and occupied area cannot be strictly enforced. Several density filtering schemes have been developed to tackle this. In nanoFluidX, two versions are implemented: INCREMENTAL and INSTANT filtering.
INSTANT
The instant density filtering is basically a 0th-order Shepard filter. At each evaluation point (according to the number set by RM_freq_rho_init), the density is re-calculated by:(5)
${p}_{i}=\frac{{\sum }_{j}{m}_{j}{W}_{ij}}{{\sum }_{j}{V}_{j}{W}_{ij}}$
Where, ${p}_{i}$ is the density of particle I. ${m}_{j}$ and ${V}_{j}$ is the mass and volume of particle j respectively. ${W}_{ij}$ is the weight calculated from the kernel function.
INCREMENTAL
A modified 1st-order density filtering scheme is used as an additional option. The operator is calculated following:(6)
${p}_{i}=\frac{{\sum }_{j}{m}_{j}{W}_{ij}}{\mathrm{min}\left(1,{\sum }_{j}\frac{{m}_{j}}{{p}^{*}}{W}_{ij}\right)}$
Where, ${p}_{i}$ is the density from solving the continuity equation before applying the filter.