Skip to content

PFR flux: surface (heterogeneous) reaction support is broken #182

Description

@alongd

Correction (see history): this issue was first filed on the assumption that the surface commit would be dropped from #162 before merge. It was not — #162 merged with all four commits, so 34de194 and the defects below are in main now. This is a bug report, not a feature request.

#162 added a PFR reactor to the flux diagram generator. Its surface-reaction support does not work: passing a non-empty surface_names raises, and even past the raise the numbers it would report are meaningless.

The defects

Both in t3/utils/flux.py, introduced by 34de194:

  1. ct.Interface is not called that way. run_pfr does surface(surface_names.index(surface.name)).thermo, which raises as soon as surface_names is non-empty. The gas-phase path is unaffected — surface_names defaults to None and nothing reaches this block.

  2. The instances read are not the instances simulated. This is the deeper one. set_pfr constructs its own ct.Interface per cell:

    for surface in surfaces:
        surface_instance = ct.Interface(model_path, name=surface.name, phases=[gas_cell])
        ct.ReactorSurface(surface_instance, reactor)

    and attaches those to the reactors, while run_pfr reads rates off the outer surfaces list it built separately. Those objects are never attached to any reactor and never advanced, so even with (1) fixed the reported ROPs would come from an unintegrated phase still at inlet conditions.

What a fix needs

  • set_pfr to return the ct.ReactorSurface / ct.Interface objects it creates, so run_pfr reads rates from the phases that were actually integrated — presumably from the last cell, to match how the gas-phase outlet state is taken.
  • A decision on which cell's surface state the diagram should represent (outlet only, or summed along the reactor).
  • A surface-bearing test fixture. Nothing in tests/data/models/ carries a surface phase, which is why this path is untested in either direction and why the defects survived to main. A small gas+surface mechanism would also let test_pfr_physics_and_profiles be extended.

Interim

Until it is fixed, surface_names should be treated as unsupported. Worth considering an explicit NotImplementedError when it is passed, so it fails with a clear message rather than an ct.Interface object-not-callable error.

Context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions