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.

L8 2D convection-diffusion with boundary surface reaction

Background

This notebook the couping of a two-dimensional convection-diffusion equation with a surface reaction on a wall. The lower wall has its own surface state:

  • the gas-phase surface concentrations are extra unknowns;

  • those gas surface concentrations are the Dirichlet boundary values for the bulk;

  • gas surface equations balance wall-normal flux and surface reaction source terms;

  • additional surface species obey implicit accumulation plus reaction terms.

The implementation uses construct_grad(..., shapes_d=...) to expose the boundary values as a separate variable block and update_array_indices to embed local sparse operators into one monolithic Jacobian.

Governing Equations

For gas species A and B in the bulk, the transient convection-diffusion equation is solved with backward Euler:

cin+1−cinΔt+∇⋅(ucin+1−D∇cin+1)=0.\frac{c_i^{n+1}-c_i^n}{\Delta t} + \nabla \cdot \left(\mathbf{u}c_i^{n+1} - D \nabla c_i^{n+1}\right)=0.

At the catalytic lower wall, the bulk concentration is constrained by the surface gas variables:

ci(z,y=0)=ci,s(z).c_i(z,y=0)=c_{i,s}(z).

The gas surface variables are algebraic. Their wall-normal diffusive flux is balanced against the gas part of the surface mechanism:

−D∂cA∂y∣s=−rads,−D∂cB∂y∣s=rdes.-D\left.\frac{\partial c_A}{\partial y}\right|_s = - r_{ads}, \qquad -D\left.\frac{\partial c_B}{\partial y}\right|_s = r_{des}.

The surface species are A*, two-site B*, and vacancies *:

As+∗→A∗,A∗+A∗→B∗,B∗→Bs+2∗.A_s + * \rightarrow A*, \qquad A* + A* \rightarrow B*, \qquad B* \rightarrow B_s + 2*.

They are also advanced with backward Euler:

θn+1−θnΔt=Rsurface(csn+1,θn+1).\frac{\theta^{n+1}-\theta^n}{\Delta t}=R_{surface}(c_s^{n+1},\theta^{n+1}).

Because B* occupies two sites, the conserved site occupancy is

θA+2θB+θ∗=1.\theta_A + 2\theta_B + \theta_* = 1.

Parameters and Assumptions

The bulk shape is (n_z, n_y, n_gas). The global state is stored as a two-dimensional block array (n_z, n_bulk_fields + n_surface_fields) so that each axial cell contains its bulk cross-section and its surface state.

PyMRM Implementation

The lower wall Dirichlet values are not constants. In the transverse gradient operator, shapes_d=((n_z, 1, n_gas), None) creates a matrix that maps the separate surface gas variables into the lower-wall boundary contribution. All matrices are kept in CSC format so update_array_indices can embed the bulk, surface-gas, and surface-species blocks into the global Jacobian.

The time derivative is represented as a constant sparse identity block for the bulk gas variables. The previous bulk state and previous surface coverages are updated after every successful implicit time step.

Results

Loading...
final time 1.000000e+00 final step residual norm 3.659295e-13 next step initial residual norm 3.683840e-01 Jacobian nnz 1.244000e+04 outlet A average 1.699315e-01 outlet B average 1.270338e-02 weighted site-balance error 4.440892e-16 dtype: float64
<Figure size 1300x400 with 5 Axes>
<Figure size 1300x400 with 3 Axes>

Validation

The validation checks are deliberately simple:

  • surface weighted surface site occupancy remains conserved;

  • concentrations and coverages stay non-negative;

  • the transient solution moves away from the uniform initial bulk state because A is adsorbed and converted at the wall;

  • the final monolithic residual for the last implicit time step is small.

Loading...

Discussion

This formulation separates three ideas that are often conflated:

  • surface gas concentrations are boundary values for the bulk;

  • flux balances determine those surface gas concentrations;

  • additional surface species have their own accumulation and reaction equations.

The important PyMRM pattern is the combination of shapes_d for variable boundary data and update_array_indices for placing each local operator in the global monolithic state.