I've been recently working on a JS program that models this scholarly article. The problem I've been recently having is this:
"Surface tension is usually caused by attraction between particles. Inside the fluid, this attraction, cancels out, but for the molecules near the surface, asymmetry in neighbor distribution results in a non-zero net force towards the fluid."
I'm assuming that this happens naturally in the double density relaxation method, but my program seems to show no sign of it.
Here's an excerpt from the double density relaxation method:
function doubleDensityRelaxation() {
for(var i = 0; i<particles.length; i++) {
var pi = particles[i];
var p = 0;
var pNear = 0;
for(var j = i+1; j<particles.length; j++) {
var pj = particles[j];
var rij = sub(pi.r,pj.r);
var q = length(rij)/h;
if(q < 1) {
p += (1-q)*(1-q);
pNear += (1-q)*(1-q)*(1-q);
}
}
var P = k*(p-p0);
var PNear = kNear*pNear;
var dx = [0,0];
for(var j = i+1; j<particles.length; j++) {
var pj = particles[j];
var rij = sub(pi.r,pj.r);
var q = length(rij)/h;
if(q < 1) {
var D = scale(normalize(rij), dtsq*(P*(1-q)+PNear*(1-q)*(1-q)));
pj.r = add(pj.r,scale(D,0.5));
dx = sub(dx,scale(D,0.5));
}
}
pi.r = add(pi.r,dx);
}
}