T3: Density estimates:
particle distributions and kernels

Before the tutorials:

As discussed in the Lecture, kernel density estimates are the key pillar of smoothed particle hydrodynamics (for an general overview on density estimations, see this survey of existing methods). Kernel density estimators are used to smooth a discretized distribution of tracer particles to obtain continuous fields needed in hydrodynamics. Therefore it is important to understand the intrinsic properties of such kernel density estimators.
Start with this picture: taken from this paper (figure 1) and think about:

The global properties of kernels have a significant impact on the performance of SPH. Make yourself familiar with some common choices of kernels (especially the spline and Wendland ones), as summarized in table 1 and figure 1 of this article.

During the tutorials:

You can start from the configuration of the code as obtained in T0b and collect some different particle distributions.

You can now run the program using different kernels and different neighbor numbers. Keep in mind that you do not need to run the simulation for a very long time, basically you just need one output file. So set the TimeMax as well as the TimeBetSnapshot parameter in the box.param file to 0.5. Every setup/combination of kernel, number of neighbors, and initial particle distribution is an independent simulation you need to perform. To do so, you can:

Now you can compare the resulting densities for the different simulations you produced. You can read the density ("RHO ") for all particles within the different simulations and compute the mean and the standard deviation, compared to the true density used to create the initial conditions. You can do this step by step:

Programming goals for T3:

Goal of this tutorial is that you learn better how to change the setup of the simulation and parameters.
What do you have to change to get only one output for each simulations?
Can you create a script to run the test with varying parameters?
How to produce a plot with multiple lines from different simulations?
How to produce one graph from the result of different simulations?

Solutions