ansys / ansys/pyfluent

potential solver module name clash

Open
#4,154 3 comments 0 reactions 1 assignee Claimed by @prmukherj View on GitHub
documentation
Dominant language
Python
Stars
497
Forks
77
Avg merge
22h 37m
Merged PRs (30d)
45

Description

### `solver` module name clashes with the global session name in the Fluent Python console in solution mode.
It's currently necessary to work carefully to avoid a clash. The PyFluent side effect behaviour below is not obvious in terms of what's happened. In either scenario, many users will struggle to know how to resolve this. Shall we extend the troubleshooting section and the documentation for this `solver` settings module to provide some guidance? A name change could be in order but the documentation will be valuable for PyConsole users regardless.

#### In PyFluent

```python
>>> from ansys.fluent.core import solver
>>>
>>> solver.Energy

>>> solver = pf.launch_fluent()
Exception ignored in:
>>> solver.Energy
Traceback (most recent call last):
File "", line 1, in
File "\session_solver.py", line 347, in __getattr__
raise ex
File "\session_solver.py", line 338, in __getattr__
return super().__getattribute__(name)
AttributeError: 'Solver' object has no attribute 'Energy'
>>> from ansys.fluent.core import solver as solver_mod # workaround
>>> solver_mod.Energy

>>> solver = pf.launch_fluent()
>>> solver

>>> solver_mod.Energy

>>> pf.solver.Energy # we actually only document this format

```

#### In PyConsole

```python
>>> from ansys.fluent.core import solver
SyntaxError: The following global variables have been reverted to their original value: solver.
>>> solver.Energy
Traceback (most recent call last):
File "", line 1, in
File "\session_solver.py", line 355, in __getattr__
return getattr(self._settings_api_root, attr)
AttributeError: 'SettingsRoot' object has no attribute 'Energy'
>>>
>>> from ansys.fluent.core import solver
SyntaxError: The following global variables have been reverted to their original value: solver.
>>> from ansys.fluent.core import solver as solver_mod # workaround
>>> solver_mod.Energy

>>> solver

>>> ansys.fluent.core.solver.Energy

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.