Repository navigation
Conversation
CanteraBase.set_up handed the reactor pressure in bar and the termination time in its declared unit to the shim Quantity, which stores units without applying them. Cantera therefore ran every CanteraBase-derived adapter at 1 Pa for a 1 bar input, and integrated for the wrong duration unless the unit was 's'. set_up now converts P to Pa and the termination time to seconds via convert_termination_time_to_seconds. The shim Quantity refuses any unit other than K, Pa or s, and the converter raises a ValueError naming an unknown unit and the supported set. Also fix the schema's micro-s normalisation, which multiplied by 1000 instead of dividing, turning 1 micro-s into 1 s. Two JSR tests and one PFR test passed only because nothing reacted at 1 Pa. The JSR tests now assert the pressure-controller law and compare the steady state; the PFR chain-vs-Lagrangian test is a strict xfail, since the chain method feeds every cell the original inlet.
| common.convert_termination_time_to_seconds((1.0, 'fortnights')) | ||
| message = str(error.value) | ||
| assert 'fortnights' in message | ||
| for unit in TerminationTimeEnum: |
This branch has not been deployed
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.
Summary
CanteraBase.set_uppassed pressure in bar and the termination time in its declared unit to ashim
Quantitythat stores units without applying them — so everyCanteraBase-derived adapterran at 1 Pa for a 1 bar input, and integrated for the wrong duration unless the unit was
already
's'.Evidence
Before: two JSR tests and one PFR test passed because nothing reacted at 1 Pa. A test that
passes only because the physics was switched off is the failure mode here, not the arithmetic.
After: the JSR tests assert the pressure-controller law and compare the steady state, so they
fail if the pressure is wrong. The PFR chain-vs-Lagrangian test is a strict
xfailwith its reasonnamed: the chain method feeds every cell the original inlet, which is a separate defect and is
tracked on its own.
Merge Danger
Door: two-way.
Blast Radius: every Cantera simulation result.
This changes the conditions every
CanteraBase-derived adapter actually simulates at, by fiveorders of magnitude in pressure. Results produced before it are not comparable with results after
it — that is the point of the fix, and it is also the reason nothing that cites a pre-fix Cantera
number should be read as still valid.