Sum of mass fractions of species is not unity in a custom PFR model

105 views
Skip to first unread message

Mohammad Adib

unread,
Jul 6, 2021, 11:18:47 AM7/6/21
to Cantera Users' Group

I have followed the custom.py example (solving the transport equations in python and using Cantera to calculate the thermophyscial properties) to develop a model to simulate fuel pyrolysis and soot formation in Plug Flow Reactors. When the soot formation is account the rate of production of species (wdot) should be adjusted to account for inception and growth of particles. In other words, acetylene and certain PAHs should be removed from the gas phase by subtracting the contribution of each species to the rate of growth and inception from the rate of production of that species.

The problem is that the sum of mass fractions integrated as each timestep is no longer 1, and it decreases considerably as the soot particles grow and more species are removed from the gas. This causes some mass balance issues because Cantera automatically normalizes the mass fraction obtained from integration.

I do not know how to solve this problem.

I have attached the code that contains part of the Reactor and Soot models.

 

Reactor.py

Bryan Weber

unread,
Jul 6, 2021, 12:33:39 PM7/6/21
to Cantera Users' Group
Hi,

I think one reasonable solution would be to create a pseudo-soot species. The portion of the acetylene and PAHs that are removed are added to that species, such that the total mass is conserved. That species doesn't undergo any further reactions, and you can even set it so that the heat capacity is zero and it does not absorb any energy (if you have an energy equation).

Another option is to use the total reactor mass as your state variable, instead of the mass fractions. You can then compute the mass fractions by dividing the mass of each species by the total mass. This assumes that you know some initial volume of the system (or that you can assume it to be 1.0). For what it's worth, this is what's done in the built-in Reactor classes, which can have arbitrary inlets and outlets for mass flow.

My understanding of the purpose of the "set_unnormalized_*" functions is for when there are small deviations from unity due to the numerical integration. You can't use it to violate one of the fundamental laws of physics :-)

Best,
Bryan

Steven DeCaluwe

unread,
Jul 6, 2021, 1:55:21 PM7/6/21
to <cantera-users@googlegroups.com>
Hi Mohammad,

In principle, I don’t think the use of “set_unnormalized_” is a problem - it does scale the molar density accordingly, so it would be consistent with simply having fewer moles. But as used, it assumed that the mass density remains fixed, which I am guessing is problematic.  The workaround would be to set the temperature and mass density first, and then set the unnormalized mass fractions.

But overall, I agree with Bryan - you are likely better off changing your governing equations. Bryan’s recommendation of using species masses is what I would likely do.  One bonus is that, in my experience, the equations for species mass tend to integrate faster than those for species mass fractions :)


However, it is also possible that you can keep your current state variables, in that there might just be a small error in your derivative calculations. If species are leaving the gas phase, that would assume that the volume and mass taken up by the gas phase change, so that dRho/dt is nonzero.  I couldn’t quite parse this in your model file (thank you for sharing it, by the way), but is there a correction term on your dY_k/dt to account for a non-constant gas phase density?

More specifically, starting from Bryan’s reactor mass variable: Rho_k = Rho*Y_k, the chain rule lets you calculate dY_k/dt = d(Rho*Y_k)/dt - Y_k*dRho/dt) / rho. In cases where all species remain in the gas phase, this can simplify quite a bit.

Anyway, apologies if you are already accounting for this in your model, but it is another thought that occurred to me.

Best,
Steven


--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/74d0e58e-1196-44b3-b5f2-5e75338c3c5cn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages