1
I can’t run it in my python, someone who can help me? The problem is in the border conditions.
for it in range(2,nt):
uu=u*u;
uv=u*v;
vv=v*v;
hbu=(h-b)*u;
hbv=(h-b)*v;
gh=g*h;
# Avançar o sinal em todo o domínio excepto nas fronteiras
for ix in range(2,Nx-1):
for iy in range(2,Ny-1):
uP[ix,iy] = (1/4. * (u[ix-1,iy] + u[ix+1,iy] + u[ix,iy-1] + u[ix,iy+1])) - dt2dx * (uu[ix+1,iy] - uu[ix-1,iy]) - dt2dy * (uv[ix,iy+1] - uv[ix,iy-1]) + dt2dx * (g*h[ix+1,iy] - g*h[ix-1,iy])
vP[ix,iy] = (1/4. * (v[ix-1,iy] + v[ix+1,iy] + v[ix,iy-1] + v[ix,iy+1])) - dt2dx * (uv[ix+1,iy] - uv[ix-1,iy]) - dt2dy * (vv[ix,iy+1] - vv[ix,iy-1]) + dt2dy * (gh[ix,iy+1] - gh[ix,iy-1])
hP[ix,iy] = (1/4. * (h[ix-1,iy] + h[ix+1,iy] + h[ix,iy-1] + h[ix,iy+1])) - dt2dx * (hbu[ix+1,iy] - hbu[ix-1,iy]) - dt2dy * (hbv[ix,iy+1] - hbv[ix,iy-1])
#condições fronteira
hP[1,:]=hP[2,:];
hP[Nx,:]=hP[Nx-1,:];
hP[:,1]=hP[:,2];
hP[:,Ny]=hP[:,Ny-1];
uP[1,:]=0;
uP[Nx,:]=0;
uP[:,1]=uP[:,2];
uP[:,Ny]=uP[:,Ny-1];
vP[1,:]=vP[2,:];
vP[Nx,:]=vP[Nx-1,:];
vP[:,1]=0;
vP[:,Ny]=0;
# actualizar o sinal
h[:]=hP[:]; u[:]=uP[:]; v[:]=vP[:];
hStation[it] = h[ixStation, iyStation]
What is the expected result and what is the result? You can edit your question by placing the test conditions for the algorithm?
– Leonel Sanches da Silva
– Gonçalo Albuquerque
Better contextualize your problem by explaining what your program proposes to solve. If possible, give an example of input data and the expected correct result.
– luislhl