# Mixed boundary conditions Finite Element Method

I have the following problem in Finite Element Method

$$-(\alpha u')' + \beta u' + \gamma u = f$$

with $\Omega = (0, 1)$, $u(0) = 0$ and $u'(1) = 3$

to be able to write the weak formulation of the problem do I need a lifting function?

i.e., do I need to define something like

$$\tilde u = u - R$$

I'm stuck after integrating by parts, I got something like:

$$- \Big [(\alpha u' v) _0^1 - \int_0^1 \alpha u' v' \Big ] + \beta \int_0^1 u' v + \gamma \int_0^1 u v = \int_0^1 f v$$

$\forall v \in V = H_{\Gamma_D}^1 (0,1)$

To get rid of the first term $$(\alpha u' v) _0^1$$ and have the bilinear form $a(u,v)$, when $$v(0) = 0$$ the lower limit dissapears, but for the upper limit I get $$- \alpha u' (1) v(1)$$ and it does not disappear, how to proceed?

-
Hi @BRabbit27, and welcome to scicomp! I noticed the strong form of your problem seems incomplete... It seems to be missing a right hand side to make it a true equation. –  Paul Nov 13 '12 at 18:46
Sorry, editing and correcting it. –  BRabbit27 Nov 13 '12 at 18:51
It doesn't need to disappear, because you can just substitute $u'(1)=3$ in it. You can then move the term to the right hand side. –  Christian Clason Nov 13 '12 at 18:57
So first of all, no need to have a lifting function $\tilde u = u - R$. Second of all, the weak formulation will be $\alpha \int_0^1 u' v' + \beta \int_0^1 u' v + \gamma \int_0^1 u v = \int_0^1 f v + 3 \alpha v$, am I right? –  BRabbit27 Nov 13 '12 at 19:02
That's right (except it should be $3\alpha v(1)$). You only need lifting functions for nonhomogeneous Dirichlet conditions. Also, this shows that the proper Neumann conditions should be $\alpha u'(1) = g$ (this makes a real difference in $2$ and more dimensions). –  Christian Clason Nov 13 '12 at 19:52

For the second term $\alpha u'(1)v(1)$, you can insert the Neumann boundary condition $u'(1) = 3$ to obtain $3\alpha v(1)$. Since this term can be evaluated (for a given test function $v$), it becomes part of the right hand side: The weak formulation is to find $u\in H^1_{\Gamma_D}(0,1)$ such that $$\int_0^1 u'(x)v'(x) dx + \beta \int_0^1 u'(x)v(x) dx + \int_0^1 u(x)v(x) dx = \int_0^1 f(x) v(x) dx + 3\alpha v(1)$$ for all $v\in H^1_{\Gamma_D}(0,1)$.
Note that in two and more dimensions, the term arising from integration by parts is $$\alpha(x)\nabla u(x)\cdot \nu(x) v(x), \qquad x\in\Gamma_N,$$ where $\alpha$ can be a matrix and $\nu(x)$ is the unit outward normal at $x$. To handle that term, you need to specify $$\alpha\nabla u\cdot \nu = g$$ on $\Gamma_N$, and not just the normal derivative $\nabla u\cdot \nu$.