Boundary Values for the Convolution Theorem for the Inverse Fourier Transform

32 Views Asked by At

I am attempting to numerically solve the Vorticity-Streamfunction Equation (a 2D incompressible simplification of the Navier-Stokes Equations) in Fourier Space: $$ \omega_t + \psi_y \omega_x - \psi_x \omega_y = \nu (\omega_{xx} + \omega_{yy}) $$ Unfortunately, because $\omega = - \nabla^2 \psi$, the second and third terms on the LHS are non-linear, preventing an easy way to evaluate the $( \psi_y \omega_x )$ term in Fourier Space.

Using $p, q$ as the indexes in Fourier Space, it can shown that (note $\odot$ is defined as the Hadamard Product, i.e. element-wise multiplication): $$ \hat{( \psi_y \omega_x )}_{pq} = \text{fft2} \left[ \text{ifft2} \left[ \hat{(\psi_y)}_{pq} \right] \odot \text{ifft2} \left[ \hat{(\omega_x)}_{pq} \right] \right] $$

However, as the Fourier Transform and the Inverse Fourier Transform are computationally expensive, I'm looking for a different way to evaluate this term without flipping back and forth between physical and frequency space. Since the Convolution Theorem page on Wikipedia had the following: $$ F(g * h) = F(g) \odot F(h) $$ $$ F(g \odot h) = F(g) * F(h) $$

I attempted to write a quick test to prove this second equation:

import numpy as np
import scipy as sc

b = np.random.rand(10, 10)
c = np.random.rand(10, 10)

B = np.fft.fft2(b)
C = np.fft.fft2(c)

A1 = np.real(np.fft.fft2((np.fft.ifft2(B) * np.fft.ifft2(C))))
A2 = np.real(sc.signal.convolve2d(B, C, mode = 'same', boundary = 'fill'))[0:10, 0:10]

import matplotlib.pyplot as plt
plt.pcolor(A2 - A1)
plt.colorbar()
plt.show()

However, regardless of what mode = and boundary = flags I put for sc.signal.convolve2d(), A1 and A2 don't seem to evaluate the same thing. How are the boundary values for the convolution treated, such that I can use the Convolution Theorem for the Inverse Fourier Transform in this instance?