# Theory - Continuity Equation Derivation

Hello!

As some of you might know, there is a lot of possibilities to discretize equations in SPH. The way I have tried to do it is by starting with the lagrangian equation for continuity:

Then I have discretized using SPH methodology as such

And to my understanding this is mathematically correct. Comparing with the formulation in DualSPHysics wiki

So this is extremely similar to what I got, but the difference is that I have "rho*i" and "V*j", so I cannot construct "m*j" (m*b in picture). The rest is the same though. Could anyone kindly show me how the one used in DualSPHysics was derived?

Kind regards

## Comments

Dear Asalih3d,

Well there are plenty of "old" papers where you can find how the continuity equation implemented in DSPH is derived, see for example this one:

Smoothed Particle Hydrodynamics and Its Diverse Applications, J.J. Monaghan, Annual Review of Fluid Mechanics 2012 44:1, 323-346

The idea is to use a formulation which is variationally consistent and thus ensures conservation of relevant physical quantities.

Best Regards

Renato

Thank you very much! It makes a lot of sense now, it was simply a product rule rewrite. And yes, this formulation which is also used by DualSPHysics seems much more "SPH-like in nature", since there is no rho

i *V_j consistency problem.Other than that it seems like according to this paper it is possible to relate the artificial viscosity to physical kinematic viscosity:

When using a Wendland kernel. I suppose this would make the Wendland kernel superior to the cubic spline, in the sense that you can relate it to physical reality. Do note though that this expression of viscosity, does not use "eta^2 = 0.01h^2", which is a small factor to avoid dividing by zero, on accident (because of particle overlap).

Kind regards, and thanks for showcasing that paper