I have tried to set up a model for the diffusion of a gas into a liquid. The two media are next to each other and the geometry is spherical because the system should simulate the diffusion out of a gas bubble. I have made a diffusion model for the gas phase (the left compartment) and a corresponding diffusion model for the liquid phase (the right compartment). The two diffusion models are as follows: \begin{align} \frac{\partial c_\mathrm{left}}{\partial t} &= D_\mathrm{left} \cdot \frac{1}{r^2} \frac{\partial}{\partial r} \left(r^2 \frac{\partial c_{left}}{\partial r} \right)\\ \frac{\partial c_\mathrm{right}}{\partial t} &= D_\mathrm{right} \cdot \frac{1}{r^2} \frac{\partial}{\partial r} \left(r^2 \frac{\partial c_{right}}{\partial r} \right)\\ \end{align}

Then I have discretized the volume. So the PDEs are turned into ODEs of the form: \begin{align} \frac{\mathrm{d}c_{i,\mathrm{left}}}{\mathrm{d}t} &= D \left(\frac{c_{i+1,\mathrm{left}} - 2 \cdot c_i + c_{i-1,\mathrm{left}}}{\Delta r^2} + \frac{2}{r_{i,\mathrm{left}}} \cdot \frac{c_{i+1,\mathrm{left}} - c_{i-1,left}}{2 \cdot \Delta r} \right)\\ \frac{\mathrm{d}c_{i,\mathrm{right}}}{\mathrm{d}t} &= D \left(\frac{c_{i+1,\mathrm{right}} - 2 \cdot c_i + c_{i-1,\mathrm{right}}}{\Delta r^2} + \frac{2}{r_{i,\mathrm{right}}} \cdot \frac{c_{i+1,\mathrm{right}} - c_{i-1,\mathrm{right}}}{2 \cdot \Delta r} \right) \end{align}

When discretizing I got the following expressions: \begin{align} \frac{\mathrm{d}^2c_i}{\mathrm{d}r^2} &= \frac{c_{i+1} - 2 \cdot c_i + c_{i-1}}{\Delta r^2}\\ \frac{\mathrm{d}c_i}{\mathrm{d}r} &= \frac{c_{i+1} - c_{i-1}}{2 \cdot \Delta r} \end{align}

But how does one incorporate the following two boundary conditions at the gas-liquid-interface, where $H$ is Henry's constant? \begin{align} c_\mathrm{left,interface} &= H \cdot c_\mathrm{right,interface}\tag1\\ J_\mathrm{left,interface} &= J_\mathrm{right,interface}\tag2 \end{align}

Meaning that there is equal flux across the interface between the two compartments.

The concentration in the last compartment of the gas phase (before the interface) is approximated by linear extrapolation. This means that the concentration just before the interface is given by: $$c_{3} = \frac{c2-c1}{r2-r1} \cdot r_3 + c_1 - r_1 \frac{c_2-c_1}{r_2 - r_1}$$

In this example it is assumed that only three compartments are present on each side of the interface.

  • $\begingroup$ How are you discretizing the time derivatives? $\endgroup$ – Vinícius Godim Feb 22 '18 at 17:18
  • $\begingroup$ I am only discretizing the spatial derivatives. So I divide the spherical volume into smaller compartments. Then I carry out Taylor approximations to find approximations for the second order derivative and the first order derivative in the general diffusion equation. So I substitute the results from the Taylor approximations into the general diffusion equation thereby generating a system of ODE's. $\endgroup$ – Sigils Feb 22 '18 at 17:23
  • 1
    $\begingroup$ You may have more luck getting an answer for this on Computational Science. $\endgroup$ – hBy2Py Feb 22 '18 at 17:45
  • $\begingroup$ I have to agree with hBy2Py. I like the question, but I imagine a computationalist or physicist is going to be able to give a better answer. $\endgroup$ – Tyberius Feb 22 '18 at 17:57
  • $\begingroup$ I posted it on Computational Science and Math, thank you $\endgroup$ – Sigils Feb 24 '18 at 9:36

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.