I'm not entirely sure this is the right place to ask this sort of question, but still. I have a problem with plotting 3D simulation data that I get with SPH. Basically, I want to be able to plot a 'slice' of the computational domain at z = 0. To do that I generate sort of a eulerian grid and interpolate particle data (density, energy, vector components, etc.) on the grid nodes using SPH approximation.

This way I can plot 2D color maps of data (like the density distribution) with gnuplot (since it sort of requires a mesh to do that).

However the density plot seems to be only accurate for the initial conditions (in my case it's a sphere of gas made up of uniformly spaced particles with equal mass). As particle move the mesh seems to get severe spikes in density in the central region (it's a collapsing cloud). Increasing mesh resolution doesn't help. I tried moving the interpolation points with the flow to account for changes in particle density but it didn't help.

I feel like the spacing of those interpolation points must somehow change with the changing spacing/smoothing length of particles, but I don't know how. Also that would probably make "the mesh" unsuitable for the pm3d command in gnuplot.

I don't know.

  • $\begingroup$ Are you sure the sph code works? Bad data output is usually a sign it's not working. $\endgroup$ – Kyle Kanos Jun 9 '19 at 14:48
  • $\begingroup$ I'm pretty sure the code works, based on the 'raw' output data. The thing is, I can plot the rho(x,y) from the 'raw' output file (displaying all particles regardless of Z) and clearly see that the density fields don't match to the 'mapped' data. In my case the highest density is expected to be in the middle of the cloud and this plot looks just fine. It just doesn't match the interpolated data points I was talking about. $\endgroup$ – banjo Jun 9 '19 at 14:59
  • $\begingroup$ Consider to spell out acronyms. $\endgroup$ – Qmechanic Jun 9 '19 at 17:35

Okay, seems like I found the answer.

Basically, I was using non-normalized SPH interpolation and as soon as I applied normalization the density distributions finally matched (at least in the area of interest). It seems that using normalized interpolation results in bad estimations near free surfaces (mine is a cloud without any outer gas, sadly).

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.