# Discretise this transport equation

I am trying to discretise the PDE: $$\phi \frac{\partial c}{\partial t}+\frac{\partial j}{\partial x}=0$$ where $c$ is a function of $x$ and $t$, and $j=qc-D(q)\frac{\partial c}{\partial x}$, $q$ is the Darcy flux (function of $x$ and $t$) and $D(q)$ is the coefficient of diffusion/dispersion, and $\phi$ is a constant.

over the interval $(x_{i-1/2}, x_{i+1/2})$

My Progress

\begin{align*} &\phi \frac{\partial c}{\partial t}+\frac{\partial j}{\partial x}=0 \\ &\Rightarrow \frac{\partial c}{\partial t}+\frac{\partial}{\partial x}\left(\frac{qc}{\phi}-D(q)\frac{\partial c}{\partial x}\right)=0 \\&\Rightarrow \frac{\partial}{\partial t}\int_{x_{i-1/2}}^{x_{i+1/2}}c \ dx \ +\left|\frac{qc}{\phi}-D(q)\frac{\partial c}{\partial x}\right|_{x_{i-1/2}}^{x_{i+1/2}}=0 \end{align*}

What do I do to simplify the expression in terms of the values of the $c_i, q_i$ terms. (I am trying to get matlab to run this iteratively).

Conventions

$x_i$ is the midpoint of the $i$th interval.

$\delta x$ is the length of the interval.

$$f_i=\frac1{\delta x}\int_{x_{i-1/2}}^{x_{i+1/2}}f \ dx$$