I'm trying to better understand finite volume methods and have started coding up a basic script to solve the diffusion equation $$u_t = u_{xx}$$ which has the finite volume form: $$\frac{\bar{u}^{n+1}_i\ - \bar{u}^n_i }{\Delta t} = \hat{F}_{i+\frac{1}{2}}^n - \hat{F}_{i-\frac{1}{2}}^n$$ where $\bar{u_i}$ is the average value of $u$ over cell $i$ and $\hat{F}$ is the numerical approximation to the flux at a cell interface.

I am using an ENO approximation in order to reproduce the point values $u$ and the derivative values $u_x$ as well. I'm aware of the ENO method to reproduce the numerical flux at each cell, however, I'm confused on how I can implement no flux boundary conditions using this method. Instead, here's what I've tried:

Using my array of known averages, $\bar{u}_i^n$, construct two coefficient matrices. One that approximates the value of the flux, $u_x$, at the left cell interface (which I'll call $L$) and one approximates it at the right cell interface (which I'll call $R$), giving me an equation that looks like $$\bar{u}^{n+1}_i = \bar{u}^n_i - \frac{\Delta t}{\Delta x}(R-L)\bar{u}^n_i$$. This allows me to just make the coefficients of the first row of $L$ and the last row of $R$ all zeros in order to implement no flux boundary conditions. However, when doing it this way, I seem to get something that is obviously non-conservative after I advance one time step:

$u$ after a timestep of .01 with initial condition $u(x,0) = erfc(x)$

This is clearly due to my implementation of the flux conditions, as the interior nodes all give correct values within the prescribed error.

Does anyone know how to solve this problem?

  • $\begingroup$ Can you define explicitly what you mean by "flux"? How does it relate to $u$? $\endgroup$ – nukeguy Mar 9 '17 at 21:58
  • $\begingroup$ We call $\hat{F}$ the flux because 1. it has the units of $\frac{concentration}{area * time}$ and 2. because that's what we refer to as the quantity $F$ such that $u_t = F(u)_x$. Thus, in this case $F(u)$ takes the form of $u_x$. Starting from the original form of the equation, $u_t = u_{xx}$ we can try and solve this equation in a cell $(x_{i+\frac{1}{2}},{x_{i-\frac{1}{2}})$. If we integrate this equation over the cell, we get $\bar{u}_t = \hat{F}_{i+\frac{1}{2}} - \hat{F}_{i-\frac{1}{2}}.$ $\endgroup$ – hijasonno Mar 9 '17 at 22:25
  • $\begingroup$ So $\hat{F}$ is an approximation of $u_x$ in your method? Forgive my ignorance, I'm not very experienced with finite volume methods and their terminology. Could you provide more details on how you came up with the equation with $R$ and $L$? It seems to me that the units don't quite work out there. $\endgroup$ – nukeguy Mar 9 '17 at 22:53
  • $\begingroup$ No worries. Are you familiar with ENO methods of reconstruction? If not, you can find more here: [link]mat.univie.ac.at/~obertsch/literatur/eno.pdff. It's essentially a way of interpolating given averages over a couple of cells. I put these coefficients in the matrices for $L$ and $R$ and then multiply them at each time step by $\bar{u}$ in order to get approximations to $u_x$ (and hence the flux) at each timestep. $\endgroup$ – hijasonno Mar 9 '17 at 23:05
  • $\begingroup$ Well, $(R-L)\bar{u}$ is supposed to approximate $u_x$ which would give it the right units I believe. $\endgroup$ – hijasonno Mar 10 '17 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.