Improvements and suggestions on a fluid simulation in p5.js

I have made a fluid simulation using p5.js as a practice exercise. My primary source of reference was the 2003 paper on Real time fluid dynamics by Jos Stam (http://graphics.cs.cmu.edu/nsp/course/15-464/Fall09/papers/StamFluidforGames.pdf). I think it is working, but I am not sure. I would like any suggestions or corrections in my code, and improvements like how do I add gravity? If I add any vector (1,0) to the pixels the code blows up.
Here is my code in the p5.js editor :
https://editor.p5js.org/Astle/sketches/97f2mN2mm

I would like to know if I made any mistakes, and how can I correct them. I would also like to know how I can add outside forces like gravity or mouse movements, as I couldn’t understand it from the paper.