# Are we free to choose the position of ghost cells on a non-uniform finite-volume mesh?

Following Hundsdorfer approach the finite volume discretisation of the advection-diffusion equation (conservative form) on non-uniform cell centered grid can be written as,

$$w_j^{\prime} = \frac{w_{j-1}}{h_j}\left( \frac{ah_j}{2h_{-}} + \frac{d}{h_{-}} \right) - \frac{w_j}{h_j}\left( \frac{a}{2}\left[ \frac{h_{j-1}}{h_{-}} - \frac{h_{j+1}}{h_{+}} \right] + d\left[-\frac{1}{h_{-}} - \frac{1}{h_{+}} \right]\right) + \frac{w_{j+1}}{h_j}\left(- \frac{ah_j}{2h_{+}} + \frac{d}{h_{+}} \right)$$

I am having trouble implementing this stencil because the edge terms have a dependence on the position of ghost cells which are outside of the domain.

For example, if we write the equation at the left hand side boundary (this corresponds to cell centre $x=x_1$), $$w_1^{\prime} = - \frac{w_1}{h_1}\left( \frac{a}{2}\left[ \frac{h_{0}}{h_{-}} - \frac{h_{2}}{h_{+}} \right] + d\left[-\frac{1}{h_{-}} - \frac{1}{h_{+}} \right]\right) + \frac{w_{2}}{h_1}\left(- \frac{ah_1}{2h_{+}} + \frac{d}{h_{+}} \right)$$

N.B. The terms in the first bracket depend on the position of the ghost point. To make this clear see the diagram below and notice that the $h_0$ and $h_{-}$ term stray outside of the domain.

Am I free to choose the position and size of the ghost cell? For example,

1. Can I set $h_{-}\equiv h_{+}$?
2. Or, can I set $h_{-}=0$?

Regarding the latter, does it make sense to have a cell with zero volume? This would mean that the cell "center" and vertex coincide.

The value of the variable at the ghost point ($w_0$) is never used in numerical methods (this is clear!). However, the stencil above would seem to imply that we must at least choose a location and size for the ghost cell and this must be included in the discretisation. Is that assessment correct?

Including an actual ghost cell for FVM discretization is more or less a matter of convenience. For instance, if the boundary condition on the wall is a Neumann type, you actually do not need to discretize in the $x^-$ direction since the flux is given by the boundary condition and is known.
If the boundary condition is of Dirichlet type, what you need is to approximate the flux using the interior point(s) and the value on the boundary. In the simplest case, this would result from a simple linear extrapolation using $x_1$ and the wall point $x_w$. This effectively means that the value of the flux will be independent of the location of the ghost cell (slope of the extrapolating function for a simple linear method).
Given this observation, I'd say anything but $h^- = 0$ would be good. I always personally choose $h^- = h^+$ as that makes life easier!
• I think I may ask a follow up question about writing the boundary conditions. Actually before I posted this question I tested what would happen by applying Dirichlet and Neumann conditions. I realised that I could eliminate the ghost cell value ($w_0$), however I don't think that I can eliminate the dependence on (in this case) $h_{-}$ and $h_{0}$. Are you saying that for the above stencil the discretisation need not include these points? I don't follow how? In any case, if it is "safe" to assume $h_{-}=h_{+}$ then I think I understand how to implement. – boyfarrell Jun 12 '13 at 12:48