Let $\mathcal{L}$ be a second-order, linear, elliptic differential operator acting on $\mathcal{C}^2([0,\infty)^2)$.

I'm numerically solving the inhomogeneous PDE
\begin{align*}
\mathcal{L}u(x,y)+(x-1)^+=0,
\end{align*}
where $(\cdot)^+$ denotes the positive part.


Approximating  all partial derivatives by _central_ differences, I get the FD scheme
\begin{align*}
c_1 u_{i-1,j-1} + c_2 u_{i,j-1} + c_3 u_{i+1,j-1} + c_4 u_{i-1,j} + c_5 u_{i,j} &\\
  + c_6 u_{i+1,j}+ c_7 u_{i-1,j+1} + c_8 u_{i,j+1} + c_9 u_{i+1,j+1} + (x_i-1)^+ &=0.
\end{align*}

## Problem ##
Plotting the solution $u$, it all looks fine and perfect. However, a plot of $\frac{\partial u}{\partial x}$ as a function of $x$ shows that there's a **small kink** at $x=1$. The above FD scheme seems to work fine with value-matching (the solution $u$ looks appears perfectly continuous) but struggles with smooth-pasting at $x=1$.

**Question:** How do I ensure smooth-pasting with the FD scheme? I tried to impose that forward and backward differences at $x=1$ equal each other (= 2nd order central difference is zero) but it didn't do the trick.

**Note:** This problem arises as part of a larger system of free boundary problems. Thus, it's necessary to solve the PDE numerically.