5. Linear stationary case¶
Consider a linear problem of the form
with the linear operator \(\mathrm{L}\) and the inhomogeneous part \(r\) independent of \(u\). The residual is then given by
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\)
or in matrix formulation \(\underline{\underline{A}} \, \underline{a} = \underline{s}\) with \(\underline{a}=[a_j]\) and
Depending on the choice of the test functions, the following cases can be derived
Galerkin method:
Collocation method:
5.1. Example problem¶
For illustration of the collocation method, consider the following linear problem
with the boundary conditions \(u(\pm 1) = 0\). The exact solution is given as
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
The multiplication with \(a_k\) and summing according to \(\underline{\underline{A}} \, \underline{a}=\underline{s}\) gives
The series ansatz of equation (2.2) now leads to
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}}\)
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).