TITLE: How to define weak solution for an elliptic PDE with non-zero Dirichlet boundary condition?
QUESTION [15 upvotes]: For homogeneous Dirichlet boundary condition, for example
$$
\left\{\!\!
\begin{aligned}
&-\Delta u+c(x)u=f(x),x\in\Omega\\
&u|_{\partial\Omega}=0
\end{aligned}
\right.
$$
The weak solution is defined as a function $u\in H_0^1(\Omega)$ satisfying
$$
\int_\Omega\left(\sum_{i=1}^n\frac{\partial u}{\partial x_i}
\frac{\partial v}{\partial x_i}+c(x)uv\right)\,dx=\int_\Omega fv\,dx
$$
for every $v\in H_0^1(\Omega)$.
I wonder how to define weak solution for an elliptic PDE with non-zero Dirichlet boundary condition.
For example,
 $$
\left\{\!\!
\begin{aligned}
&-\Delta u+c(x)u=f(x),x\in\Omega\\
&u|_{\partial\Omega}=g
\end{aligned}
\right.
$$
Evans's Partial Differential Equations (1st edition, Section 6.1.2) says:

... is is necessary for $g$ to be the trace of some $H^1$ function, 
  say $w$. But then $\tilde u:=u-w$ belongs to $H_0^1(\Omega)$, and is a
  weak solution of the boundary-value problem
  $$
\left\{\!\!
\begin{aligned}
&-\Delta \tilde u+c(x)\tilde u=\tilde f(x),x\in\Omega\\
&\tilde u|_{\partial\Omega}=0
\end{aligned}
\right.
$$
  where $\tilde f:=f-(-\Delta w+c(x)w)$

The problem is: how to find the function $w$, in a constructive way?
Can you please help? Thank you.

REPLY [12 votes]: I ran across this old question and I would like to say something about it. While the point of view provided by Willie Wong is satisfactory, there is a theory of "inverse traces" which answers OP's question in bold more or less directly. For an example, have a look at the following theorem taken from Kufner, John, Kufcik, "Function Spaces".

6.9.2 Theorem Let $p>1$ and $\Omega\in C^{0, 1}$ [meaning that its boundary is Lipschitz and bounded]. Then there exists a continuous linear mapping $T$ from $W^{1-1/p, 1}(\partial \Omega)$ into $W^{1,p}(\Omega)$ such that for $v=Tu$ we have $v=u$ on $\Omega$ [in trace sense]. 

The idea of the proof is simpler than one might expect (at least, it is simpler than I expect). Suppose that $$\Omega=\mathbb{R}^{n+1}_+=\{(x, t)\in \mathbb{R}^n\times \mathbb{R}\ :\ t>0\}.$$
If you have a function $u\in C^{\infty}_0(\mathbb{R}^n)$ you can construct a function $v\in C^\infty(\mathbb{R}^{n+1}_+)$ by convolution against the heat kernel:
$$v(x,t)=\frac{1}{(4\pi t)^{n/2}}\int_{\mathbb{R}^n} e^{-\frac{\lvert x-y\rvert^2}{4t}}u(y)\, dy.$$
Then the trace of $v$ on the boundary $\{t=0\}$ is $u$, as we already know. 
If $\Omega$ is a domain with a nice enough boundary, we can use charts to perform this construction locally and then patch everything up with a partition of unity. This is the idea. Unfortunately, there are some technical difficulties which require the introduction of the cumbersome fractionary order Sobolev spaces $W^{1-1/p, p}$.