2.4.6 Boundary Conditions for Finite Differences
Measurable Outcome 2.3, Measurable Outcome 2.8
In this section, we discuss the implementation of finite difference methods at boundaries. This discussion is not meant to be comprehensive, as the issues are many and often subtle. In particular, we only focus on Dirichlet boundary conditions.
A Dirichlet boundary condition is one in which the state is specified at the boundary. For example, in a heat transfer problem, the temperature might be known at the boundary. Dirichlet boundary conditions can be implemented in a relatively straightforward manner. For example, suppose that we are solving a one-dimensional convection-diffusion problem and we want the value of \(U\) at \(i=0\), to be \(U_{inlet}\),
To implement this, we fix \(U_0 = U_{inlet}\) and apply the finite difference discretization only over the interior of the computational domain accounting for the known value of \(U_0\) at any place where the interior discretization depends on it. For example, at the first interior node (i.e. \(i=1\)), the central difference discretization of 1-D convection-diffusion gives,
Accounting for the known value of \(U_0\), this becomes,
In terms of the vector notation, when a Dirichlet boundary condition is applied we usually remove that state from the vector \(U\). So, in the situation where \(U_0\) is known, the state vector is defined as,
The right-hand side \(b\) vector then will contain the contributions from the known boundary values. For example, by re-arranging Equation (2.89), the first row of \(b\) contains,
Since \(U_{inlet}\) does not enter any of the other node's stencils, the remaining rows of \(b\) will be zero (unless they are altered by the other boundary).
Effect of boundary conditions on the number of degrees of freedom for the 1D Laplace equation
The number of degrees of freedom in a set of equations is considered to be the number of unknowns. Consider the 1D Laplace equation defined on a finite domain \(x \in [0, T].\)
Suppose we discretize \(x\) into \(N\) unknowns \((x_1, \ldots x_ N)\) and we use a second order central difference scheme to approximate the left side of the Laplace equation. The resulting linear equations become
It appears that this equation has \(N\) unknowns and \(N\) degrees of freedom.
However if we rewrite the first two equations specified by this system:
We can now remove \(x_1\) from this system by converting the second equation into
We can perform the same trick for the last equation to obtain
Finally we obtain the system
This system has \(N-2\) degrees of freedom. Thus we see that the specification of the Dirichlet boundary conditions has reduced the number of degrees of freedom of the system compared to the number of discretization points.