# Finite-volume method: can Dirichlet boundary conditions be applied to the integral form?

I would like to apply Dirichlet conditions to the advection-diffusion equation using the finite-volume method. This answer, "How should boundary conditions be applied when using finite-volume method?" emphases the benefit of staying with integral form of the equations for as long as possible. This works fantastically for Robin boundary conditions because ghost cells nor interpolation is required.

Can Dirichlet conditions be applied to the integral form, or only the discretised equation?

For example, the advection-diffusion equation in flux form,

$$u_t = -(\cal{F})_x + s$$

where,

$$\mathcal{F}=au - du_x$$

After applying the finite volume method this becomes (in semi-discrete form),

$$w_1^{\prime} = -\frac{\mathcal{F_{3/2}}}{h_1} + \frac{\mathcal{F_{1/2}}}{h_1} + \bar{s}_1$$

Can Dirchlet conditions be applied to the flux term at the left hand side interface, $\mathcal{F_{1/2}}$, this would imply that we only know the advection part of the flux, i.e. the $au$ part where $u$ is known at the boundary.

In general this is not possible. For pure advection it is - as Shuhao Cao has pointed out - for problems with diffusion it is not.

Doing the integration on a control volume and applying the divergence theorem, the Laplacian on the interior is turned into the normal derivative taken along the boundary: $$\int_\Omega \nabla \cdot \nabla u dx = \oint _{\partial \Omega} \nabla u \cdot n ds$$

There is no possibility to incorporate Dirichlet data here, since you cannot get from $u=g$ on $\partial \Omega_{-}$ to the normal derivative $\frac{\partial u}{\partial n}$ on $\partial \Omega_{-}$. (In 1D this would mean to take a derivative of a scalar...)

• So it is not possible to apply Dirichlet conditions to the advection-diffusion equation in the integral (finite-volume) form. One needs to apply boundary conditions to the discretised equations for the reason you mentioned? Jul 1, 2013 at 0:14
• No, it is not. I have made my post more specific.
– Jan
Jul 1, 2013 at 5:34

The answer is YES, you can impose the Dirichlet boundary condition weakly on the inflow boundary $\partial \Omega^-$.

Say for the following advective equation: $$\begin{cases} u_t + \nabla \cdot (\mathbf{v} u) = 0 \quad \text{in }\Omega, \\ u= g \quad \text{on }\partial \Omega^-, \end{cases}$$ where $\partial \Omega^-$ is the inflow boundary: $\mathbf{v}\cdot \mathbf{n}< 0$ for outward normal $\mathbf{n}$, this means the flow field $\mathbf{v}$ is flowing into the domain here on this inflow boundary. We can assume the flow is incompressible as well ($\nabla \cdot \mathbf{v} = 0$). Now common FV reads: $$\int_K u_t(x,t)\,dx + \int_{\partial K} \mathbf{v}(x)\cdot \mathbf{n}(x) u(x,t)\,dS = 0 \quad \text{for any } t,$$ where $K$ is the control volume (interval in your case). Now decomposing each control volume's boundary into two parts: $$\int_K u_t \,dx + \int_{\partial K\backslash \partial \Omega^-} \mathbf{v} \cdot \mathbf{n} \,u \,dS + \color{blue}{\int_{\partial K\cap\partial \Omega^-} \mathbf{v} \cdot \mathbf{n}\, u \,dS} = 0$$ (Thanks to Jan) Just moving the blue term to the right and replacing $u$ with its boundary data will do: $$\int_K u_t \,dx + \int_{\partial K\backslash \partial \Omega^-} \mathbf{v} \cdot \mathbf{n} \,u \,dS = -\color{blue}{\int_{\partial K\cap\partial \Omega^-} \mathbf{v} \cdot \mathbf{n}\, g\,dS}$$ Blue terms are equal to each other, but after you solved the equation you will find that the Dirichlet boundary condition is not precisely satisfied even when the data $g$ is a piecewise constant, for we only impose it weakly and treat the inflow Dirichlet boundary as if it is Neumann. I saw this approach a long time ago for Discontinuous Galerkin formulation (essentially higher order FVM) for convection-diffusion equation in Ern and Guermond's book.

• So the method is to add the boundary condition equation to the main equation at the appropriate cell. Does this generalised to the advection-diffusion equation with Dirichlet conditions on both sides (for example to investigate boundary layer formation)? You said that approach is slightly approximate, is it better to apply the Dirichlet conditions to the discretised equation in this case? Jun 29, 2013 at 0:34
• @boyfarrell For advection-diffusion you can do that for both sides. For the second question, I am not sure, the term "better" in computational mathematics for me is always "trading between different advantages", it depends on the problems. Jun 29, 2013 at 0:45
• When one inposes Dirichlet conditions on the discretised equations (i.e. the matrix) they boundary conditions are exact. I was just wondering, in you experience, how this approach compares? For example, what is traded between the approach you mentioned and the approach of just apply the Dirichlet conditions to the matrix equation instead? Jun 29, 2013 at 1:24
• @boyfarrell Incorporating boundary conditions in the integral form will make your solution more accurate measured under the integral-type norm (for example $H^1$-norm) near the boundary, especially for curved boundary. Trade-off is that you have more degrees of freedom in your matrix equation. Jun 29, 2013 at 1:42
• Finally can I ask about the notation. What is the meaning of $\partial K\backslash \partial \Omega^-$ and $\partial K\cap\partial \Omega^-$? Jun 29, 2013 at 2:35