# 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:

1. $v^{n+1/2}=v^n+\frac{\Delta t}{2}a^n$
2. $x^{n+1}=x^{n}+\Delta t v^{n+1/2}$
3. $a_{n+1} = f(...)$
4. $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...

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).