# Ripples appear when solving Fokker-Planck equation [closed]

I'm solving a Fokker-Planck equation with Python by solving AB=C where A is coefficient matrix, B is the vector of unknowns, and C is the right-hand side. The Fokker-Planck is below:

$$\frac{∂ρ(x,y,t)}{∂t} ​= -\beta \delta \left[\left(\frac{∂}{∂x​}F_x(x,y)ρ(x,y,t) + \frac{∂}{∂y​}F_y(x,y)ρ(x,y,t) \right) \\ + \delta \left(\frac{∂^2ρ(x,y,t)}{∂x^2} + \frac{∂^2ρ(x,y,t)}{∂y^2} \right)\right] \quad (1)$$

The challenge is that the solution B seems unstable since it appears 'ripples' during the simulation and this is an unexpected behaviour. I've tried to reduce the time step or increase the grid size but none of these helps. However, if I just make the $$F$$ smaller by scaling it by a small factor then the 'ripples' disappear. What would have caused this issue and how to sort this out please?

c = scipy.sparse.linalg.spsolve(A, b)
p[:,:] = c.reshape(Ny+1,Nx+1).T
# Normalize p
p /= np.sum(p)

• This question would be more appropriate for stackoverflow – spiridon_the_sun_rotator Apr 29 at 7:04
• I posted this question on stackoverflow but they asked me to post here – An Nguyen Apr 29 at 7:09
• What scheme do you use for the first derivatives in space? – Pavlo. B. Apr 29 at 7:26
• I used Forward Euler scheme – An Nguyen Apr 29 at 7:30
• I’m voting to close this question because it is about debugging code, not physics. – Jon Custer May 4 at 14:33