I'm looking for conditions for a function $u$ defined on a bounded domain $\Omega\subset\mathbb{R}^n$ to be an element of the Sobolev space $H^2(\Omega)$. I heard the other day that if $u$ is harmonic and satisfies Dirichlet boundary conditions then it is automatically in $H^2(\Omega)$, and a similar result holds for Neumann boundary conditions. Is this true, and if so, where might I find such a result proved? (Googling yields little of use, unfortunately.)
If it is not, can anybody point me to any conditions they know of? Excluding, of course, the trivial $H^2(\Omega)\subset H^2(\Omega)$!
One needs to assume something about the regularity of the boundary and of the boundary data. Simply saying "satisfies Dirichlet boundary conditions" is not useful without further information on the boundary data.
Example
Let $\Omega\subset \mathbb{R}^2$ be the unit disk. Thinking of $\mathbb{R}^2$ as complex plane $\mathbb{C}$, let $u(z) = \operatorname{Re}((1-z)^{p})$ where $0<p<1$. This is a harmonic function in $\Omega$, and is continuous on $\overline{\Omega}$. However, it's not in $H^2(\Omega)$. Indeed, its second derivatives behave like $|1-z|^{p-2}$ near $1$, and since $2(p-2)<-2$, they are not square-integrable.
Regularity theorems
A standard reference is Theorem 8.12 in Gilbarg-Trudinger, which asserts that $u\in H^2(\Omega)$ if it solves the PDE $\Delta u=f$ with boundary conditions $u=g$ where
The latter assumption is most troublesome to check, unfortunately. It is used to subtract off such $H^2$ function and then deal with homogeneous boundary condition.
Another reference is section 6.3.2 in PDE by Evans; he immediately goes to the homogeneous case.