Dear Cantera team,
I am currently using Cantera (Python) to simulate a freely propagating premixed methane-air flame with the multicomponent transport model enabled and Soret diffusion activated (soret_enabled = True). I then manually compute the total mass flux at the midpoints between the flame grid points, based on the temperature and species gradients using the formaul given
here https://cantera.org/stable/reference/onedim/governing-equations.html
However, the total mass flux I obtain is not zero, even though it should ideally be zero. I understand some numerical discrepancies are possible, but the magnitude and shape of the non-zero flux is unexpected.
I would appreciate any guidance on why I may be observing a non-zero total flux. Could this be related to numerical interpolation at midpoints, assumptions in multicomponent transport, or how the diffusion matrix is defined? I have provided the code that I am using below.
Thank you for your help!
Hi,
Thank you very much for reporting this. It turns out that we have had a long-lingering bug where the matrix of multicomponent diffusion coefficients was being returned with the elements in the wrong order in the Python interface. For historical reasons, the underlying C++ method uses the coefficients in a “Fortran” (column major) order, while Numpy by default works with “C” (row major) order for 2D arrays. I’ve created a pull request to resolve this. As a short term fix, and to verify that this is indeed the issue, you can just take the transpose of D_matrix.
None of this affects the results of the 1D flame solver, which has always used the elements using the correct indexing scheme.
Regards,
Ray