The equations are here Hi! I tried to solve 3 pde equations by using the FD method in C++, but I do not know why I got half of the exact answer at all time. These equations are dependency variable. I have problem with g(x,y) and g(y,x). When I delete g(y,x) in eq 3, the result does not change. But when I delete g(x,y), I got zero, so I think we need to do something for dependency variables. I do not know. I hope to get help
if(g[i][k][j]!=g[k][i][j] && i!=k)
u[i][k][j+1]=u[i][k][j]*(1.0 - 2.0*dt)
+(dt/(dx*dx))*(g[i+1][k][j]- 2.0*g[i][k][j]+g[i-1][k][j])
+(dt/(dx*dx))*(g[k+1][i][j]- 2.0*g[k][i][j]+g[k-1][i][j])
+(dt/(dy*dy))*(g[i][k+1][j]-2.0*g[i][k][j]+g[i][k-1][j])
+(dt/(dy*dy))*(g[k][i+1][j]-2.0*g[k][i][j]+g[k][i-1][j]); //(eq 1)
g[i][k][j+1]=g[i][k][j]*(1 - dt)
+dt*u[i][k][j]
+(dt/(dy*dy))*(v[i][k+1][j]-2*v[i][k][j]+v[i][k-1][j])
+(dt/(dx*dx))*(v[i+1][k][j]-2*v[i][k][j]+v[i-1][k][j]); //(eq 2)
v[i][k][j+1]=v[i][k][j]+(g[k][i][j] + g[i][k][j])*dt; //(eq 3)