The solution of Poisson equation and the distance function from the boundary Let $D$ be a domain in $\mathbb{R}^n$, and let $u$ be the solution to the Poisson equation, that is
$$   \begin{cases}
                                   \Delta u = f &   \text{in} ~ D, \\
                                   u=0 & \text {on} ~ \partial D, 
  \end{cases}   
$$
for some function $f \in C(D)$ (the function which is identically $1$ on $D$ could be a good candidate for $f$). Is the values of $u(x)$ comparable to the distance function to the boundary, that is $ \delta (x)= \mathrm{dist} (x , \partial D) $? I think of an inequality of (boundary) Harnack type. I have not made any regularity assumption (on $\partial D$, or the function $f$), such assumptions can be applied if necessary.
 A: Let us assume some regularity on $\partial D$ (bounded and $C^2$ suffices). Then the problem above has a unique solution $u \in W^{2,p}(\Omega) \cap W^{1,p}_0(\Omega)$ for every $p<\infty$ and taking $p>n$ we get $\|\nabla u\|_\infty \le C\|f\|_\infty$. Therefore the upper estimate $|u(x)| \le C\|f\|_\infty \delta (x)$ always holds. The lower estimate does not hold for every $f$ (take $u$ with support far away from $\partial D$ and $f=\Delta u$). However it holds if $-\Delta u=f$ (note the minus sign) and $f \geq c >0$. In fact, by the regularity assumption on $D$, $\Delta \delta \geq -\kappa$ in $D$ and then $-\Delta (u-\epsilon \delta)=f+\epsilon \Delta \delta \geq c-\epsilon \kappa \geq 0$ for small $\epsilon$. By the maximum principle $u-\epsilon \delta \geq 0$, which gives the lower estimate.
EDIT: The lower estimate holds assuming only that $-\Delta u= f \geq 0$ and $u\neq 0$. In fact, $u(x)>0$ for every $x \in D$, by the strong maximum principle and then $\frac{\partial u}{\partial \nu}(x_0)<0$ for every $x_0 \in \partial D$, by Hopf Lemma ($\nu$ is the unit exterior normal). The minimum of $\frac{\partial u}{\partial \nu}$ on $\partial D$ is then strictly negative and form this one obtains the lower bound.
A: You can use Feynman-Kac formula:
$$ u(x) = -\mathbb{E}_x\int_0^T f(X_t)dt$$where $X_t$ is a Brownian process starting at $x$ and $T$ the stopping time  $T=\inf\{t\geq 0:X(t)\in \partial D\}$.  So $u(x)$ is essentially given by the expected time for the process to get out of $D$. For example if $\epsilon \leq f\leq M$ we get $$ \epsilon\mathbb{E}_x(T)\leq -u(x) \leq M \mathbb{E}_x(T).$$
Consider the case $\partial D$  smooth around a point $x_0$. As a simplification we suppose that locally $D=\mathbb{R}_+\times\mathbb{R}^{n-1}$, $x_0 = (0,\cdots,0)$ and $x=(\delta,0,\cdots,0)$ with $\delta>0$ and $X_s = (x+B_s^{(1)},B_s^{(2)},\cdots,B_s^{(n)})$, where $B^{(i)}$ are iid Brownian motion. In that case it is easy to gives the escape time of $X$: we have $$\mathbb{P}_x(T>t)=\mathbb{P}_x(\inf_{0\leq s\leq t} B_s^{(1)} > - \delta) = 1-2\mathbb{P}_x(B_t^{(1)}<-\delta) \approx \frac{2\delta}{\sqrt{2\pi t}} $$ (see reflection) and then
$$ \mathbb{E}_x(T)= \mathbb{E}_x(\int_0^\infty 1_{t< T}dt)=\mathbb{E}_x(\int_0^1 1_{t< T}dt)+\mathbb{E}_x(1_{T>1}\int_1^\infty 1_{t\leq T}dt) \\ = \int_0^1 \mathbb{P}_x(t< T)dt+\mathbb{P}_x(T>1) \mathbb{E}_x\left( \int_1^\infty 1_{t\leq T}dt|T>1\right) 
\approx \delta C$$
for some $C>0$.
If the boundary is not regular at $x_0$, it can be possible for the process to avoid $\partial D$ such that $\mathbb{P}(T>1)$ is bounded away from $0$ (or decay very slowly) as $x\rightarrow x_0$ and then $u(x)$ is no more comparable with $d(x,\partial D)$. This lead to a nice physical phenomena call " Effet de pointe" that  occures in Lightning rod.
