-
-
Notifications
You must be signed in to change notification settings - Fork 377
Steady-state reactor network solver #1907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
speth
wants to merge
20
commits into
Cantera:main
Choose a base branch
from
speth:steady-solver
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
4 tasks
This is so cool Ray, thanks for picking this work up and pushing it through 🎉🎉🎉🎉 |
80ede2d
to
b34500b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1907 +/- ##
==========================================
+ Coverage 74.11% 74.22% +0.10%
==========================================
Files 445 448 +3
Lines 55454 55746 +292
Branches 9121 9190 +69
==========================================
+ Hits 41101 41377 +276
- Misses 11262 11263 +1
- Partials 3091 3106 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1f8142e
to
2dcb4d7
Compare
…ailures After steady-state solver errors, falling back to timestepping is often sufficient to avoid problematic regions.
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.
Changes proposed in this pull request
SteadyStateSolver
class, which is also used as a base class forOneDim
.ReactorNet.solveSteady
method as an alternative to the time-marching approach used in the Python-onlyadvance_to_steady_state
method.This solver isn't currently a full replacement for
advance_to_steady_state
, as there are some complicated interactions with equations that don't translate directly into the steady-state problem, implicit constraints that are automatically satisfied when integrating the normal ODEs but are not currently imposed in the steady solver, and possibly other mathematical issues that I haven't worked out yet.A simple example of the first case is the equation for the volume of a control volume reactor, where the ODE reduces to
$dV/dt = 0$ . This is fine for an ODE solver, but for the steady solver, it is a problem because there's no information that can be used to solve for $V$ . Instead, this equation needs to be replaced with the algebraic equation $V(t) - V_0 = 0$ . This is handled in the implementation here by a new
steadyConstraints
method of each reactor class that indicates which equations need to be transformed into such constraints.Unfortunately, this only works in the case where the constraint corresponds to an existing equation. Other cases, such as the constraint that the mass of a constant pressure reactor should be constant work fine in the case of some formulations (
ConstPressureReactor
, where mass is one of the state variables) but not others (ConstPressureMoleReactor
, where the mass is a derived quantity based on the moles of each species).The cases where the solver does not work have been configured to raise exceptions when initializing the steady-state solver, and are indicated in docstring for the
solveSteady
method. I think we will eventually be able to resolve at least some of these limitations, though this will require a somewhat more flexible approach to modifying the set of equations to be solved.If applicable, fill in the issue number this pull request is fixing
If applicable, provide an example illustrating new features this pull request is introducing
This solver seems to work particularly well for cases like
combustor.py
, where the interest is in solving for a number of nearby steady-state conditions:At least in this case, it is a drop-in replacement for
sim.advance_to_steady_state
.Checklist
scons build
&scons test
) and unit tests address code coverage