Replies: 8 comments
-
This would definitely coincide well with my work. |
Beta Was this translation helpful? Give feedback.
-
This approach could also extend to handling of |
Beta Was this translation helpful? Give feedback.
-
@ischoegl - That's a good point. Using the mass or moles of each species in each phase would avoid having to separately track the mass of each phase as a separate quantity. I'm wondering now if there's a benefit to applying this idea at the @anthony-walker - could you summarize anything you've found that relates to this, either in terms of the issues with using mass/mole fractions, or any challenges you've found in using masses or concentrations? |
Beta Was this translation helpful? Give feedback.
-
Some useful references that discuss this issue: |
Beta Was this translation helpful? Give feedback.
-
@speth ... I'd be very much in favor of handling this at the |
Beta Was this translation helpful? Give feedback.
-
@speth The issues I have had so far have been fairly specific to my work and I don't have a lot of experience with Cantera's other functionalities that may be affected by such a change. The first and foremost is that the Jacobian of a constant pressure mass-fraction based system is fully dense and my work relies on leveraging sparse solvers. So, to precondition the current system a hack is in place to copy and convert the system to mole fractions. Something like [T,m,X_1..X_n], solve the linear system for an output vector used by Sparse GMRES (Sundials) with a mole fraction Jacobian preconditioner, and then convert the output vector to a state consistent to the current state that cantera can handle. I believe it is possible to make this same preconditioner based in concentration and not mole fractions as well so it could be consistent and not need any conversions. The concentrations are necessary for all of the calculations used to build this preconditioner, so a conversion would also simplify that process as well. A hack or two may also be in place for this if I remember correctly so that I can obtain the appropriate information from the I will append more to this as I think of it. |
Beta Was this translation helpful? Give feedback.
-
Superseded by #154 - closing to avoid splitting any discussion. |
Beta Was this translation helpful? Give feedback.
-
Motivation
Cantera's governing equations for reactors and flames currently use mass fractions as the state variables for the composition. This approach leads to fairly simple equations for the most common cases, but introduces some thorny mathematical issues due to the constraint that the sum of the mass fractions should be 1 that make it difficult to solve certain problems. While we have workarounds in place for some of these issues, these workarounds are often fragile. Some specific examples:
Calculating reasonable Jacobians requires leaving the sum(Y) = 1 constraint unsatisfied. In this case, there is no fully consistent way to calculate mole fractions, or any quantities which are computed from mole fractions. This is a concern for computing mixture averaged transport fluxes, proportional to the mole fraction gradients, and for any non-ideal thermo model where properties are calculated based on mole fractions.
Without the sum(Y) = 1 constraint, steady-state solvers are difficult to use because (depending on the situation), they can find the "solution" of setting all mass fractions to zero. This is particularly a problem for steady-state surface coverage problems.
Possible Solutions
These issues could be resolved by using concentrations or species masses as the species state variables instead.
References
Cantera/cantera#390
Beta Was this translation helpful? Give feedback.
All reactions