Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

L6–7: Generalized Maxwell-Stefan Equations

Fick’s law fails for multicomponent diffusion when species interact strongly: osmotic diffusion, reverse diffusion, and diffusion barriers are all observed. The generalized Maxwell-Stefan (GMS) framework, derived from the kinetic theory of gases, provides the correct description. This notebook derives the B-matrix formulation, implements the linearized solution (Toor-Stewart-Prober), and demonstrates these phenomena numerically.

Governing equations

The GMS equations for an nn-component mixture (driving force = mole-fraction gradient):

−c ∇xi=∑j≠ixiNj−xjNiDij-c\,\nabla x_i = \sum_{j \neq i} \frac{x_i N_j - x_j N_i}{\mathcal{D}_{ij}}

In matrix form N=−c [B]−1∇x\mathbf{N} = -c\,[\mathbf{B}]^{-1}\nabla \mathbf{x} where the B\mathbf{B}-matrix has elements:

Bii=xiDin+∑j≠ixjDij,Bij=−xi(1Dij−1Din)B_{ii} = \frac{x_i}{\mathcal{D}_{in}} + \sum_{j\neq i}\frac{x_j}{\mathcal{D}_{ij}}, \quad B_{ij} = -x_i\left(\frac{1}{\mathcal{D}_{ij}} - \frac{1}{\mathcal{D}_{in}}\right)

Bootstrap relation (equimolar counter-diffusion): ∑iNi=0\sum_i N_i = 0.

Linearized theory (Toor-Stewart-Prober): replace B\mathbf{B} by its value at the mean composition xˉ\bar{\mathbf{x}}, giving an exact analytical solution for linear profiles.

PyMRM building blocks

ToolRole
construct_grad, construct_divSpatial operators per component
B-matrix function (user-coded)Assemble B(x)\mathbf{B}(\mathbf{x}) at each face
scipy.linalg.invInvert B\mathbf{B} to get diffusivity matrix
newton, NumJacNonlinear solver for coupled MS system

Example 1 — Osmotic diffusion in a ternary system

Classic Arnold & Toor test case: acetone (1) – methanol (2) – air (3). Component 2 (methanol) can diffuse against its own gradient when driven by component 1.

Effective diffusivity matrix D_eff:
[[ 1.55005834e-05 -2.93418903e-06]
 [-1.00816803e-06  2.12786464e-05]]
Fluxes N1=-6.283e-06, N2=-1.014e-05 mol/m²/s
Note: N2 = -1.014e-05 — osmotic diffusion if sign unexpected
<Figure size 600x350 with 1 Axes>

Example 2 — Dehydrogenation of ethanol

Ternary system: ethanol (EtOH), acetaldehyde (AcH), hydrogen (H₂) with reaction. The Maxwell-Stefan equations are solved self-consistently with the reaction source term.

<Figure size 600x350 with 1 Axes>
EtOH flux: 8.473e-06, AcH flux: -2.167e-06 mol/m²/s

Summary

  • Fick’s law fails in multicomponent systems: osmotic diffusion (NiN_i against ∇xi\nabla x_i), reverse diffusion (counter to expected direction), diffusion barriers (Ni=0N_i = 0 despite ∇xi≠0\nabla x_i \neq 0)

  • GMS framework: rigorously derived from kinetic theory; reduces to Fick’s law for binary systems

  • B-matrix: (n−1)×(n−1)(n-1) \times (n-1) matrix that encodes all pairwise interactions; invert to get fluxes

  • Bootstrap: fixes the nthn^{\text{th}} flux from ∑Ni=0\sum N_i = 0 (equimolar CD) or total molar flux

  • Linearized theory (Toor-Stewart-Prober): exact when composition is linear → use at mean xˉ\bar{x}