# A smooth bump function with Neumann boundary condition

real-analysis

Let $$d \ge 2$$ be a positive integer. Let $$\Phi\colon \mathbb{R}^{d-1} \to \mathbb{R}$$ is $$C^3$$-function with $$\Phi(0)=0.$$ We define a unbounded domain $$D \subset \mathbb{R}^d$$ by
\begin{align*} D=\{x=(x_1,\ldots,x_{d-1},x_d) \in \mathbb{R}^d\mid x_d>\Phi(x_1,\ldots,x_{d-1})\}. \end{align*}

Let $$a \in \overline{D}$$ and $$r \in (0,1]$$ such that $$B(a,r) \cap \partial D\neq \emptyset.$$ Here, $$B(a,r)$$ denotes a open ball centered at $$a$$ with radius $$r$$.

I am looking for a function $$f\colon \mathbb{R}^d \to \mathbb{R}$$ with the following property:

1. $$f$$ is nonnegative and $$0< f \le 1$$ on $$D \cap B(a,r)$$,
2. $$f$$ is compactly supported and smooth (more precisely, $$f \in C^3(\overline{ D})$$),
3. $$f$$ satisfies the Neumann boundary. That is, for any $$x \in \partial D$$, we have
$$\langle \nabla f(x),\nu(x) \rangle=0.$$ Here, $$\nu(x)$$ denotes the inward unit normal vector at $$x \in \partial D.$$

Can we construct such a function $$f$$?

If $$D$$ is the half space, I can construct such a function. Indeed, we take a smooth function $$g\colon \mathbb{R}^d \to \mathbb{R}$$ such that $$g=1$$ on $$B(a,r)$$ and $$g=0$$ outside $$B(a,2r)$$. For $$x=(x_1,\ldots,x_{d-1},x_d)$$, we let $$\hat{x}=(x_1,\ldots,x_{d-1},-x_d)$$. Then,
\begin{align*} f(x)=\{g(x)+g(\hat{x})\}/2, \quad x \in \mathbb{R}^d \end{align*}
satisfies the all requirements.

In my opinion the difficult component of this problem is interpreting the 3rd condition $$\vec\nabla f \cdot\vec\nu=0$$ visually as the requirement of $$f(\vec{y})$$ for $$y\in\mathbb{R}^d$$ to be increasing only in the direction normal to $$\vec\nu$$, hence tangent to the surface defined by $$\Phi(\vec x)$$ for $$x\in\mathbb{R}^{d-1}$$

We can do this very simply by defining a cylindrical frame that varies with $$\vec y$$ such that $$\vec \nu$$ defines the polar/vertical direction. We see that the tangent plane for $$\Phi$$ in $$\mathbb{R}^d$$ is actually the $$\mathbb{R}^{d-1}$$ subspace defined by: $$\vec\rho_x=\left(\frac{\vec\nabla_x\Phi}{\|\vec\nabla_x\Phi\|},\|\vec\nabla_x\Phi\|\right)$$

where $$\vec\nabla$$ is the usual gradient operator on Euclidean space. When normalized, this frame becomes

$$\hat\rho_x=\frac{1}{\|\vec\nabla\Phi\|\sqrt{1+\|\vec\nabla\Phi\|^2}}\;\left(\vec\nabla\Phi,\,\|\vec\nabla\Phi\|^2\right)$$ $$\hat z_x=\vec\nu(x)$$

Technically, this is not a full frame, since we would need another set of $$d-2$$ vectors that are orthonormal with both $$\hat\rho$$ and $$\hat\nu$$. However this does not prevent us from writing the usual test function, normalized by the maximum diameter of the ball, on $$\mathbb{R}^d$$ that merely depends on $$\rho$$ and not the other $$d-2$$ directions:

$$f_x(y)=\exp\left(-\frac{1}{1-(\rho_x/2)^2}\right)$$

where the covector $$\rho_x$$ is dual to $$\hat\rho_x$$ such that $$\rho_x(\hat\rho_x)=1$$ and $$\rho_x(\hat z_x)=0$$