# Finite-volume method applied to a particular advection equation

I'm trying to apply the finite-volume method (FVM), with which I'm not so familiar, so a simple 1D PDE equation. I already asked this question in the math stackexchange, but was told that it could be a better fit here.

The equation I want to solve is, to simplify, $$\frac{\partial U}{\partial t} + A\left(x\right) \frac{\partial}{\partial x}\left(\frac{F(U)}{A(x)}\right) + \frac{\partial G(U)}{\partial x} = 0.$$

where $U$ is my unknown, $F$ and $G$ some flux functions computed from $U$ and $A$ a function of $x$, that is strictly positive and very smooth. Most of the time, I can actually assume $A$=constant, and therefore the equation becomes $$\frac{\partial U}{\partial t} + \frac{\partial(G(U)+F(U))}{\partial x} = 0,$$ which is straightforward to solve using FVM.

However, I'm not sure how to handle the case where $A$ is not constant. My idea was, when applying the integration step of the finite volume method, to write $$\int_{\text{cell}} A\left(x\right) \frac{\partial}{\partial x}\left(\frac{F(U)}{A(x)}\right) \mathrm{d}\Omega \approx \bar{A} \int_{\text{cell}} \frac{\partial}{\partial x}\left(\frac{F(U)}{A(x)}\right) \mathrm{d}\Omega$$ where $\bar{A}$ is the mean value of $A$ over the considered cell. Once fully discretized, this term would therefore end up looking like

$$\bar{A}_{i} \left( \frac{1}{\Delta x} \left( \frac{F_{i+1/2}}{A_{i+1/2}} - \frac{F_{i-1/2}}{A_{i-1/2}} \right) \right).$$

Does it make sense, or is it completely wrong? Is there a better way to proceed?

I tried changing the coordinate, but I'm not familiar enough with that, and of course I'd like to keep the $\dfrac{\partial G(U)}{\partial x}$ term as it is.

Thanks a lot for any inputs and advices on how to deal with this kind of problem.

• How well do you know A, e.g. is it algebraic? Feb 9, 2018 at 14:46
• In a general way, I know the values of $A$ on the cell-centers. For the cell faces, I planned to used $$A_{i+1/2} = \frac{1}{2} \left( A_i + A_{i+1} \right)$$ Feb 9, 2018 at 14:48

Generically, you can build yourself a finite volume model by integrating the equation over a fixed cell. In this case we can use integration by parts to write that in $n$ dimensions, and for a cell $C$ bounded by a contour, $\delta C$.
$$\frac{\partial}{\partial t} \int_C U d\mathbf{x} = -\int_{\delta C} \mathbf{F}(U)+\mathbf{G}(U)\cdot\mathbf{n} dS +\int_C \frac{\mathbf{F}(U)}{A}\cdot\nabla A d\mathbf{x}.$$
Comparing this to the constant $A$ case, you have an additional source/sink for your tracer, which in 1D looks like $$F(U)\frac{1}{A}\frac{\partial A}{\partial x},$$ which you can discrete using normal cell centred finite differences for the derivative. This actually impacts more on your time stepping scheme, since for sinks ($\frac{\partial F}{\partial U}\frac{\partial A}{\partial x}$ negative) you may want to consider an implicit method in the case that $U$ needs to stay bounded.