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

Invalid command while defining a material. (battery_cell_tui) #686

Closed
2 tasks done
ypatel-qa opened this issue Jul 30, 2022 · 7 comments · Fixed by #764
Closed
2 tasks done

Invalid command while defining a material. (battery_cell_tui) #686

ypatel-qa opened this issue Jul 30, 2022 · 7 comments · Fixed by #764
Assignees
Labels
bug Issue, problem or error in PyMAPDL

Comments

@ypatel-qa
Copy link
Contributor

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

PyFluent is returning an invalid command error while executing. Same line is working in the Fluent.

solver.execute_tui("/define/materials/change-create aluminum e_material yes constant 2092 yes constant 678 yes constant 18.2 yes defined-per-uds 0 constant 1190000 1 constant 983000 -1 no ")

image

📝 Steps to reproduce

Fluent R23.1 version Build Time: Jul 28 2022 14:05:05 EDT Build Id: 108 (Windows 10)

To reproduce run (attached mesh and python files):

import ansys.fluent.core as pyfluent
import json
launch_parameters = {'precision': 'double', 'processor_count': 4, 'version': '3d', 'meshing_mode': False}
session = pyfluent.launch_fluent(**launch_parameters)
solver = session.solver.root
solver.dict['execute_tui'] = lambda x: session.scheme_eval.scheme_eval(
f'(ti-menu-load-string {json.dumps(x)} #t)'
)

