Skip to content
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

Integral reductions wrongly error on empty location list #3464

Open
seanpearsonuk opened this issue Nov 8, 2024 · 1 comment · May be fixed by #3526
Open

Integral reductions wrongly error on empty location list #3464

seanpearsonuk opened this issue Nov 8, 2024 · 1 comment · May be fixed by #3526
Assignees
Labels
bug Something isn't working

Comments

@seanpearsonuk
Copy link
Collaborator

An average of a quantity over an empty location list is undefined so it's OK that we raise an exception. But for simple integration, the result is just zero. So, anything like this is wrong:

>>> solver.fields.reduction.area(locations=[])
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent25.1\cortex\pylib\flapi\services\reduction.py", line 37, in area
    return self._get_value(ctxt, "Area", locations)
  File "C:\ANSYSDev\devZ3\vNNN\commonfiles\CPython\3_10\winx64\Release\python\lib\contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "C:\ANSYSDev\devZ3\vNNN\fluent\fluent25.1\cortex\pylib\flapi\services\reduction.py", line 25, in _get_value
    locations = self._get_location_string(locations, ctxt)
  File "C:\ANSYSDev\devZ3\vNNN\commonfiles\CPython\3_10\winx64\Release\python\lib\site-packages\ansys\fluent\core\services\reduction.py", line 271, in _get_location_string
    return _locns(locations, ctxt)[0][1]
IndexError: list index out of range

Also, for averaging, we are not trapping this exception to escalate it to a higher-level, contextual exception - which we ought to do.

@seanpearsonuk seanpearsonuk added the bug Something isn't working label Nov 8, 2024
@prmukherj prmukherj self-assigned this Nov 14, 2024
@prmukherj prmukherj linked a pull request Nov 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@seanpearsonuk @prmukherj and others