Questions about Cantera reaction mechanism and Python implementation of Plug Flow Reactor

29 views
Skip to first unread message

Partth

unread,
Jun 30, 2024, 10:03:18 AM (3 days ago) Jun 30
to Cantera Users' Group
Hi All,

This is my first post so apologies if I am not formatting this correctly/this may be too general. I am currently working on writing a steady-state flow solver and wish to use Cantera to compute the finite rate chemistry in Python; I am seeking to reproduce and modify an existing code which uses an external CFD solver dependency to perform the finite-rate chemistry.

For my first concern: I was able to define the requisite species properties and mechanism along with my ODE solver. I am able to get the net rate of species formation for a specified gas solution using " gas.net_production_rates", but my issue is that I am not sure how to update the reaction steps of the mechanism as I am not getting the correct species mass fraction/production along each iteration of the solver. I would share my code here, but since it is part of my research group I cannot, I will try to privately message someone if they can see what I may be doing incorrectly as it essentially and ODE solver but my incorporation of Cantera is not quite working. 

As in, is there a way to update the state of the gas solution as I am supplying the updated temp, pressure and mass fraction on each iteration to the gas, but my rate of production/gas state does not seem to reflect the combustion that should occur. I think I am just evaluating a new solution/state for my gas each iteration but it is not actually proceeding with the reactions/producing the heat release.

I saw there is a reactor module for transient combustion, but I am more concerned with SS combustion so I do not think the "custom.py" example is directly applicable though I could be wrong. If I make the time variable t (which seems to be integrated in the ODE solver) a stand-in for the spatial direction x, I could probably write my steady-state equations to be solved in terms of "t" or is this not quite right?

For my second concern: I saw a suitable alternative would be the use of a plug-flow solver as this integrate the governing equations and use Cantera as I wished in the prior part. However, I saw that the Python implementation assumes a constant pressure as compared to the MATLAB version of the Plug Flow Reactor (PFR). Is this still the case? I was seeking to develop something based off of this: https://cantera.org/dev/examples/matlab_experimental/plug_flow_reactor.html so I may indeed have to use MATLAB if the pressure is indeed constant in the Python PFR.

A question I had: I understand there are extensible reactors such as this example: https://cantera.org/examples/python/reactors/PorousMediaBurner.py.html in which the governing equations can be modified/additional state variables can be defined, but can additional ODEs be added to  the given set solved by the PFR, or is this a constraint.

If anyone can shed light on these matters it would help a lot. Else, worst case, if I cannot incorporate Cantera, I would have to solve the finite chemistry manually which defeats the purpose herein. Thank you.

Reply all
Reply to author
Forward
0 new messages