I'm trying to solve the non-homogeneious heat equation using a finite difference scheme. The grid on which to solve this looks like this:
N N N N N N N N N
N N
N N
D D
D D
D D
N N
N N
N N N N N N N N N
where N denotes a homogeneous nNeumann boundary condition, and D denotes a Dirichlet condition (non-homogeneous)
To account for the Neumann boundary condition, I use the ghost point method (extending the grid one point further and approximating the first derivative with a central difference). For the left side, this leads to the equation $T_{-1,j} = T_{1,j}$, which can be substituted in the normal difference scheme. And as usual, this leads to second order accuracy. However, on the point where the Neumann and Dirichlet boundary conditions meet, I only get first order accuracy.
Are there any other ways to account for the the boundary condition that would avoid this problem?
PS: I have not provided the exact difference scheme because the formulas are rather long, but should they prove necessary, I can of course provide them.
Edit: I have found the reason for the decrease in accuracy, at the point where the boundaries meet, there is a discontinuity in the first derivative.
I managed to solve this by slightly altering the problem. In a small region around the edge of the two types of boundaries, I let the boundary condition vary linearly between the two types. This made the solution have a continuous derivative and solved the accuracy problem.