# Applying the Finite Element Method to a II order ODE with nonlinear source term

I'm trying to apply the FEM to a 1D Poisson equation

$- u''(x) = f(x,u(x))$

subject to constraints $u(0) = u(1) = 0$, with a nonlinear source term of the type

$f = \dfrac{1}{1 + e^{-a \cdot u(x)}} + e^{-b\cdot u(x)} \cdot H(x)$

where $H(x)$ is piecewise constant function defined as

$\begin{cases} -1& \text{for} \quad 0\leq x < x_0\\ +1& \text{for} \quad x_0 \leq x \leq 1 \end{cases}$

I'm stuck when trying to apply the Galerkin method to discretization to the weak formulation:

$\sum_j u_j \int \varphi_i' \varphi_j' \,dx = \int f(x,u(x)) \varphi_i dx$

where $\{\varphi(x)\}$ is a Lagrange polynomial basis. Now, to solve this non-linear problem, somebody told me that it's possible to expand the $f$ function in the same basis used for the $u(x)$, i.e.

$f = \sum_j f(u_j) \varphi(x)$

in order to obtain

$\sum_j u_j \int \varphi_j' \varphi_i' \,dx = \sum_j f(u_j) \int \varphi_j \varphi_i dx$

which can be solved through Newton's method. However, i'm not convinced by the expansion of $f$, which leads to my question: since it contains discontinuities, it doesn't belong to the same space $\mathcal{H}^1$ as the $u(x)$, so wouldn't another, larger basis be required to do so? Is there a serious flaw in my line of reasoning?

• You can write that kind of expansion for the dependence on $u$ (i.e. the first two terms) and then add it separately to $N(x)$. – Ian Oct 22 '16 at 21:37
• In other words you really have $-u''=f(u)+g(x)$, where $f$ is a nice function and $g$ is not. You Galerkin-expand $f$ and leave $g$ the way it is. – Ian Oct 22 '16 at 22:15
• @Ian thanks, that would indeed work if that was the case, unfortunately i made a typo, it's $\exp(- b\cdot u(x)) \cdot H(x)$. – kramerfreenow Oct 22 '16 at 23:01
• Is that not the same thing if the domain is (0,1)? – Ian Oct 22 '16 at 23:04
• $H(x)$ is not the heaviside step function, it's a function switching from -1 to 1 at a certain fixed point $x_0$ in the range $0 < x < 1$. Sorry for the confusing notation, it isn't mine. – kramerfreenow Oct 22 '16 at 23:13