examples.levelSet.electroChem.adsorptionΒΆ

This example tests 1D adsorption onto an interface and subsequent depletion from the bulk. The governing equations are given by,

\[\begin{split}c_t &= D c_{xx} \\ D c_x &= \Gamma k c (1 - \theta) \qquad\text{at $x = 0$} \\ \intertext{and} c &= c^{\infty} \qquad\text{at $x = L$}\end{split}\]

and on the interface

\[D c_x = -k c (1 - \theta) \qquad\text{at $x = 0$}\]

There is a dimensionless number \(M\) that governs whether the system is in an interface limited (\(M \gg 1\)) or diffusion limited (\(M \ll 1\)) regime. There are analytical solutions for both regimes. The dimensionless number is given by:

\[M = \frac{D}{L^2 k cinf}.\]

The test solution provided here is for the case of interface limited kinetics. The analytical solutions are given by,

\[-D \ln \left( 1 - \theta \right) + k L \Gamma_0 \theta = \frac{k D c^{\infty} t}{\Gamma_0}\]

and

\[c(x) = \frac{c^{\infty} \left[ k \Gamma_0 (1 - \theta) x / D \right]}{1 + k \Gamma_0 (1 - \theta) L / D}\]

Make sure the dimensionless parameter is large enough

>>> (diffusion / cinf / L / L / rateConstant) > 100
True

Start time stepping:

>>> currentTime = 0.
>>> from builtins import range
>>> for i in range(totalTimeSteps):
...     surfEqn.solve(surfactantVar, dt = dt)
...     bulkEqn.solve(bulkVar, dt = dt)
...     currentTime += dt

Compare the analytical and numerical results:

>>> theta = surfactantVar.interfaceVar[1]
>>> numerix.allclose(currentTimeFunc(theta), currentTime, rtol = 1e-4)()
1
>>> numerix.allclose(concentrationFunc(theta), bulkVar[1:], rtol = 1e-4)()
1
Last updated on Jun 26, 2024. Created using Sphinx 7.1.2.