Suppose I have a 2D advection equation $$\frac{\partial \rho}{\partial t}=-\nabla\cdot(\vec{w}\rho)$$ with $\vec{w}=(u,v)$ non-constant and having zero divergence. I want to numerically solve this equation, but the scheme that I am currently using does not conserve mass. I am quite new to this topic. My question is:

  1. are there any finite difference schemes (not finite volume method based) that produce stable solution and also conserve mass?
  2. are there any references that I can look up on this?

Edit: The current scheme that I am using: discretize the time derivative by the forward derivative $\frac{\rho^{n+1}_{i,j}-\rho^{n}_{i,j}}{\Delta t}$. If $u_{i}>0$, then we use backward derivative to approximate $\frac{\partial\rho}{\partial x}$ i.e. $\frac{\rho^{n}_{i,j}-\rho^{n}_{i-1,j}}{\Delta x}$. If $u_{i}<0$, we use forward derivative, then repeat the same thing to discretize $\frac{\partial \rho}{\partial y}$. This current scheme does not seems to conserve mass.


  • $\begingroup$ What is your criteria for mass conservation? Has decreasing conservation violations as you refine spatially/temporally, or must guarantee floating point truncation mass conservation? $\endgroup$ Dec 7, 2023 at 3:45
  • $\begingroup$ I am thinking the sum of $\rho_{i,j}$ is more or less constant. $\endgroup$
    – KnobbyWan
    Dec 7, 2023 at 4:51
  • $\begingroup$ By the way, what method are you using? $\endgroup$
    – Rigel
    Dec 13, 2023 at 8:04
  • $\begingroup$ @Rigel I have just added the scheme. $\endgroup$
    – KnobbyWan
    Dec 14, 2023 at 10:48

3 Answers 3


If a finite difference scheme conserves mass, then it can be rewritten as a finite volume scheme.

If the velocity field is incompressible, then the equation can also be written in advection form

$$ \rho_t + \vec{w} \cdot \nabla \rho = 0 $$

You will need a discrete divergence-free condition to be satisfied by your discrete velocity field. This can be achieved by storing the velocity on the cell faces, in fact storing normal component on each face. If $\vec{w} = (u,v)$, then you will have $u_{i-1/2,j}$ and $v_{i,j-1/2}$ such that

$$ \frac{u_{i+1/2,j} - u_{i-1/2,j}}{\Delta x} + \frac{v_{i,j+1/2} - v_{i,j-1/2}}{\Delta y} = 0 $$

Now if you develop an upwind method, you can show that it will be conservative.

The best place to start is here

R. J. LeVeque, "High-resolution conservative algorithms for advection in incompressible flow", SIAM J. Num. Analysis, vol. 33, no. 2, 1996.

and also the finite volume book by same author.

  • $\begingroup$ your answer seems to imply that an upwind wpuld be conservative only if the velocity field is divergence free. Could you explain why, or rephrase if it's not the case? $\endgroup$
    – Rigel
    Dec 15, 2023 at 6:09
  • $\begingroup$ Proof of conservation is given in the references. Writing here will need too much work with latex. $\endgroup$
    – cfdlab
    Dec 15, 2023 at 8:29

The boundary between finite differences and finite volumes is sometimes blurry. Buy if the reason why you want to avoid finite volumes is to avoid solving a Riemann problem, then there are a few methods you can try at first (there are many others of course!):

The methods above are all conservative and stable (provided you satisfy CFL condition). But, be careful: they are very basic methods... I am not saying that they are accurate! Since are very basic methods, they are described in almost any book on this topic. One of my favorite ones is Trangenstein, J. A. (2009) "Numerical solution of hyperbolic partial differential equations".

When checking the conservation of mass, do not forget to consider that some mass may enter or exit from the boundaries, depending on your boundary conditions. Also, do not forget the contribution of machine precision.


Welcome to Scicomp!

One approach is the 'mimetic finite difference' discretization. Here, the FD stencils are constructed to conserve certain properties of the physcial equations (including conservation of mass).



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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