Arakawa numerical scheme for Jacobian
j1 = gg*((w[i+1,j]-w[i-1,j])*(s[i,j+1]-s[i,j-1]) -
(w[i,j+1]-w[i,j-1])*(s[i+1,j]-s[i-1,j]))
j2 = gg*(w[i+1,j]*(s[i+1,j+1]-s[i+1,j-1]) -
w[i-1,j]*(s[i-1,j+1]-s[i-1,j-1]) -
w[i,j+1]*(s[i+1,j+1]-s[i-1,j+1]) +
w[i,j-1]*(s[i+1,j-1]-s[i-1,j-1]))
j3 = gg*(w[i+1,j+1]*(s[i,j+1]-s[i+1,j]) -
w[i-1,j-1]*(s[i-1,j]-s[i,j-1]) -
w[i-1,j+1]*(s[i,j+1]-s[i-1,j]) +
w[i+1,j-1]*(s[i+1,j]-s[i,j-1]))
jac = (j1+j2+j3)*hh
#Central difference for Laplacian
r[i,j] = -jac + aa*(w[i+1,j]-2.0*w[i,j]+w[i-1,j]) +
bb*(w[i,j+1]-2.0*w[i,j]+w[i,j-1])
```


**Listing 28.** Boundary condition update function in Julia for the lid-driven cavity problem. ✞ ☎

```