Skip to content

Conversation

@AntoniaBerger
Copy link
Collaborator

@AntoniaBerger AntoniaBerger commented Dec 12, 2025

Add ReactionSystem to all unit operation types

Summary

This PR extends the reaction system architecture to support reactions in all unit operation types and phases. The main improvement is consolidating reaction handling across bulk liquid, liquid phase in particles, and solid phase in particles into a unified framework, replacing the previous separate cross-phase reaction model approach.

Key Changes

Unified Reaction Parameters

MassActionLawReaction now supports phase-specific rate constants:

  • MAL_KFWD_BULK / MAL_KBWD_BULK - Forward/backward rates for bulk volume reactions
  • MAL_KFWD_LIQUID / MAL_KBWD_LIQUID - Forward/backward rates for particle liquid phase
  • MAL_KFWD_SOLID / MAL_KBWD_SOLID - Forward/backward rates for particle solid phase

Model Consolidation

  • Separate MassActionLawReactionCrossPhase model (merged into MassActionLawReaction)
  • Cross-phase logic is now handled uniformly within the main Mass Action Law model
  • fluxGradCombined()` signature to compute reaction gradients for liquid and solid interactions

ReactionModel Interface Refactoring

Method naming and signatures updated for clarity:

  • residualFluxAdd() -> residualLiquidAdd() (explicit phase indication)
  • analyticJacobianAdd() ->analyticJacobianLiquidAdd()
  • Deprecated numReactions() virtual method

Extended Unit Operation Support

All unit operations now support the complete ReactionSystem:

  • Columns: 1D and 2D models
  • General Rate Models: 1D, 2D, and Frustum variants
  • Lumped Rate Models: With pores, without pores, and discontinuous Galerkin variants
  • CSTR: Stirred Tank Model
  • Multi-Channel Transport Model: MCTM
  • Particle Models: General rate and homogeneous particles

Documentation Updates

  • Adjusted Mass Action Law and Michaelis Menten documentation
  • All unit operation and reaction interface documentation to reflect new parameter names

Further Changes

  • BandedEigenSparseRowIterator for matrix operations
  • Updated CellParameters

Testing

  • Existing reaction tests updated to use new phase-specific parameters
  • Add MAL test in CSTR which compares two separate reaction models with one reaction model
  • Fixed (partly) Fix particle reactions #476

Note: This is a breaking change for custom reaction configurations.

@AntoniaBerger AntoniaBerger self-assigned this Dec 12, 2025
@AntoniaBerger AntoniaBerger force-pushed the feature/add_ReactionSystem_all_units branch 8 times, most recently from 8c9e2a7 to c8f0547 Compare December 19, 2025 07:47
@AntoniaBerger AntoniaBerger force-pushed the feature/add_ReactionSystem_all_units branch 3 times, most recently from fd3ecd7 to 5fc1120 Compare January 9, 2026 10:35
@AntoniaBerger AntoniaBerger force-pushed the feature/add_ReactionSystem_all_units branch 5 times, most recently from 4bb22ad to ede5229 Compare January 12, 2026 19:15
@AntoniaBerger
Copy link
Collaborator Author

AntoniaBerger commented Jan 13, 2026

Follow-up issue #544

  • GRM reaction particle tests are not running consistently.
  • GRM2D particle reaction tests are not running consistently.

@jbreue16
Copy link
Contributor

Did these tests run before your changes or were they 'never' running?

@AntoniaBerger
Copy link
Collaborator Author

AntoniaBerger commented Jan 13, 2026

Did these tests run before your changes or were they 'never' running?

They were never running. They are part of the tests related to #476

Copy link
Contributor

@jbreue16 jbreue16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so cool to have, thanks a lot !! :)
Maybe cadet/CADET-Verification#57 can be continued once we have nice test cases, e.g. from one of the planned publications?

Cross phase reactions take place between a liquid phase and a solid phase.

To specify the number of reaction models, use the parameter at the column or particle level:
- ``NREAC_CROSS_PHASE`` for cross-phase reactions i.e. ``unit_XXX/NREAC_CROSS_PHASE`` or ``particle_type_XXX/NREAC_CROSS_PHASE``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this specification should be in a unique place, without an option to choose particle or unit operation level? I don't care if this should go in the unit or particle level though... @schmoelder ?

@jbreue16
Copy link
Contributor

Did these tests run before your changes or were they 'never' running?

They were never running. They are part of the tests related to #476

in that case, ill just add the erroneous test to the testing meta issue #254

@AntoniaBerger AntoniaBerger force-pushed the feature/add_ReactionSystem_all_units branch from ede5229 to 61756fc Compare January 15, 2026 08:50
@AntoniaBerger AntoniaBerger merged commit fa6e9ac into master Jan 15, 2026
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants