PyFluent: How to get the zone ID when zone name is known?

Rolf Reinelt
Rolf Reinelt Member, Employee Posts: 2 ✭✭✭

I know that I can get face and cell zones with
solver.setup.boundary_conditions.get_state()
solver.setup.cell_zone_conditions.get_state()

From this I can get the names.
But some commands require to use the ID (a number) instead, for example
solver.tui.define.models.battery_model.electric_field_model.contact_resistance_regions()

Is there a PyFluent way to figure out the ID of a zone?

Tagged:

Answers

  • PabloA
    PabloA Member, Employee Posts: 2
    Name Dropper First Comment First Anniversary Ansys Employee
    ✭✭✭

    Hi @Rolf Reinelt ,

    For models that are not yet exposed, you can trigger an auxiliary Scheme interface to get those. In your case, you can get the id of a zone "mywall" as follows

    bcname = "mywall"
    id = solver.scheme_eval.scheme_eval(f'(thread-name->id "{bcname}")')

    Note that this way should be superseded by new, pythonic forms as the API develops.