ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
277 stars 41 forks source link

example commands no longer working #3469

Open millerj97 opened 2 days ago

millerj97 commented 2 days ago

🔍 Before submitting the issue

🐞 Description of the bug

some of the commands in the documentation examples are no longer working;

  1. https://fluent.docs.pyansys.com/version/stable/examples/00-fluent/radiation_headlamp.html# commands under Boundary Conditions;
bc.radiation.diffuse_fraction_band = {"s-": 0.1}
...
>>> >>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".venv/lib/python3.10/site-packages/ansys/fluent/core/solver/flobject.py", line 1143, in __setattr__
    attr = getattr(self, name)
  File ".venv/lib/python3.10/site-packages/ansys/fluent/core/solver/flobject.py", line 1110, in __getattribute__
    attr = super().__getattribute__(name)
AttributeError: 'radiation' object has no attribute 'diffuse_fraction_band'.
.
The most similar names are: diffuse_irradiation_settings.
rad_input_bc.radiation.direct_irradiation = {"s-": 1200}
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".venv/lib/python3.10/site-packages/ansys/fluent/core/solver/flobject.py", line 1143, in __setattr__
    attr = getattr(self, name)
  File ".venv/lib/python3.10/site-packages/ansys/fluent/core/solver/flobject.py", line 1110, in __getattribute__
    attr = super().__getattribute__(name)
AttributeError: 'radiation' object has no attribute 'direct_irradiation'.
.
The most similar names are: direct_irradiation_settings, solar_irradiation, diffuse_irradiation_settings.. Did you mean: 'solar_irradiation'?

It also worth noting in the above example, the did you mean prompt suggests solar_irradiation. But the original command was direct_irradiation, and most similar names contains direct_irradiation_settings. Would this not be the appropriate suggestion?

  1. example https://fluent.docs.pyansys.com/version/stable/examples/00-fluent/parametric_static_mixer_1.html - cannot find the saved flprj file despite saving successful message? for step "Launch Fluent and read saved project"

    
    >>> project_filepath = str(Path(pyfluent.EXAMPLES_PATH) / "static_mixer_study_save.flprj")

solver_session.settings.file.parametric_project.save_as( project_filename=project_filepath )

solver_session.exit()>>> >>> ... ... Current working directory is "pyfl_examples_251/parametric_static_mixer_1/pyfluent_run/project_1.cffdb"

Project saved successfully at "ansys_fluent_core_examples/static_mixer_study_save.flprj"

solver_session = pyfluent.launch_fluent( precision="double", processor_count=2, mode="solver" )

project_filepath_read = str(Path(pyfluent.EXAMPLES_PATH) / "static_mixer_study.flprj")

solver_session.settings.file.parametric_project.open( project_filename=project_filepath_read, load_case=True )... ... nohup: appending output to 'nohup.out'

... ... pyfluent.settings_api WARNING: Mismatch between generated file and server object info. Dynamically created settings classes will be used.

solver_session.settings.file.parametric_project.save() File /ansys_fluent_core_examples/static_mixer_study.flprj does not exists. Traceback (most recent call last): File "", line 1, in Error: api-checks-before-command-or-query: command/query is not active Error Object: "file/parametric-project/save" File "/.venv/lib/python3.10/site-packages/ansys/fluent/core/solver/flobject.py", line 1739, in call return self.execute_command(kwds) File "/.venv/lib/python3.10/site-packages/ansys/fluent/core/solver/flobject.py", line 1663, in execute_command ret = self._execute_command(args, kwds) File "/.venv/lib/python3.10/site-packages/ansys/fluent/core/solver/flobject.py", line 1727, in _execute_command ret = self.flproxy.execute_cmd(self._parent.path, self.obj_name, newkwds) File "/.venv/lib/python3.10/site-packages/ansys/fluent/core/services/settings.py", line 124, in _fn return fn(self, args, kwds) File "/.venv/lib/python3.10/site-packages/ansys/fluent/core/services/settings.py", line 329, in execute_cmd response = self._service_impl.execute_cmd(request) File "/.venv/lib/python3.10/site-packages/ansys/fluent/core/services/settings.py", line 91, in execute_cmd return self.stub.ExecuteCommand(request, metadata=self.metadata) File "/.venv/lib/python3.10/site-packages/grpc/_interceptor.py", line 277, in call response, ignored_call = self._with_call( File "/.venv/lib/python3.10/site-packages/grpc/_interceptor.py", line 329, in _with_call call = self._interceptor.intercept_unary_unary( File "/.venv/lib/python3.10/site-packages/ansys/fluent/core/services/interceptors.py", line 122, in intercept_unary_unary return self._intercept_call(continuation, client_call_details, request) File "/.venv/lib/python3.10/site-packages/ansys/fluent/core/services/interceptors.py", line 112, in _intercept_call raise ex from None RuntimeError: api-checks-before-command-or-query: command/query is not active


### 📝 Steps to reproduce

- from pyfluent session work through the commands in example modeling radiation in a headlamp using the monte carlo method

### 💻 Which operating system are you using?

Linux

### 📀 Which ANSYS version are you using?

v251

### 🐍 Which Python version are you using?

3.10

### 📦 Installed packages

```shell
about-time==4.2.1
alive-progress==3.2.0
ansys-api-fluent==0.3.28
ansys-api-platform-instancemanagement==1.1.0
ansys-api-tools-filetransfer==0.1.1
ansys-fluent-core==0.26.1
ansys-platform-instancemanagement==1.1.2
ansys-tools-filetransfer==0.1.0
ansys-units==0.3.2
beartype==0.19.0
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
docker==7.1.0
grapheme==0.6.0
grpcio==1.67.1
grpcio-health-checking==1.62.3
idna==3.10
importlib_metadata==8.5.0
joblib==1.4.2
lxml==5.3.0
nltk==3.9.1
numpy==1.26.4
pandas==2.2.3
platformdirs==4.3.6
protobuf==4.25.5
psutil==6.1.0
python-dateutil==2.9.0.post0
pytz==2024.2
PyYAML==6.0.2
regex==2024.11.6
requests==2.32.3
six==1.16.0
tqdm==4.67.0
tzdata==2024.2
urllib3==2.2.3
zipp==3.21.0
millerj97 commented 2 days ago

@prmukherj I am working through the examples so will track any issues here, unless you know of any existing issues to fix the examples?

mkundu1 commented 2 days ago

These are settings API changes from 24.2 to 25.1 and there is no backward compatibility entry for these settings.

But, anyway, the documentation examples should reflect the latest settings API. We shall upgrade the Fluent version to 25.1 for doc build after FCA.

seanpearsonuk commented 8 hours ago

The lack of backward compatibility is a major concern. We have told ACE that the API is fully covered by backward compatibility which would have been disseminated to customers. I believe that this is also mentioned in our documentation.

Regarding appropriate suggestions, I note that diffuse_irradiation_settings. seems to be provided as a distinct suggestion from diffuse_irradiation_settings? I wasn't able to reconcile some of the other comments about the suggestions with the output that is provided.

@millerj97 @mkundu1

millerj97 commented 8 hours ago

@cj-hodgson