Conversation
|
Rebased onto Two things surfaced while verifying the rebase, fixed in a fourth commit:
With both fixed, a PFR at
|
There was a problem hiding this comment.
Pull request overview
Adds Plug Flow Reactor (PFR) support to T3’s flux diagram generation utilities by introducing a PFR simulation path and threading reactor-type metadata through diagram generation so outputs are labeled appropriately.
Changes:
- Added
reactor_type,surface_names, andn_cellsplumbing intogenerate_flux()/ simulation profile generation, including a newrun_pfr()/set_pfr()implementation. - Updated flux diagram generation APIs (
generate_flux_diagrams(),create_digraph()) to acceptreactor_typeand include it in diagram labels. - Updated unit tests to pass
reactor_typeintocreate_digraph()calls.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tests/test_utils/test_flux.py | Updates test invocations to match the updated create_digraph() signature. |
| t3/utils/flux.py | Adds PFR simulation support and threads reactor_type through flux diagram generation and labeling. |
Suppressed comments (2)
t3/utils/flux.py:171
- Same issue as in
generate_flux:n_cellsis annotated as optional, but the PFR path requires a positive integer. The signature should reflect the actual contract.
n_cells: int | None = 100,
t3/utils/flux.py:477
run_pfr()divides bytauto computeflow_rate; if any requested residence time is 0 or negative, this will crash (or yield meaningless results). Add input validation similar torun_batch_p().
profiles = dict()
stoichiometry = get_rxn_stoichiometry(gas)
for tau in times:
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if surface_names: | ||
| for surface in surfaces: | ||
| surface_reactions = surface.reactions() | ||
| surface_phase = surface(surface_names.index(surface.name)).thermo | ||
| surface_rops = surface_phase.net_rates_of_progress |
There was a problem hiding this comment.
Confirmed, and the second half of your comment is the more serious part — deliberately left as-authored for now rather than fixed blind. set_pfr builds its own ct.Interface per cell and attaches those to the reactors, so the surfaces list run_pfr reads ROPs from was never attached to anything and never advanced: even with the call fixed, those ROPs would come from an unintegrated phase still at the inlet state. No model in tests/data/models carries a surface phase, so any rewrite here would be untestable in this repo. Flagging rather than guessing; this wants either a surface-bearing test fixture or set_pfr returning the interfaces it created.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #162 +/- ##
==========================================
- Coverage 72.77% 72.76% -0.01%
==========================================
Files 37 37
Lines 5932 6004 +72
Branches 1289 1307 +18
==========================================
+ Hits 4317 4369 +52
- Misses 1170 1187 +17
- Partials 445 448 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Two defects that kept the PFR path from producing correct results: - `set_pfr` and `run_pfr` assigned `gas.TPX = T, P, ...`, but `P` arrives in bar everywhere in this module -- `set_jsr` and `run_batch_p` both convert with `P * 1e5`. A PFR requested at 1 bar was simulated at 1 Pa. - `set_pfr` passed `master=` to `ct.PressureController`, renamed `primary=` in Cantera 3.x. Since the repo pins `cantera >=3.2.0`, `run_pfr` raised TypeError on its first call and the PFR path never ran. The `surface_names` path remains untested; no test model carries a surface phase.
No description provided.