Help deriving a Fourier-Galerkin approximation for a variable coefficient partial differential equation

45 Views Asked by At

I've been trying to derive a Fourier-Galerkin approximation of

\begin{equation} \frac{\partial u}{\partial t} + \sin(x) \frac{\partial u}{\partial x} = 0 \end{equation}

But I'm not sure that my steps are correct. My steps are as follows.

First, derive a Fourier-Galerkin approximation of

\begin{equation} \frac{\partial u}{\partial t} + \sin(x) \frac{\partial u}{\partial x} = 0 \end{equation}

Next, express $u$ in terms of a Fourier expansion

\begin{equation} u \approx u_n = \sum_{|n| \leq N/2} a_n(t) e^{inx} \end{equation}

Then the partial derivatives can be approximated as

\begin{equation} \frac{\partial u_n}{\partial t} = \sum_{|n| \leq N/2} \frac{d a_n(t)}{dt} e^{inx}, \quad \frac{\partial u_n}{\partial x} = \sum_{|n| \leq N/2} in a_n(t) e^{inx} \end{equation}

and so

\begin{equation} \frac{\partial u_n}{\partial t} + \sin(x) \frac{\partial u_n}{\partial x} = \sum_{|n| \leq N/2} \frac{d a_n(t)}{dt} e^{inx} + \sin(x) \sum_{|n| \leq N/2} in a_n(t) e^{inx} \end{equation}

The residual is

\begin{equation} r_n = \sum_{|n| \leq N/2} \left(\sin(x) \cdot in a_n(t) + \frac{d a_n(t)}{dt} \right) e^{inx} \end{equation}

and projecting the residual onto $B_N = \text{span}\{e^{inx}\}$ yields

\begin{equation} (r_n, \phi) = \int \sum_{|n| \leq N/2} \left( \sin(x) \cdot in a_n(t) + \frac{d a_n(t)}{dt} \right) e^{inx} e^{-inx} = 0 \end{equation}

It follows then that

\begin{equation} \int \sum_{|n| \leq N/2} \sin(x) \cdot in a_n(t) + \frac{d a_n(t)}{dt} = 0 \end{equation}

from which we obtain a system of ODEs to determine the coefficients $a_n$

\begin{align} \sin(x) \cdot in a_n(t) + \frac{d a_n(t)}{dt} &= 0 \\ \implies \frac{d a_n(t)}{dt} &= -\sin(x) \cdot in a_n(t) \quad \forall |n| \leq N/2 \end{align}

Are my steps correct?

Moreover let's say I want to impose the boundary condition $u(0, t) = u(\pi, t)$, if my understanding of the method is correct I have to change my space $B_n$ accordingly to these boundary conditions. In this case, the periodic function that satisfies these boundary conditions is $\sin(x)$ and therefore $B_n = \text{span}\{\sin(nx)\}$. Am I correct?