I would like to know how Dirichlet conditions are normally applied when using the finite volume method on a cell-centered non-uniform grid,
My current implementation simply imposes the boundary condition my fixing the value of the first cell,
$$ \phi_1 = g_D(x_L) $$
where $\phi$ is the solution variable and $g_D(x_L)$ is the Dirichlet boundary condition value at the l.h.s. of the domain (NB $x_L \equiv x_{1/2}$). However this is incorrect because the boundary condition should fix the value of the cell face not the value of the cell itself. What I should really apply is,
$$ \phi_{L} = g_D(x_L) $$
For example, lets solve the Poisson equation,
$$ 0 = (\phi_x)_x + \rho(x) $$
with initial condition and boundary conditions,
$$\rho=-1\\ g_D(x_L)=0 \\ g_N(x_R)=0$$
(where $g_N(x_R)$ is a Neumann boundary condition on the right hand side).
Notice how the numerical solution has fixed the value of the cell variable to the boundary condition value ($g_D(x_L)=0$) at the left hand side. This has the affect of shifting the whole solution upwards. The effect can be minimized by using a large number of mesh points but that is not a good solution to the problem.
Question
In what ways are Dirichlet boundary conditions applied when using the finite volume method? I assume I need to fix the value of $\phi_1$ by interpolating or extrapolating using $\phi_0$ (a ghost point) or $\phi_2$ such that the straight line going through these points has the desired value at $x_L$. Can you provide any guidance or an example of how to do this for a non-uniform cell-centered mesh?
Update
Here is my attempt at using a ghost cell approach you suggested, does it look reasonable?
The equation for cell $\Omega_1$ is (where $\mathcal{F}$ represents the flux of $\phi$),
$$ \mathcal{F}_{3/2} - \mathcal{F}_{L} = \bar{\rho}$$
We need to write $\mathcal{F}_{L}$ in terms of the boundary condition using a ghost cell $\Omega_0$,
$$\mathcal{F}_{L} = \frac{\phi_1 - \phi_0}{h_{-}} \quad\quad \text{[1]} $$
But we ultimately need to eliminate the $\phi_0$ term from the equation. To do this we write a second equation which is the linear interpolation from the centre of cell $\Omega_0$ to the centre of cell $\Omega_1$. Conveniently this line passes through $x_L$, so this is how the Dirichlet conditions enters the discretistaion (because the value at this point is just $g_D(x_L)$),
$$g_D(x_L) = \frac{h_1}{2h_{-}}\phi_0 + \frac{h_0}{2h_{-}}\phi_1 \quad\quad \text{[2]}$$
Combining equations 1 and 2 we can eliminate $\phi_0$ and find an expression for $\mathcal{F}_L$ in terms of $\phi_1$ and $g_D(x_L)$,
$$\mathcal{F}_L = \frac{1}{h_{{-}}} \left(\phi_{1} - \frac{1}{h_{1}} \left(2 g_{D} h_{{-}} - h_{1} \phi_{1}\right)\right)$$
Assuming that we are free to choose the volume of the ghost cell we can set $h_0 \rightarrow h_1$ to give,
$$ \mathcal{F}_L = -\frac{2 g_{D}}{h_{1}} + \frac{2 \phi_{1}}{h_{{-}}} $$
This can be simplified further because if the cells $\Omega_0$ and $\Omega_1$ are the same volume then we can set $h_{-}\rightarrow h_1$ finally giving,
$$ \mathcal{F}_L = \frac{2}{h_{1}} \left( \phi_1 - g_D \right) $$
However, this approach has recovered the definition that is unstable so I'm not too sure how to proceed? Did I interpret your advice incorrectly (@Jan)? The strange thing is that is seems to work, see below,
See below, it works,