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.

Coupling of a Particle Model to a Reactor Model

This notebook demonstrates a generalized approach to coupling a reactor model with a particle model, applicable in various simulation scenarios.

Implementation Notes

  • The code is modular and supports multi-component systems.

  • Boundary conditions are flexible and can be customized for the reactor model.

  • The framework is designed for extensibility, allowing users to implement custom kinetics, geometries, and coupling strategies.

  • The notebook includes plotting utilities and example usage for both standalone and coupled simulations.

Refer to the docstrings in each class and function for further details on usage and customization.

Overview of the Model Classes

This notebook contains the following main classes:

  • DiffusionConvectionReactionNonLinear: A 1D model for plug flow reactors with convection, diffusion, and nonlinear reaction kinetics. Supports both steady-state and transient solutions, and can be flexibly coupled to other models via a user-supplied kinetics function.

  • Kinetics: A simple class for first-order reaction kinetics, providing both the rate and the Jacobian for use in nonlinear solvers.

  • ParticleModel: A general 1D (or quasi-1D) reaction-diffusion model for a particle, supporting arbitrary geometry and user-supplied nonlinear kinetics. Designed for both steady-state and transient solutions, and can be used for multi-component systems.

Each class is documented with detailed docstrings, and the notebook demonstrates how to use these classes for both standalone and coupled simulations.

Example: Steady-State Solution of a Plug Flow Reactor

This example demonstrates how to compute a steady-state solution for a plug flow reactor using first-order kinetics. The reactor is modeled as a 1D domain with convection, diffusion, and nonlinear reaction kinetics.

The model is configured to simulate the reaction-diffusion process under steady-state conditions, utilizing the kinetic parameters and boundary conditions defined in the code.

iterations: 12, outlet concentration (face value): 4.628773e-05
<Figure size 640x480 with 1 Axes>

Example: Steady-State Solution of the Particle Model

This example demonstrates how to compute a steady-state solution for a particle model using user-defined kinetics. The particle is modeled as a 1D domain (e.g., spherical or slab geometry) with diffusion and nonlinear reaction kinetics.

The model is configured to simulate the reaction-diffusion process within a particle under steady-state conditions, utilizing the predefined kinetic parameters.

<Figure size 640x480 with 1 Axes>

Explicit Coupling and ‘black-box’ Coupling

In the black-box coupling the reactor only receives the apparent reaction rate from the particle model, not its derivative: the reaction Jacobian passed to newton is zero. Newton then becomes a fixed-point iteration between reactor and particles, which converges only linearly and needs many more iterations than a Newton solve with the full Jacobian. The iteration count is printed below; solve raises an error if the iteration has not converged within maxfev iterations.

iterations: 105, outlet concentration (face value): 8.503659e-05
<Figure size 640x480 with 1 Axes>

Coupling with Schur complement

Here the particle model returns the apparent rate together with its derivative with respect to the boundary concentration, obtained by eliminating the particle unknowns (a Schur complement). The reactor Newton iteration then sees the full coupled Jacobian and converges in a few iterations, and it gives the same outlet concentration as the black-box coupling.

iterations: 17, outlet concentration (face value): 8.503955e-05
<Figure size 640x480 with 1 Axes>