Vorticity + XSPH positions
Closed this issue · 1 comments
jenzou commented
Fluid-Simulator/simulator/code/Assignment2/ParticleSystem.cpp
Lines 260 to 301 in 1aae1d9
V3D ParticleSystem::getVorticityW(int i) { | |
V3D vorticity = V3D(); | |
for (int j : particles[i].neighbors) { | |
V3D rel_vel = particles[j].v_i - particles[i].v_i; | |
V3D j_to_i = particles[i].x_i - particles[j].x_i; | |
V3D smoothing = spiky(j_to_i, KERNEL_H, false); | |
vorticity += rel_vel.cross(smoothing); | |
} | |
return vorticity; | |
} | |
V3D ParticleSystem::getVorticityN(int i) { | |
return getGradW(i).unit(); | |
} | |
V3D ParticleSystem::getGradW(int i) { | |
V3D grad_w = V3D(); | |
for (int j : particles[i].neighbors) { | |
double diff_w = particles[j].vorticity_W.length() - particles[i].vorticity_W.length(); | |
V3D j_to_i = particles[i].x_i - particles[j].x_i; | |
double diff_p = j_to_i.length(); | |
grad_w += (spiky(j_to_i, KERNEL_H, false) * diff_w / diff_p); | |
} | |
return grad_w; | |
} | |
V3D ParticleSystem::getXSPH(int i) { | |
V3D delta_v = V3D(); | |
for (int j : particles[i].neighbors) { | |
V3D rel_vel = particles[j].v_i - particles[i].v_i; | |
V3D j_to_i = particles[i].x_i - particles[j].x_i; | |
delta_v += rel_vel * poly6(j_to_i, KERNEL_H); | |
} | |
return delta_v * VISCOSITY_C; | |
} |
Why are these calculations in terms of current positions instead of predicted positions?
zzw96 commented
good call, will change this!