Velocity Verlet Integration for SPH Fluids I am trying to implement a SPH (Smoothed Particle Hydrodynamics) based fluid solver and would like to use a second order integration method, for updating velocities and positions of the fluid particles. Some resources suggest using the velocity Verlet method, which to my knowledge, is as follows:


*

*$v^{n+1/2}=v^n+\frac{\Delta t}{2}a^n$

*$x^{n+1}=x^{n}+\Delta t v^{n+1/2}$

*$a_{n+1} = f(...)$

*$v^{n+1}=v^{n+1/2}+\frac{\Delta t}{2}a^{n+1}$


Where $a^0 = f(x^0, v^0)$ is computed beforehand. I would like to know how to proceed in step 3. To compute the acceleration both, the particle position and velocity, are needed. I guess position and velocity at time $n+1$ are required, but how am I am supposed to obtain $v^{n+1}$? I am sorry if this a silly question, but I found the resources I have found so far a little irritating...
Thank you in advance. 
 A: Although it might not serve you since it is an older question, computing the acceleration at step 3. can be done using a predicted $v^{n+1}$ velocity, i.e. either via an Euler step, $v^{n+1}=v^n + \Delta t a^n$ or by simply using $v^{n+1/2}$ as in a half-step approach. Then, step 4. can be interpreted as correcting the velocity. 
Otherwise, if you want to, you can treat 4. as being an implicit update and simply use a non-linear solver to find $v^{n+1}$ (probably not the correct terminology, but this results in an implicit-explicit update, which may cost you a lot of energy on the long run - i.e., the integrator is no longer symplectic).
A: I am struggling with this kind of problems and what I think the answer about step 4 being implicit is a good one. But in SPH you'll need also to iterate for convergence, both for compressible and incompressible.
In my case I am dealing with incompressible SPH for a Newtonian fluid, so I end up having something like
$$v^{n+1}=v^{n+1/2}+\frac{\Delta t}{2} (\mu \nabla^2 v^{n+1} - \nabla p^{n+1})$$
I then do the usual trick of defining an intermediate velocity, writing
$$v^{n+1}=v^* - \frac{\Delta t}{2} \nabla p^{n+1},$$
with
$$v^*:=v^{n+1/2}+\frac{\Delta t}{2} \mu \nabla^2 v^{n+1} , $$
and the Poisson pressure equation must be solved in order  $v^{n+1}$  be
divergence-free:
$$\frac{\Delta t}{2} \nabla^2 p^{n+1} = \nabla\cdot v^{n+1} $$
The resulting pressure is plugged back into $v^{n+1}$ until convergence is achieved.
Good luck!
