Let's consider the one-dimensional ODE: $$ u_{,xx}(x)+1=0,\quad \forall x\in ]0,\ell[$$ together with the two Dirichlet boundary conditions $u(0)=0$ and $u(\ell)=0$.
The corresponding weak formulation is: Find $u\in H_0^1(0,\ell)$ such that $\forall v\in H_0^1(0,\ell)$: $$\int_0^\ell v_{,x}(x)u_{,x}(x)\,\mathrm{d}x=\int_0^\ell v(x)\,\mathrm{d}x$$
My question is on the fact that the test function $v$ has to belong to $H_0^1(0,\ell)$. I am aware that if $v\in H^1(0,\ell)$, then the weak formulation involves boundary terms in $vu_{,x}$ that are unknown, hence we specify $v\in H_0^1(0,\ell)$ to somehow get rid of them but:
- How do we know that, by doing so, we are not modifying the equivalence between the strong and weak formulations?
- If we rewrite the weak formulation as follows: Find $u\in H_0^1(0,\ell)$ such that $\forall v\in H^1(0,\ell)$: $$\int_0^\ell v_{,x}(x)u_{,x}(x)\,\mathrm{d}x=\int_0^\ell v(x)\,\mathrm{d}x+v(x)u_{,x}(x)\Big|_0^\ell$$ it cannot be solved, but why exactly? Is there some kind of operator that cannot be inverted (this is what happens in the discretized version)
To answer your second question: If $u$ belongs merely to $H_0^1(0,\ell)$, you have no chance to define $u_{,x}(0)$ and $u_{,x}(\ell)$ in a reasonable manner. So your weak definition is not well-defined.
To give an example: It is easy to verify that $u$ defined by $$u(x) = x^{2/3} \, (1-x)$$ belongs to $H_0^1(0,\ell)$ and its weak derivative is $$u_{,x}(x) = \frac23 \, x^{-1/3} \, (1-x) - x^{2/3}.$$ This weak derivative, however, has a singularity at $x = 0$ (and it would be easy to add another one at $x = \ell$).