Modelling particle diffusion in a scalar potential field

21 Views Asked by At

I'm currently trying to write a program that models 1D particle diffusion in a potential field. The model itself consists of a 1D array of equally spaced cells where each cell has a (time-varying) potential level $U_{x,t}$ and particle concentration $C_{x,t}$. I'm trying to figure out how to write a transition function that takes the current potential and concentration values and produces the concentration values at the next timestep. I've come to understand that in the continuous-time, continuous-space scenario, concentration $C$ evolves in the static scalar potential $U$ according to the equation (found here): $$\frac{\partial C}{\partial t} = D\left[\frac{\partial^2C}{\partial x^2}-\frac{\partial}{\partial x}\left[\frac{C}{k_BT}\left(\frac{\partial U}{\partial x}\right)\right]\right]$$ $D$, $k_B$ and $T$ are constants that I can tune later, and don't particularly care about right now. I'm struggling to see how I can apply this equation to my discrete-space version, though, since I only have a notion of derivative between cells and not at the cells themselves. That is, I'm not sure how I'd evaluate evaluate $\frac{\partial U}{\partial x}$ and $\frac{\partial C}{\partial x}$. Ideally, at each timestep I can generate a discrete kernel for cell $x$, depending on $C_x$, $\Delta t$ and the difference between $U_x$ and neighbouring $U$ values, that I can then convolve with an impulse of height $C_x$ at $x$ so that the convolution of all the kernels and impulses at each $x$ provides the $C_x$ for the next timestep. Any guidance would be awesome, thanks!