Update: Refactor Mixture and ChemicalSystem architecture for shared systems and faster thermo evaluation#1127
Merged
Merged
Conversation
Add: include `non-ideal ` EoS capabilities and solve error bad initial guess
Solve: error updating thermo state with chemical equilibrium mixtures and error initial guess with ionized species at very low temperature
Update: improve performance `simplexDual` and solve minor bugs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This update refactors the interaction between
Mixture,ChemicalSystem, and the equilibrium solver to reduce unnecessary object copying, remove dependence on temperature-updated property matrices, and make mixture state handling more explicit.Mixturenow owns its composition state inChemicalSystemspecies order, whileChemicalSystemprovides static species properties and stateless cached thermo evaluation routines.1. Refactored
ChemicalSystemstatic species dataChemicalSystemnow stores static species properties directly as vectors, avoiding repeated access throughpropertiesMatrixfor data that does not depend on temperature.setStaticSpeciesProperties.propertiesMatrixupdate path.2. Refactored
Mixturecomposition stateMixturenow stores composition internally assystemMoles, in fullChemicalSystemspecies order. Fuel and oxidizer compositions are also stored in full system order throughsystemMolesFuelandsystemMolesOxidizer.This avoids rebuilding composition from the old property matrix path and makes the state ownership clearer:
Mixtureowns moles and thermodynamic state.ChemicalSystemowns species data and thermo functions.moles(mix), consistent with existing utility-style APIs.3. Shared
ChemicalSystemacross mixture copiesMixture copies no longer deep-copy the full
ChemicalSystem. The copied mixture keeps its own state while sharing the same chemical system object.This removes a major bottleneck in batch calculations, especially when many mixtures use the same species database and static thermo data.
4. Added
productSpeciesSetfor equilibrium calculationsEquilibrium calculations now use a compact product species set instead of copying or mutating a product-specific
ChemicalSystem.The new
productSpeciesSetstores solver-local product species data and maps results back to fullChemicalSystemorder usingproductVectorToSystemVector.This also removes the need for post-equilibrium reshaping through copied systems and keeps the equilibrium solver working directly with compact local indices.
5. Improved thermo fast paths
Thermo evaluation now uses specific cached paths for the combinations required internally, such as
h/cp/s,cp/s,h, andh/g. This avoids repeated property-name checks and unnecessary curve lookups in performance-critical equilibrium and mixture-update paths.6. Benchmarking
𝗕𝗘𝗡𝗖𝗛𝗠𝗔𝗥𝗞 𝗥𝗘𝗣𝗢𝗥𝗧
𝗦𝘆𝘀𝘁𝗲𝗺 𝗜𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻
𝗕𝗲𝗻𝗰𝗵𝗺𝗮𝗿𝗸𝗶𝗻𝗴
𝗦𝘂𝗺𝗺𝗮𝗿𝘆 𝗕𝗲𝗻𝗰𝗵𝗺𝗮𝗿𝗸𝗶𝗻𝗴