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.

Particle model: diffusion + first order reaction

This notebook demonstrates how to compute the effectiveness factor of a particle model with diffusion and a first-order reaction.

A non-uniform grid is used, refined near the particle surface, to ensure accurate computation for larger Thiele moduli.

The governing equation for the dimensionless concentration cc in a spherical particle of radius RR, with diffusion coefficient DD and a first-order reaction with rate constant kk, is

D1r2ddr(r2dcdr)=kc.D \frac{1}{r^2}\frac{d}{dr}\left(r^2 \frac{dc}{dr}\right) = k c.

The boundary conditions are symmetry (no flux) at the particle centre, dc/dr=0dc/dr = 0 at r=0r=0, and a fixed surface concentration, c=1c=1 at r=Rr=R. In pymrm’s a*dc/dn + b*c = d convention, with nn the outward normal, the outward normal at the lower end (r=0r=0) points in the −r-r direction, so {'a':1, 'b':0, 'd':0} there imposes −dc/dr=0-dc/dr=0, i.e. the intended symmetry condition; at the upper end (r=Rr=R) the outward normal is +r+r, so {'a':0, 'b':1, 'd':1} imposes c=1c=1.

<Figure size 640x480 with 1 Axes>

Parameters and operators

Define the diffusion coefficient, the sweep of Thiele moduli, and the boundary conditions, then build the gradient, divergence, and Laplacian operators on the non-uniform grid.

Effectiveness factor sweep

For each Thiele modulus, build and factorize the Jacobian, solve for the concentration profile, and compute the apparent reaction rate from the surface gradient to obtain the effectiveness factor. The analytical closed form for a sphere is plotted for comparison.

<Figure size 640x480 with 1 Axes>

Checking the result

The plot above already compares the numerical effectiveness factor against the sphere’s analytical closed form η=3(ϕcoth⁡(ϕ)−1)/ϕ2\eta = 3(\phi \coth(\phi)-1)/\phi^2. Here the comparison is quantified: the numerical values should match the analytical ones to within the discretization error. A large mismatch here would catch a wrong divergence operator (nu), a wrong sign in the boundary conditions, or a wrong apparent-rate formula.

max relative error (phi > 0.1): 1.522e-02
max absolute error (phi <= 0.1): 1.537e-06
lower (x=0, outward normal -x): -1*dc/dx + 0*c = 0  [Neumann]
upper (x=1, outward normal +x): 0*dc/dx + 1*c = 1  [Dirichlet]