Periodic boundary conditions in a 2D array

73 Views Asked by At

I need to implement the following boundary conditions in my Python code f(0, x) = f(-1, x) = 0 and f(y, 0) = f(y, N) (periodic in the second index).

My code doesn't seem to work. F is a numerical solution of a hyperbolic partial differential equation

for j in range(0, m-1):
        for i in range(0, n-1):
            
            f[0, i] = 0
            f[-1, i] = 0
            
            f[j, 0] = f[j, -1]
            f[j, -1] = f[j, 1]
0

There are 0 best solutions below