I wish to solve a coupled system of non-linear equation of this form,
$$ u_t = -(\mathcal{F})_x + f(x,u,w) \\ w_t = \mathcal{F} + g(x,u,w) $$
by stepping the equations forward in time. The first equation is the advection-diffusion equation with non-linear reaction term, and where the flux has the definition,
$$\mathcal{F}=au-du_x$$
First equation
It is straight forward to write this using the finite volume method,
$$ \int_{\Omega}u_t~dx = -\int_{\Omega}(\mathcal{F})_x~dx + \int_{\Omega}f(x,u,w)~dx \\ \tilde{u}_t = \frac{1}{h_j}\left( -\mathcal{F}_{j+\frac{1}{2}} + \mathcal{F}_{j-\frac{1}{2}} \right) + \tilde{f}(x_j,u_j,w_j) $$
where $h_j$ is the width (not volume because I am considering 1D only) of the $j$-th cell.
Second equation
However, how should the second equation be written, can I do the following?
$$ \int_{\Omega}w_t~dx = \int_{\Omega}\mathcal{F}~dx + \int_{\Omega}g(x,u,w)~dx \\ \tilde{w}_t = \frac{1}{h_j}\mathcal{F}_jh_j + \tilde{g}(x_j,u_j,w_j) $$
Moreover, if we assume that the flux in the $j$-th cell is constant across the cell then the integral becomes,
$$ \int_{\Omega}\mathcal{F}~dx = \mathcal{F}_jh_j $$
This is simply base $\times$ height of the cell, but because I want to know the cell average values I divide again by the cell width. Finally I get the following for the second equation,
$$ \tilde{w}_t = \mathcal{F}_j + \tilde{g}(x_j,u_j,w_j) $$
Q1. Is this correct?
In terms of implementation I know 3 of the terms in $\mathcal{F}_j$, they are:
- $a_j$, the cell advection velocity,
- $d_j$, the cell diffusion coefficient,
- $u_j$, the cell mass concentration,
However, $u_x$ is not known.
Q2. Can I simply write $u_x$ using the values of concentration interpolated to the cell faces? For example,
$$ u_x = \frac{1}{h_j}\left( u_{j+\frac{1}{2}} - u_{j-\frac{1}{2}} \right) $$
This doesn't seem quite right because I was taught that in the finite-volume method, concentrations are defined in the cells and fluxes are defined on the faces.
Update
Regarding definition of fluxes.
For the first equation I define the fluxes as,
$$ \mathcal{F}_{j+\frac{1}{2}} = a_{j+\frac{1}{2}}\left( \frac{h_{j+1}}{2h_{+}} u_j + \frac{h_j}{2h_{+}} u_{j+1} \right) - d_{j+\frac{1}{2}} \frac{u_{j+1}-u_j}{h_{+}} $$
$$ \mathcal{F}_{j-\frac{1}{2}} = a_{j-\frac{1}{2}}\left( \frac{h_{j}}{2h_{-}} u_{j-1} + \frac{h_{j-1}}{2h_{-}} u_{j} \right) - d_{j-\frac{1}{2}} \frac{u_{j}-u_{j-1}}{h_{-}} $$
where $h_j$ is the cell width, and $h_{\pm}$ are the centroid distances in the forward and backward direction.
Here linear interpolation is used to define the variable at the cell faces $u(x_{j-1/2})$ and $u(x_{j+1/2})$, and forward difference and backward difference is used to define $u_x(x_{j+1/2})$ and $u_x(x_{j-1/2})$. This gives a central discretisation for both the advection and diffusion terms (however, upwinding can still be introduced easily).
However for the second equation the flux is not defined on the cell's left and right face, it is defined as the cell average, so I need to use a different definition for,
$$ \mathcal{F}_j = a(x_j)u(x_j) - d(x_j)u_x(x_j) $$
Clearly, $a(x_j)$, $u(x_j)$, and $d(x_j)$ are already known. The only term than needs defining for the second equation is $u_x(x_j)$. So maybe I could use,
$$ u_x(x_j) = \frac{1}{h_j}\left( u_{j+1/2} - u_{j-1/2} \right) $$
with linear interpolation, which as you pointed out would give a second order accurate central difference.
Could I also use?
$$ u_x(x_j) = \frac{1}{h_{+}}\left( u_{j+1} - u_{j} \right) $$
In my comment below, this is what I was getting at. How do define the $u_x(x_j)$ for the second equation, what are the pros. and cons. of using a central or upwinding scheme for this term.