Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Thank you in advance.

share|cite|improve this question

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

share|cite|improve this answer

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!

share|cite|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – jameselmore Jul 13 '15 at 22:15
I am not sure I follow. The original question is unclear about what kind of SPH is considered, above all incompressible vs compressible. I have written a rather detailed answer for the former, which is the one I currently know best. I would request clarification to the original question, but, as you say, I am unable to do so yet. – Daniel Duque Jul 15 '15 at 3:58
To be honest, I didn't write that comment. I think that this post must have come through the review queues and I may have accidentally marked this post as an incomplete answer. Looking at it now, it's clear I was confused. Please excuse me! – jameselmore Jul 15 '15 at 11:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.