solver.file.read(file_type = "case", file_name = "unit_battery.msh")
solver.mesh.check()
solver.execute_tui("/define/models/addon-module 8 ")
solver.setup.general.solver.time = "unsteady-1st-order"
solver.setup.models.energy = {"enabled" : True}
solver.execute_tui("/define/models/battery-model/enable-battery-model? yes ")
solver.execute_tui("/define/models/battery-model/model-parameters yes yes yes 14.6 no 0 0 0 1 0 3 4.3 ")
solver.execute_tui("/define/models/battery-model/electric-field-model/conductive-regions 2 () 3 4 () no ")
solver.execute_tui("/define/models
files.zip
/battery-model/electric-field-model/current-tap 9 () ")
solver.execute_tui("/define/models/battery-model/electric-field-model/voltage-tap 8 () ")
solver.execute_tui("(models-changed) ")
solver.execute_tui("/define/materials/change-create aluminum e_material yes constant 2092 yes constant 678 yes constant 18.2 yes defined-per-uds 0 constant 1190000 1 constant 983000 -1 no ")

💻 Which operating system are you using?

Windows

🐍 Which Python version are you using?

3.10

📦 Installed packages

alabaster==0.7.12
ansys-api-fluent @ file:///C:/shared/PyFluent/ansys-api-fluent-packages/ansys_api_fluent-0.2.0-py3-none-any.whl
ansys-api-mapdl==0.5.1
ansys-api-platform-instancemanagement==1.0.0b3
ansys-fluent-core==0.10.0
-e git+https://github.com/pyansys/pyfluent-parametric@69a32f434cefa1d4fa8de86083032081fb96fbee#egg=ansys_fluent_parametric
ansys-fluent-solver==0.8.dev0
-e git+https://github.com/pyansys/pyfluent-ui@b0fb69c2cbef1f4af095b9a2ae73737422ce5dc0#egg=ansys_fluent_ui
ansys-fluent-visualization @ file:///C:/shared/PyFluent/PyFluent-packages/ansys_fluent_visualization-0.4.0-py3-none-any.whl
-e git+https://github.com/pyansys/pymapdl.git@d9b0276b682795118501ccadf0dadea555879454#egg=ansys_mapdl_core
ansys-mapdl-reader==0.51.14
ansys-platform-instancemanagement==1.0.2
ansys-sphinx-theme==0.4.2
anyio==3.6.1
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.5
atomicwrites==1.4.0
attrs==21.4.0
Babel==2.10.1
backcall==0.2.0
beautifulsoup4==4.11.1
black==22.3.0
bleach==5.0.0
Brotli==1.0.9
certifi==2022.5.18.1
cffi==1.15.0
cfgv==3.3.1
charset-normalizer==2.0.12
click==8.1.3
colorama==0.4.4
cycler==0.11.0
dash==2.5.0
dash-bootstrap-components==1.1.0
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-table==5.0.0
dash-vtk==0.0.9
debugpy==1.6.0
decorator==5.1.1
defusedxml==0.7.1
distlib==0.3.4
docformatter==1.4
docutils==0.17.1
entrypoints==0.4
executing==0.8.3
fastjsonschema==2.15.3
filelock==3.7.1
Flask==2.1.2
Flask-Compress==1.12
fonttools==4.33.3
geomdl==5.3.1
googleapis-common-protos==1.56.2
grpcio==1.46.3
identify==2.5.1
idna==3.3
imageio==2.19.3
imagesize==1.3.0
importlib-metadata==4.11.4
iniconfig==1.1.1
ipycanvas==0.12.0
ipyevents==2.0.1
ipykernel==6.15.0
ipython==8.4.0
ipython-genutils==0.2.0
ipyvtklink==0.2.2
ipywidgets==7.7.0
isort==5.10.1
itsdangerous==2.1.2
jedi==0.18.1
Jinja2==3.1.2
json5==0.9.8
jsonschema==4.6.0
jupyter-client==7.3.4
jupyter-core==4.10.0
jupyter-server==1.18.0
jupyter-sphinx==0.4.0
jupyterlab==3.4.3
jupyterlab-pygments==0.2.2
jupyterlab-server==2.14.0
jupyterlab-widgets==1.1.0
kiwisolver==1.4.2
livereload==2.6.3
MarkupSafe==2.1.1
matplotlib==3.5.1
matplotlib-inline==0.1.3
mistune==0.8.4
mypy-extensions==0.4.3
nbclassic==0.3.7
nbclient==0.6.4
nbconvert==6.5.0
nbformat==5.4.0
nest-asyncio==1.5.5
nodeenv==1.6.0
notebook==6.4.12
notebook-shim==0.1.0
NotFound==1.0.2
numpy==1.22.4
numpydoc==1.4.0
packaging==21.3
pandas==1.4.2
pandocfilters==1.5.0
parso==0.8.3
pathspec==0.9.0
pickleshare==0.7.5
Pillow==9.1.1
platformdirs==2.5.2
plotly==5.8.2
pluggy==1.0.0
pre-commit==2.19.0
prometheus-client==0.14.1
prompt-toolkit==3.0.29
protobuf==3.20.1
protoc-gen-swagger==0.1.0
psutil==5.9.1
pure-eval==0.2.2
py==1.11.0
pyansys-sphinx-theme==0.3.1
pycparser==2.21
pydata-sphinx-theme==0.9.0
pyfluent-dash-components @ git+https://github.com/pyansys/pyfluent-dash-components.git@78e1483a51e2695d2520c55aa198b4c7d28a94d5
Pygments==2.12.0
pyiges==0.2.1
pypandoc==1.8.1
pyparsing==3.0.9
pyrsistent==0.18.1
PySide6==6.2.3
pytest==7.1.2
pytest-mock==3.8.2
pytest-sphinx==0.4.0
python-dateutil==2.8.2
pytz==2022.1
pyvista==0.33.2
pyvistaqt==0.7.0
pywin32==304
pywinpty==2.0.5
PyYAML==6.0
pyzmq==23.2.0
QtPy==2.1.0
requests==2.27.1
scipy==1.8.1
scooby==0.5.12
Send2Trash==1.8.0
shiboken6==6.2.3
six==1.16.0
sniffio==1.2.0
snowballstemmer==2.2.0
soupsieve==2.3.2.post1
Sphinx==4.4.0
sphinx-autobuild==2021.3.14
sphinx-autodoc-typehints==1.17.0
sphinx-copybutton==0.5.0
sphinx-gallery==0.10.1
sphinx-notfound-page==0.8.3
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-websupport==1.2.4
sphinxemoji==0.2.0
stack-data==0.3.0
tenacity==8.0.1
terminado==0.15.0
tinycss2==1.1.1
toml==0.10.2
tomli==2.0.1
tornado==6.1
tqdm==4.64.0
traitlets==5.3.0
untokenize==0.1.1
urllib3==1.26.9
virtualenv==20.14.1
vtk @ https://github.com/pyvista/pyvista-wheels/raw/main/vtk-9.1.0.dev0-cp310-cp310-win_amd64.whl
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.3.3
Werkzeug==2.1.2
widgetsnbextension==3.6.0
zipp==3.8.1
@ypatel-qa ypatel-qa added the bug Issue, problem or error in PyMAPDL label Jul 30, 2022
@ypatel-qa
Copy link
Contributor Author

Another similar failure,

solver.execute_tui("/define/materials/change-create air water yes constant 1000 no no yes constant 0.001 no no no yes ")

Reordering domain using Reverse Cuthill-McKee method:
zones, cells, faces, done.
Bandwidth reduction = 25/25 = 1.00
Done.
Changing Discretization Scheme for Momentum to First Order Upwind
Pseudo Time Method settings are adjusted.

Adjusting the following settings:
Changing Discretization Scheme for Turbulent Kinetic Energy: from: Second Order Upwind to: First Order Upwind
Changing Discretization Scheme for Specific Dissipation Rate: from: Second Order Upwind to: First Order Upwind
Changing Discretization Scheme for Pressure to PRESTO!
water is a fluid

Density

Viscosity

invalid command [yes]

@mkundu1
Copy link
Contributor

mkundu1 commented Aug 1, 2022

The issue here is *cx-yes-no-prompt?* is set to false in Fluent during remote call execution. We need to provide an execute_tui function for PyFluent which enables these prompts.

@mkundu1
Copy link
Contributor

mkundu1 commented Aug 1, 2022

Following definition of execute_tui fixes the issue:

solver.__dict__['execute_tui'] = lambda x: session.scheme_eval.scheme_eval( f'(tui-menu-execute {json.dumps(x)} "")' )

Will add this method in new solver/meshing sessions (#611)

@mkundu1 mkundu1 self-assigned this Aug 1, 2022
@mkundu1 mkundu1 moved this to Ongoing in PyFluent Public Roadmap Aug 1, 2022
@ypatel-qa
Copy link
Contributor Author

@mkundu1 Thank you. I confirm the fix.

@ypatel-qa
Copy link
Contributor Author

ypatel-qa commented Aug 2, 2022

@mkundu1 I am still seeing some "invalid" commands with the solver.dict['execute_tui'] = lambda x: session.scheme_eval.scheme_eval( f'(tui-menu-execute {json.dumps(x)} "")' )

To reproduce: Please run attached script.
adjoint_files.zip

@mkundu1
Copy link
Contributor

mkundu1 commented Aug 24, 2022

adj_cylinder_tui_s1.pyansys.py.txt

Above is the updated script which will work after the linked PR is merged.

@mkundu1 mkundu1 linked a pull request Aug 24, 2022 that will close this issue
@mkundu1 mkundu1 moved this from Ongoing to Done in PyFluent Public Roadmap Aug 30, 2022
@ypatel-qa
Copy link
Contributor Author

@mkundu1 Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue, problem or error in PyMAPDL
Projects
Status: 2021-2024
Development

Successfully merging a pull request may close this issue.

2 participants