Catalyst.jl icon indicating copy to clipboard operation
Catalyst.jl copied to clipboard

Calculate chemical equilibrium for system with equilibrium constants?

Open ctessum opened this issue 2 years ago • 6 comments

Hello,

I have a system of chemical reactions that describe the thermodynamic equilibrium of a system. It is described as a system of reactions, and each reaction has an equilibrium constant. (The specific system in question is Table 2 in this paper.)

This use case seems a little different than the Catalyst documentation and examples, i.e. the reaction constants represent equilibrium (unitless) rather than rate (1/s) and the system should end up being a NonlinearSystem of equations instead of an ODESystem. Is there a way to represent this type of reaction system using Catalyst? Thanks for your help!

cc @jialinl6

ctessum avatar Jun 22 '22 14:06 ctessum

I am not sure I understand fully, but:

  • What do you want to do with your model? If you want to simulate time development from an initial condition, using Catalyst might be a good idea. If you wish to solve it to find some equilibrium, maybe a NonlinearSystem is all you need.
  • Looking at table 2 it seems you have reactions, at some rate. If these rates are constant throughout a simulation (?) just putting them into the rate field should be fine. Catalyst don't really need to worry about the units.

TorkelE avatar Jun 22 '22 15:06 TorkelE

Catalyst doesn't currently have functionality to solve for the equilibrium of the system as you'd want it, or anything built in to understand most thermodynamic rate quantities you might want to manipulate or use in model formulation (beyond seeing them as parameters or symbolic variables of the system). Catalyst can currently generate a system of nonlinear equations that correspond to steady-states of the mass action ODE model associated with the reactions, but not the stricter set of equations that arise from using detailed balance and reversibility. I also don't think you could correctly formulate the reaction model in Catalyst when only knowing equilibrium constants (though I guess you could include symbolic forward and reverse rates, and then substitute one of them out before doing a steady-state calculation).

That said, we should definitely think about offering a way to do some equilibrium analysis on Catalyst models longer term.

isaacsas avatar Jun 22 '22 17:06 isaacsas

Thanks for the responses! I think we can implement our system as a NonlinearSystem for now, but we would be a user of this feature if it ever gets implemented :)

ctessum avatar Jun 22 '22 19:06 ctessum

I'm going to leave this open as a reminder that we could at least try to make something work for fully reversible systems.

isaacsas avatar Jun 22 '22 19:06 isaacsas

Also, I'd be interested in seeing the form of the nonlinear system you want to solve. Just to make sure I understand the equations you are expecting.

isaacsas avatar Jun 22 '22 21:06 isaacsas

Sure, we can share the system once we have something put together.

ctessum avatar Jun 23 '22 15:06 ctessum