Computational Physics, Python, Math, Physics.
q[1:N_x,1:N_y])*(u_n[1:N_x,1:N_y] - u_n[1:N_x,0:N_y - 1]) ) #bound conditions if bound_cond == 1: #Dirichlet bound cond u_np1[0,:] = 0 u_np1[-1,:] = 0 u_np1[:,0] = 0 u_np1[:,-1] = 0 elif bound_cond == 2: #Nuemann bound cond i,j = 0,0 u_np1[i,j] = 2*u_n[i,j] - u_nm1[i,j] + Cx2*(q[i,j] +