question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ansys.post_processing.plot_nodal_temperature() throws error when changing the ansys directory to the current python directory

See original GitHub issue

ps1. On a different topic, after I updated the library to the current version, no files are created when I run a simulation, so pyansys.read_binary(‘file.rst’) doesn’t work, as no rst file is created.

MAPDL will always create files, but with the latest version it’s going to save the files to a temporary directory for each ANSYS run. Get the directory MAPDL is running in with print(ansys.directory).

I changed the directory to the current python directory, it was storing everything in my temp local appdata, but now I get the following message when I use:

ansys.post_processing.plot_nodal_temperature(window_size=[1920, 1880], cpos='iso', screenshot = str(I)+'A_thermal_iso.png', off_screen=True, stitle='Temperature (deg Celsius)')

Could you help me fix it?

Traceback (most recent call last):

  File "D:\Python projects\opto-thermal-steady-state-new\steady-state.py", line 306, in <module>
    ansys.post_processing.plot_nodal_temperature(window_size=[1920, 1880], cpos='iso', screenshot = str(I)+'A_thermal_iso.png', off_screen=True, stitle='Temperature (deg Celsius)')

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\post.py", line 473, in plot_nodal_temperature
    **kwargs)

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\post.py", line 269, in _plot_point_scalars
    surf = self._mapdl.mesh._surf

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\mapdl.py", line 359, in mesh
    return self._mesh

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\misc.py", line 191, in wrapper
    out = func(*args, **kwargs)

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\mapdl.py", line 379, in _mesh
    self.cmsel('S', '__ELEM__', 'ELEM')

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\mapdl.py", line 264, in __exit__
    self._parent._chain_stored()

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\mapdl.py", line 185, in _chain_stored
    responses = [self._run(command) for command in chained_commands]

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\mapdl.py", line 185, in <listcomp>
    responses = [self._run(command) for command in chained_commands]

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\pyansys\mapdl_corba.py", line 317, in _run
    text = self._server.executeCommandToString(command)

  File "C:\Users\E.Chatzizyrli\AppData\Local\Continuum\anaconda3\lib\site-packages\ansys_corba\ICoMapdlUnit_idl.py", line 206, in executeCommandToString
    return self._obj.invoke("executeCommandToString", _0_AAS_CORBA.MAPDL.Solvers.ICoMapdlUnit._d_executeCommandToString, args)

EAnsysUnknown: AAS_CORBA.MAPDL.Exceptions.EAnsysUnknown(code=-15, description='Low-level communication error -15: Connection was closed', scope='MAPDL', interfaceName='ICoMapdlUnit', operation='executeCommand', moreInfo='CM,__NODE__,NODE$NSLE,S,,$CDWRITE,db,D:\\Python projects\\opto-thermal-steady-state-new\\_tmp.cdb,,,,$CMSEL,S,__NODE__,NODE$CM,__ELEM__,ELEM$ESEL,NONE,,,,,,$CDWRITE,db,D:\\Python projects\\opto-thermal-steady-state-new\\nblock.cdb,,,,$CMSEL,S,__ELEM__,ELEM')

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
echatzizcommented, Jun 18, 2021

You can also close this topic.

0reactions
echatzizcommented, Oct 30, 2020

I renamed the file Python_projects, and it worked for the 40,000 element mesh (4 pixels), but for the 320,000 (8 pixels) element mesh, it didn’t. I get the same pic as the one I attached last time. I cannot understand this behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

“Unable to get working directory” error when using Solve() in ...
I would like to automate my Mechanical simulation (including the solution process) via a Python script. However, if I type.
Read more >
Fluent in Ansys Workbench : Change Working Directory
Hello, I want to run a cfd analysis in Ansys Workbench V16. Unfortunately, Ansys Workbench defines the Fluent workingdirectory as F: (which ...
Read more >
Ansys Mechanical Scripting Training - Python Basics (Day 1)
Lastly, it touches on the common data types used in day-to-day Ansys coding, including List Data type through range command, If statement, ...
Read more >
Mechanical Python scripting - "Unable to get working directory ...
I have some problems with a weird error that sometimes (not always) occurs when I use the "Solve" command in a Mechanical Python...
Read more >
PyAnsys — PyAnsys
Python library that interacts directly with the AEDT API to make scripting simpler. card-img-top ... Pythonic interface to Ansys Fluent parametric workflows.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found