5. Linear stationary case

Consider a linear problem of the form

\[ \begin{equation} P(u) \equiv \mathrm{L}u -r = 0 \ , \end{equation} \]

with the linear operator \(\mathrm{L}\) and the inhomogeneous part \(r\) independent of \(u\). The residual is then given by

\[ \begin{equation} R(x) = \mathrm{L} u_N - r \ . \end{equation} \]

Using the ansatz (2.2) in the equation (2.3) for the weighted residuals, one obtains a linear system of equations for the coefficients \(a_k\)

\[ \begin{equation} \sum_{k=0}^N a_k \int_\mathcal{D} w_j \cdot \mathrm{L} \phi_k(x) \mathrm{d}x = \int_\mathcal{D} w_j (r-\mathrm{L}u_B)\mathrm{d}x \ , \ \ j=0,\ldots,N \end{equation} \]

or in matrix formulation \(\underline{\underline{A}} \, \underline{a} = \underline{s}\) with \(\underline{a}=[a_j]\) and

\[ \begin{equation} A_{jk} = \int_\mathcal{D} w_j \cdot \mathrm{L} \phi_k(x) \mathrm{d}x \qquad s_j=\int_\mathcal{D} w_j \cdot (r-\mathrm{L} u_B)\mathrm{d}x \ . \end{equation} \]

Depending on the choice of the test functions, the following cases can be derived

  • Galerkin method:

\[ \begin{equation} A_{jk} = \int \phi_j \mathrm{L} \phi_k \mathrm{d}x \ , \ \ s_j = \int \phi_j(r-\mathrm{L} u_B)\mathrm{d}x \end{equation} \]
  • Collocation method:

\[ \begin{equation} A_{jk} = \mathrm{L} \phi_k (x_j) \ , \ \ s_j = r(x_j) -\mathrm{L} u_B(x_j) \end{equation} \]

5.1. Example problem

For illustration of the collocation method, consider the following linear problem

\[ \begin{equation} u''(x) - H^2 \cdot u(x) = -1 \ , \ \ |x|\leq 1 \ , \end{equation} \]

with the boundary conditions \(u(\pm 1) = 0\). The exact solution is given as

\[ \begin{equation} u(x) = \frac{1}{H^2}\left(1-\frac{\cosh Hx}{\cosh H}\right) \ . \end{equation} \]

This problem is ideal for a Chebyshev spectral method, as two thin boundary layers are formed close to the limits of the domain, i.e. \(|x|=1\).

For the numerical solution, set \(\mathrm{L} = \frac{\mathrm{d}^2}{\mathrm{d}x^2} - H^2\) and \(r=-1\). Employing a collocation scheme, one gets

\[ \begin{equation} A_{jk} = (\frac{\mathrm{d}^2}{\mathrm{d}x^2} - H^2) \phi_k(x)|_{x_j} \ \ \ \text{and} \ \ \ s_j=-1 \ . \end{equation} \]

The multiplication with \(a_k\) and summing according to \(\underline{\underline{A}} \, \underline{a}=\underline{s}\) gives

\[ \begin{equation} \sum_{k=0}^N a_k A_{jk} = \sum_{k=0}^N (\frac{\mathrm{d}^2}{\mathrm{d}x^2} - H^2) a_k \phi_k(x)|_{x_j} = -1 \ . \end{equation} \]

The series ansatz of equation (2.2) now leads to

\[ \begin{equation} u_N''(x_j) - H^2 u_N(x_j) = -1 \ , \ \ j=0,\ldots,N \ , \end{equation} \]

which can be solved after chosing the trial functions and defining an appropriate derivative rule for the vector \(\underline{u }_N=[u_N(x_0), u_N(x_1), \ldots]^T\), cast in matrix form \(\underline{u}_N' = \underline{\underline{D}} \, \underline{u}_N\). The algebraic system becomes with the identity matrix \(\underline{\underline{I}}\)

(5.1)\[ \begin{equation} (\underline{\underline{D}}^2 - H^2\underline{\underline{I}}) \underline{u}_N = \underline{-1} \ , \end{equation} \]

which can be solved after implementation of the boundary conditions in terms of \(u_N\) (not \(a_k\)). It can therefore be concluded that a collocation method relies on the description of the flow solution in physical space, replacing all derivatives with the corresponding derivative matrices \(\underline{\underline{D}}\). The only reference to spectral space is via the definition of \(\underline{\underline{D}}\). Note that the above problem could also be treated using Chebyshev test functions. The boundary conditions would then be enforced in spectral space (rather than physical space) using the tau formulation.

5.2. Implementation of boundary conditions

In order to be able to invert the matrix equation (5.1), two boundary conditions need to be implemented since \(\underline{\underline{D}}\) is not full rank. There are two basic ways for doing that:

  • One removes the two rows of equation (5.1) that correspond to those \(u_N\) where boundary data is available. In case of inhomogeneous data, the right-hand side needs to be adapted accordingly. In this case, the problem size corresponds to the number of degrees of freedom, i.e. \(N-1\).

  • One replaces the rows with boundary data directly with the boundary condition, i.e. \(u_N(\pm 1) = 0\). Effectively, this means replacing the final matrix with the corresponding rows of the identity matrix, and the right-hand side with the boundary data. In that case the problem size is \(N+1\).

The second method is particularly useful if derivative (Neumann) boundary conditions are imposed. In that case, the corresponding row in the final matrix can be replaced with the row of the derivative matrix.

Note that in either case the imposition of the boundary condition corresponds to removing one degree of freedom, which means for a collocation method that the governing equation is not fulfilled in the boundary points. This can easily be checked when computing the residuals after solving for \(\underline{u}_N\). As mentioned, the tau method allows prescribing the boundary conditions in spectral space by removing the equations for the two highest modes. Note that depending on the employed algorithm, these boundary errors need to be corrected for, as demonstrated by Kleiser and Schumann (1980).