Pyansys chokes on retreiving parameters after Do-Loops
See original GitHub issueHello 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:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Hi Alex. I will send it to you tomorrow or the day after. Thanks!
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!