ReactionMechanismGenerator / ReactionMechanismSimulator.jl

The amazing Reaction Mechanism Simulator for simulating large chemical kinetic mechanisms
https://reactionmechanismgenerator.github.io/ReactionMechanismSimulator.jl
MIT License
75 stars 33 forks source link

Clipping and normalization of mass fraction #91

Open jiweiqi opened 4 years ago

jiweiqi commented 4 years ago

I have a question regarding the clipping of mass fraction. I am wondering whether rms clip negative mass fraction, which happens in the large mechanism. In Cantera, the negative ass fraction is left as it is since clipping will affect the numerical Jacobian and make the solver super slow. Similarly, does rms normalize the mass fraction to unity?

It will be great if someone can point me the relevant source code?

mjohnson541 commented 4 years ago

So RMS uses the moles formulation of the equations rather than the mass fraction formulation. Nothing is done to prevent negative moles, which will occur for species with moles under the absolute tolerance. Since they are calculated directly from the moles the mole fractions and mass fractions will always sum to unity.

jiweiqi commented 4 years ago

I guess this might be why using log -> exp to compute wdot is super slow, since clipping negative moles/mass fraction will effect the properties of Jacobian and slow done the ODE solver substantially.