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.

Pyansys chokes on retreiving parameters after Do-Loops

See original GitHub issue

Hello Alex, first of all, I’d like to give a big shout-out to you because of your amazing work on pyansys. I’m currently starting my masters thesis in aerospace engineering in Brunswick (Germany). It will deal with the structural optimization of composite structures using Pyansys and PyOpt. This is my first day on GitHub btw.

Now to the issue: I do some slightly time consuming computation inside a *DO-Loop and want to retrieve the result parameter afterwards. But that does not work properly.

I tried do write a meaningful minimal example:

import os
import pyansys

path = os.getcwd()
mapdl = pyansys.launch_mapdl(run_location=path,override=True)

mapdl.run('*dim,SomeArray,array,5')

with mapdl.non_interactive:
    mapdl.run('*do,i,1,5')
    mapdl.run('SomeArray(i)=i')
    mapdl.wait(2) # This represents some time-consuming commands
    mapdl.run('*enddo')
    mapdl.run('*vscfun,MaxValue,max,SomeArray')
    
print(mapdl.parameters['MaxValue'])

Usually, this code should print out 5. But instead, i get: IndexError: MAXVALUE not a valid parameter_name. If i comment out the mapdl.wait(2)-Command, it works fine.

It seems, that pyansys tries to process the mapdl.run('*vscfun,MaxValue,max,SomeArray') command before the Do-loop is finished. That is what i described as “choking” in the title. Strangely, if i unindent this line, it returns 4.

Can you help me with this issue? Thank you in advance, Lukas

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
lukitoxcommented, Oct 2, 2020

Hi Alex. I will send it to you tomorrow or the day after. Thanks!

0reactions
akaszynskicommented, Oct 23, 2020

Awesome! There should be a new interface coming out soon that will also run on Windows, but I’ve found the performance of the MAPDL solver to be about 10% better on Linux anyway. Thanks for following up here!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to connect to APDL server · Issue #207 - GitHub
By running this code for testing: import os import pyansys path = o... ... Pyansys chokes on retreiving parameters after Do-Loops #273.
Read more >
PyAnsys — PyAnsys
Python library that interacts directly with the AEDT API to make scripting simpler. Read and transform finite element data across simulation domains, with ......
Read more >
ANSYS in a Python Web App, Part 1: Post Processing with ...
PyANSYS is split into several packages. PyMAPDL is focused on communicating with a running MAPDL instance (local or remote) which pulls a license...
Read more >
What is PyAnsys and how can it help with simulation? | Video
This short three minute video defines what PyAnsys is and how it can help users integrate Ansys products in a Python environment.
Read more >
How do I interpret .rst results file with python using pyansys ...
What nodes are associated with which values? How are all three results separated? Also, I tried printing random data just to try and...
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