Repository navigation
Fix multicomponent transport for single-species phases, closes #1823 - #2183
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2183 +/- ##
==========================================
- Coverage 78.46% 77.45% -1.01%
==========================================
Files 463 470 +7
Lines 55849 57189 +1340
Branches 9169 9196 +27
==========================================
+ Hits 43823 44297 +474
- Misses 8960 9823 +863
- Partials 3066 3069 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
speth
left a comment
There was a problem hiding this comment.
Hi @GiantWizard,
Thanks for preparing this PR. I think the actual code changes look good, but had one suggestion regarding the update to the tests.
For what its worth, small changes to the pure species properties are expected as the species set changes, at least for the current implementation -- the polynomial fits to the collision integrals are done on a grid in
The funny updating of m_bdiff is a separate issue that probably should be fixed, but I don't think we should drag that into the current PR.
Can we create a new issue to track this error? I think @GiantWizard offered to do that 😄 |
|
Updated |
speth
left a comment
There was a problem hiding this comment.
Thanks, @GiantWizard. This looks good to me.
Changes proposed in this pull request
MultiTransportfor phases with a single species. The diffusion row and column of the L matrix are entirely zero in this case, sothermal_conductivityandthermal_diff_coeffsfailed with a singular matrix error. Setting the diagonal entry to 1 decouples that equation without affecting the other unknowns.getMultiDiffCoeffsfor a single species instead of inverting a zero matrix, consistent with the zero diagonal returned for multi-species phases.xfailformulticomponentintest_single_species_transport.Two adjustments to the test were needed for the multicomponent case:
Conductivity tolerance: the pure-species conductivity in a multi-species phase depends on which other species are defined, even at zero mole fraction. For H2O2 at 500 K and 5 atm, and converging smoothly as the second species goes to zero:
The test's reference phase includes H2, so I used
rel=1e-4for multicomponent only.Self-diffusion check skipped for multicomponent: computing the multicomponent thermal conductivity overwrites the cached self-diffusion coefficient (
m_bdiff(k,k)inupdateThermal_T), somix_diff_coeffschanges afterthermal_conductivityis called (9.849677e-06 before, 9.850801e-06 after for the single-species phase). This predates this PR and was previously hidden by the crash. I left it out of scope, but am happy to adjust the test or open a separate issue if preferred.If applicable, fill in the issue number this pull request is fixing
Closes #1823
AI Statement (required)
Extensive use of generative AI. I used Claude Opus 5.5 to analyze the cause of the singular matrix and to investigate the two test discrepancies described above; it suggested the fix approach and the test adjustments. I implemented the C++ changes myself, built and ran the test suite locally, and confirmed the multicomponent case fails without the fix.
Checklist
scons build&scons test) and unit tests address code coverage