boundary condition for vorticity (Jensen) bottom and top
for i = 1:nx+1
w[i,1] = (-4.0*s[i,2]+0.5*s[i,3])/(dy*dy)
w[i,ny+1]= (-4.0*s[i,ny]+0.5*s[i,ny-1])/(dy*dy) - 3.0/dy
end
end
```
✝ ✆

**Figure 25.** Vorticity field and streamfunction field for the lid-driven cavity benchmark problem.

#### *7.2. Vortex-Merger Problem*

We demonstrate the two-dimensional Navier-Stokes solver for the domain with periodic boundary condition using vortex-merger problem. The merging process occurs when two vortices of the same sign with parallel axes are within a certain critical distance from each other. The two vortices merge to form a single vortex. It is a two-dimensional process and is one of the fundamental processes of fluid motion and it plays a key role in a variety of simulations, such as decaying two-dimensional turbulence, three-dimensional turbulence, and mixing layers [47–49]. This phenomenon also occurs in other fields such as astrophysics, meteorology, and geophysics [50].

We use the Cartesian computational domain (*x*, *y*) ∈ [0, 2*π*] × [0, 2*π*] and divide it into 128 × 128 grid resolution. The vorticity equation for the vortex-merger problem is same as the lid-driven cavity problem and is given in Equation (140). We use Re = 2000 and integrate the solution from time *t* = 0 to *t* = 20 with Δ*t* = 0.01. We use third-order Runge-Kutta method for time integration similar to the lid-driven cavity problem. The Julia function to compute the right hand side term of vorticity equation

is the same as the lid-driven cavity problem and is given in Listing 27. The Julia function to assign the initial condition for vortex-merger problem is detailed in Listing 29.

**Listing 29.** Initial condition assignment function in Julia for vortex-merger problem. ✞ ☎

```