I'm working with the following mixed inhomogeneous boundary value problem:

$\nabla(\kappa\nabla u)=f$ in $\Omega$
with $\partial\Omega = \Omega_1 \bigcup\Omega_2$ such that
$u=g$ on $\partial\Omega_1$
$\kappa\nabla u\cdot n = h$ on $\Omega_2$

Note 1:
If the entire boundary $\partial \Omega$ only consisted of the inhomogenous neumann boundary condition, I can clearly see that the weak formulation is:

$$ \int_\Omega \kappa\nabla u \nabla v = \int_\Omega fv + \int_{\partial\Omega} vh$$

Since there is no "essential" boundary condition and the weak formulation only consists of first derivatives, u and v can be elements of the sobolev space $H^1(\Omega)$.

Note 2:
I understand if the entire boundary $\partial \Omega$ only consisted of the inhomogeneous dirichlet condition, I can take test functions $v\in H_0^1$ but $u\notin H_0^1$. To correct for this, I can "homogenize" the boundary condition by proposing a new variable $w=u-G$ where G is some function in $H^1(\Omega)$ such that $G=g$ on $\partial\Omega$. Using $u=w+G$, I can see that the weak formulation becomes

$$ \int_\Omega \kappa\nabla w\cdot\nabla v=\int_\Omega fv -\int_{\partial\Omega}\kappa \nabla G\cdot\nabla v$$

Since $w=u-G$, the boundary values of $w$ must be zero. Hence, $w\in H_0^1(\Omega)$.

My question:
Following this pattern, I conjecture that for the mixed inhomogenous boundary value problem:

  1. The test function $v\in H_0^1(\Omega)$
  2. The neumann boundary condition on $\partial\Omega_2$ is naturally satisfied.
  3. The dirichlet boundary condition on $\partial\Omega_1$ can be satisfied by proposing a new variable $w$ such that $w=u-G$ for some $G\in H^1(\Omega)$ and leading to the weak formulation:

$$ \int_\Omega k\nabla w \nabla v = \int_\Omega fv + \int_{\partial \Omega_2} hv -\int_\Omega k\nabla G \nabla v$$

I'm almost completely sure that this is correct, but I just want to get some feedback on my conjectures. If I'm completely wrong, please let me know! :)

  • $\begingroup$ I was working on the same problem. The range of test function can be wrote more general. It should be $$\{v \in H^{1}(\Omega) : v = 0 \text{ on } \partial \Omega_{1}\}$$ $\endgroup$
    – user18564
    Commented Dec 15, 2015 at 9:17
  • $\begingroup$ There's a related question here scicomp.stackexchange.com/q/5072/46069 which I took the liberty of answering here scicomp.stackexchange.com/a/43094/46069 $\endgroup$ Commented Aug 5, 2023 at 23:29

1 Answer 1


Your setup is fine, but it is often inconvenient to always formulate in terms of the general "lifting" function $G$, especially for nonlinear problems, structured grids, and simply for IO with solutions and forcing terms for the linear problem. If you find lifting convenient, then by all means, keep using it. It will never cause a problem for linear solvers provided you can create auxiliary operators with respect to the lifted system (if you have a system and solver that requires this; common with mixed methods for Stokes, $H(\mathrm{div})$, and $H(\mathrm{curl})$ problems).

To understand and implement general boundary conditions, I like to start with how I would formulate the nonlinear problem. The linear problem then falls out as the Jacobian of the nonlinear problem. For that, define the spaces

  • $V_D$ : the discrete ansatz space with inhomogeneous Dirichlet conditions implicitly built in (so this is an affine space)
  • $V_0$ : the corresponding homogeneous space (also the test function space for Galerkin discretizations)
  • $V_\Gamma$ : the trace space on the Dirichlet boundary $\partial\Omega_1$ extended by zero into the domain
  • $\bar V = V_0 \times V_\Gamma$ : all discrete functions on $\bar\Omega$ (this is what you want for visualization). This notation implies that the discrete space can be partitioned, but this is true of most practical compact discretizations.

We introduce the projections

  • $R_D : \bar V \to V_D$, the affine projector that imposes "correct" boundary conditions on the Dirichlet boundary $\partial D_1$
  • $R_0 : \bar V \to V_0$, the projector that imposes zero boundary conditions on the Dirichlet boundary $\partial D_1$
  • $R_\Gamma : \bar V \to V_\Gamma$, the projector into the trace space

Now we can write the discrete residual $F$ defined on $\bar V$ in terms of the "natural" residual $\tilde F$ that does nothing special for Dirichlet boundaries (e.g. your normal finite element assembly),

$$ F(u) = R_0 \tilde F(R_D u) + \alpha R_\Gamma (u - R_D 0) $$

where $\alpha$ is a scaling parameter that can be used to improve conditioning (most relevant if you will use rediscretized geometric multigrid). The Jacobian isolates the Dirichlet degrees of freedom and the implementation is straightforward. Local element residuals and Jacobians are evaluated with correct Dirichlet values imposed on the state $u$, the result is inserted with contributions to Dirichlet nodes discarded. Then a loop over the boundary places the $\alpha$-scaled difference from the correct boundary values into the residual vector and inserts $\alpha$ on the diagonal of the Jacobian.

We will solve $F(u) = 0$ so we arrange terms as

$$ v^T \tilde F(u) = \int_\Omega (\nabla v \cdot \kappa \cdot \nabla u - v f) - \int_{\partial \Omega_2} v h . $$

There is no need for special mechanics since all discrete solutions live in $\bar V$ and the lifting function $G$ does not appear explicitly.

  • $\begingroup$ How do I understand the difference between $\bar{V}$ and $V_D$ ? A typical vector in both seems to have similar representation. What am I missing ? $\endgroup$
    – me10240
    Commented Aug 31, 2014 at 17:50
  • $\begingroup$ $V_D$ is an affine space containing functions that satisfy the desired Dirichlet boundary conditions. It is an affine subspace of $\bar V$, which contains functions with any values at Dirichlet boundaries. $\endgroup$
    – Jed Brown
    Commented Sep 1, 2014 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.