Diffusion of gas in a liquid with changing pressure and solubility (chemical potential) Modelling the diffusion of a gas dissolved in water in a vertical column of water, several meters deep. Also assuming the water is completely still, so only diffusion plays a role. (Actually a model of methane and oxygen diffusion in the water in peatlands.)
Fick's law says that diffusion flux $J$ depends on the concentration gradient as
$J = -D \frac{\partial C}{\partial z}$.
where $C$ is the gas concentration. (And $D$ diffusion coefficient.)
But


*

*There is also hydrostatic pressure gradient, and in a higher pressure more gas can be dissolved in a volume of water and still be in chemical equilibrium with a volume of lower pressure of water with a somewhat smaller concentration of dissolved gas. With a small enough gas concentration gradient, the diffusion should actually go against the gradient.

*The water can have different temperatures at different depths. And the solubility of the gas is temperature-dependent. So again, if the concentration gradient is small, there could actually be diffusion flux from lower concentration to higher concentration, if the latter is also much colder (higher solubility in cold water).
How to modify the diffusion equation to account for these effects? As far as I understand, the gradient driving the diffusion should not be calculated from the concentration, but from then chemical potential of the gas dissolved in water.
So in other words, how to calculate the chemical potentials of oxygen or methane dissolved in water at certain pressure and solubility (temperature)?
 A: Just a hunch, but I bet Fick's law is really just a potential function gradient in disguise that simplifies down to the form you have for some situations.  What you really want is something more like 
$$J = -D(p,T)\frac{\partial \psi(C,p,T)}{\partial z}$$
where $\psi(C,p,T)$ is probably related to the potential change from one point to another. How you figure out what $D(p,T)$ and $\psi(C,p,T)$ are will be the tricky part, but I bet you can come to an approximation if you consider the chemistry physics. If you want analytic solutions you might start with a Taylor series type approximation to the potential function
$$\psi(C,p,T) = \psi_0+(C-C_0)\left.\frac{\partial \psi}{\partial C}\right|_{C_0}+(p-p_0)\left.\frac{\partial \psi}{\partial p}\right|_{p_0}+(T-T_0)\left.\frac{\partial \psi}{\partial T}\right|_{T_0}$$
Then you just need to approximate the three partial derivatives.  I would think that you can just look up tables with the potentials.  The $D(p,T)$ term is really all about the odds of a subset of molecules passing from one point and state to a neighboring one.
