I am solving the equation $$ \frac{\partial \phi}{\partial t} = \frac{\partial}{\partial x} \left( D \frac{\partial \phi}{\partial x} + v\phi \right) $$ using finite differences. I want to include Robin boundaries, that is, boundaries that are closed to both advection and diffusion. I read this excellent question on it:

Conservation of a physical quantity when using Neumann boundary conditions applied to the advection-diffusion equation

However, the actual solution to the problem is not given there. Robin boundary conditions on the left edge of the domain should read $$ \Big(D \frac{\partial \phi}{\partial x} + v\phi \Big)|_{x=0} = j_\mathrm{robin} = 0 $$ I have tried discretizing this as $$ D \frac{\phi_2-\phi_0}{\Delta x} + v\phi_1 = j_\mathrm{robin} $$ With a fictious cell with index 0 outside of the domain.

I can reorder this to get $$ \phi_2 - (j_\mathrm{robin} - v \phi_1) \frac{2 \Delta x}{D} = \phi_0 $$ The discretized equation for the left cell - with the usual 2nd order central scheme for the diffusion term and a central scheme for the advective scheme - reads

$$ \frac{\phi_1^{(t+1)}-\phi_1^{(t)}}{\Delta t} = \frac{D}{\Delta x^2} \Big(\phi_0 - 2 \phi_1 + \phi_2 \Big) + \frac{v}{2\Delta x}(\phi_2 - \phi_0) $$ I have omitted the upper indizes for the terms on the right hand side - I use an higher-order explicit scheme. We can eliminate the values for the index 0, yielding

$$ \frac{\phi_1^{(t+1)}-\phi_1^{(t)}}{\Delta t} = \frac{2D}{\Delta x^2} (\phi_2 - \phi_1) + (j_\mathrm{robin} - v\phi_1)(\frac{v}{D}-\frac{2}{\Delta x}) $$

I have tried this, basically with a Gaussian traveling into the domain boundary, and while there is a notable difference between this and the Neumann boundary (that would not be closed to advection) I nevertheless lose all mass. My question is basically whether or not this is the right approach to begin with. Thank you!

  • $\begingroup$ I think you might have left off a derivative in your first equation -- did you mean to write $$\frac{\partial\phi}{\partial t} = \frac{\partial}{\partial x}\left(D\frac{\partial\phi}{\partial x} + v\phi\right)$$ $\endgroup$ May 13, 2022 at 17:01
  • $\begingroup$ @DanielShapero ah, sorry, sure I did! $\endgroup$
    – rugermini
    May 16, 2022 at 6:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.