# help with source code variable names

Hello,

I am trying to calculate the distance between particles (for all the particles) and the nearest boundary. Which part of the code calculates that or which variable(s) I should focus on?

Regards.

• Just a suggestion - would this be feasible for you to do in post processing? Paraview should be able to as far as I know, without knowing how to do it though.

Kind regards

• @Asalih3d Thanks! I'm trying to modify the source code for my application and I want to run it with modified variables. Still though I did not know that you could do it in Paraview, I will try to figure that out and maybe come up with a different solution.

• No problem! I hope you are able to figure a solution out - personally if I should make a bit of a commercial for my self :-) - I would suggest you to maybe look into this:

https://github.com/AhmedSalih3d/PostSPH.jl

If you are familiar with Julia this should be quite easy for you to install and start using on some of your vtk files - here you would be able to extract arrays containing the position of all particles in your vtk file and then you can probably figure out the rest.

Kind regards

• In FunctionsGeo3d.h PointsPlane returns the distance between a plane and a point. And in JSphBoundCorr.cpp distance between a plane(pla), I assume is the boundary, and each particle's position is calculated using PlaneDistSign(pla,pos[p])

.

Should I follow a similar approach? Obtain the plane defined by the boundary(mkbound), and calculate the distance between that and each particle? If yes, How could I do it if there are multiple boundaries? Does it mean I would need to repeat it for each boundary?

Thanks!

• Hello,

I've been trying to understand pressure and viscosity calculations both in DSPH_CPU and GPU.

For pressure CPU is fairly easy to follow, in JSphCpu.cpp pressure(pressc) is calculated using EOS and and pressures of i-th and j-th particles are assigned as follows pressp1=press[p1], pressp2=press[p2].

But as far as I understand, EOS is used only in PreInteractionVars_Forces. And the obtained pressure field is used to calculate pressure gradients in momentum equation and is updated in the next step.

In JSphGpuker.cu, on the other hand, press is calculated using EOS in void PreInteractionVarsForces and also pressp1 and pressp2 are explicitly defined later on in KerGetParticleData and in KerInteractionForcesFluidBox.