Single/double precision

I would like to check my understanding that for GPUSPH 5.0 and onward all calculations are/will be carried out in single precision, and that there is no option to activate double precision. Would any developer please confirm what the positions and directions w.r.t. single/double precision are?

Knowing this piece of information is useful for interpreting the verification and validation results of GPUSPH fairly.

Hello @sph_tudelft_nl, yes, everything in GPUSPH has always been made in single precision, and we do not have an option to use double-precision instead (mostly because of the performance impact).

For particle position, we use a cell-local position + the cell-index, that allows us to compute most relative distances with high (and uniform) accuracy throughout the domain (and in particular independently from the position of the origin of the global reference system). The global particle position (which are only used on host, and only for initialization and storage) are in double precision.

For the density, GPUSPH 5 integrates the relative density variation change proposed in Hérault’s SPHERIC 2014 paper, improving accuracy in tracking density variations despite being limited to single precision.

Thanks @giuseppe.bilotta. I reckon you refer to Achieving the best accuracy in an SPH implementation of Hérault, Bilotta and Dalrymple presented at the 9th SPHERIC International Workshop in Paris 2014.

Unfortunately the proceedings at https://app.spheric-sph.org/sites/spheric/files/9thSPHERIC_2014_Paper_Abstracts.pdf only contain the first pages, and I could not find a full copy of it searching the web. Would it be an idea to add this contribution to the SPHERIC shared library in Zotero (https://spheric-sph.org/bibtex-reference and https://www.zotero.org/groups/2300375/spheric?)?

Hi @sph_tudelft_nl. I would like just to add a little on what @giuseppe.bilotta said. I was working on this subject last year with GPUSPH and all the work has been integrated in GPUSPH v5. I hope that you are using this version.

The fact of using single precision programming can affect significantly the results ONLY IF ABSOLUTE POSITIONS AND DENSITIES are used. In this case, the coordinates are determined wrt the origin of your system reference frame. For large geometries, estimating the particle-distance introduces a lot of errors mainly when your particles are far (simply because you are manipulating large values in simple precision :stuck_out_tongue: ). Similarly for density variations, when using large density fluids (say lava for example), the term D rho/Dt is poorly calculated…

All these issues are cancelled by using relative positions (wrt to particles search grid) and relative density (wrt to a reference one). We have submitted a paper that details all these points (with validations surely) but the reviewer rejected it for historical reasons (i dont like to speak about that)… We will submit the paper again soon and I will keep you informed when it is published online…

Finally, surely you can have someone saying (like a lot of SPH programmers) " Ok, pass to double precision and that’s all, why you need to do all this". I would probably reply that solving the numerical issues with single precision is rather better than hiding the problem with a double precision programming. A well performed code reproducing a good accuracy is exactly what we ask for !

Thanks and enjoy GPUSPH ! Cheers !
Elie