How can I run ANSYS from MATLAB?
조회 수: 136 (최근 30일)
이전 댓글 표시
Hi,
Would you tell me about the cause and solution for stooping of ANSYS run from MATLAB?
I want to run ANSYS from MATLAB, and I tried "Shell Escape Function" (I wrote the DOS comand after "!").
However ANSYS stopped running at the stage of the solution .
It only indicates ANSYS stopped working.
I think DOS command is not wrong, because it run from CMD.exe, and it runs without problems partway.
I suspect the cause is stack overflow, but I do not know how to identify that.
My PC environment is
Windows 7 Enterprise Intel Core i7 970 16.0GB
Truly yours.
댓글 수: 1
Akash Kunjalwar
2018년 3월 14일
I'm a an undergraduate mechanical engineering student from Osmania University, India. We have to write a code based on calculus in MATLAB and run it in ANSYS APDL as our final project for the course. Please provide the detailed procedure for the same.
채택된 답변
Sarah Palfreyman
2017년 1월 10일
See ANSYS for the MATLAB AAS Toolbox interface.
댓글 수: 2
Zhale Davo
2021년 5월 19일
hi sarah
this link went to ansys homepage and nothing else. how can we as students download the matlab aas toolbox? because for downloading it we need to log in on ansys customer portal and if we are using the student version of ansys we do not have access to that toolbox. so how should we run ansys from matlab? is there any other way than the aas toolbox?
SorMun
2023년 11월 16일
The toolbox is now availabe for download from Mathworks File Exchange at
Thank you
Sorin
추가 답변 (6개)
Nicolai Bloch
2015년 7월 27일
편집: Nicolai Bloch
2015년 7월 27일
Hi All
I also had this issue receiving a error return code -1073741571 (alias c00000fd), which is a Windows error code indicating a stack overflow. Since this is really a system level error, ANSYS doesn't produce any error messages in its own log/error file. Support told me that the problem is related to a particular piece of 3rd party software (OpenMP) used by MATLAB. As of 2014b, when running system commands, the stack size is limited to 512k through an environment variable called KMP_STACKSIZE. It is possible to verify the existence and value of this environment variable by issuing the following command listing all the variables (in Windows):
>>System('SET')
(produces a list of all environment variables currently set...)
For ANSYS to be able to run, you need to increase the stack size before calling the ANSYS executable. You can do this by wrapping the ANSYS call in a batch script or you can do the following:
>>System('SET KMP_STACKSIZE=2048k & "C:\path_to_ansys\ansys[version].exe" [input arguments..]')
I haven't played around with the stack size enough to find a critical value (may also be mesh size/solver dependent). At least the above setting worked for me.
댓글 수: 10
Jiantao Liu
2019년 5월 12일
Thank you so much, buddy, it is hard to find the sulution for this.
It fixed my problem.
Matlab 2018b + ANSYS R19
"It always return a status or ans =-1.0737e+009"
Ola
2014년 11월 20일
Hi, i have the exact same problem as you Yusuke. Ansys stops working just as it's about to calculate the solution. The odd thing is that it works perfectly fine if i run my batch file outside of matlab. Sadly I have not yet found the solution for this problem, but was hoping that you could replay the answer if or when you find it. If not, then i'll try to post my solution if i find one, good luck.
댓글 수: 2
Ola
2014년 11월 23일
Ah, thank you man! This really saved me, running it from 2014a worked for me aswell. Thanks for the quick reply :)
Georg
2015년 6월 3일
I can confirm this behavior when running Matlab 2014b and 2015a with any verison of ANSYS. At the same time it works perfectly with Matlab 2013a. That really annoying. I tried two different ways of initiating the Ansys execution:
cmd = sprintf(['"' ansys_path '"' ...
' -b' ...
' -j ' jobname ...
' -i "' skriptFileName '.inp"' ...
' -o "' outputFilename '.txt"' ...
]);
then:
[o, txt] = system(cmd, '-echo')
... just like:
rt = java.lang.Runtime.getRuntime()
p = rt.exec(cmd)
p.waitFor()
crashes with something I think is a stack overflow.
When running the java-code from e.g. Netbeans (jdk 1.8) it works perfectly. Also the execution from the command prompt works perfectly. So I assume it's definetly a Matlab related problem.
댓글 수: 2
Georg
2015년 6월 3일
FYI:
Problemsignatur:
Problemereignisname: APPCRASH
Anwendungsname: ANSYS.exe
Anwendungsversion: 16.0.0.0
Anwendungszeitstempel: 54808089
Fehlermodulname: ANSYS.exe
Fehlermodulversion: 16.0.0.0
Fehlermodulzeitstempel: 54808089
Ausnahmecode: c00000fd
Ausnahmeoffset: 0000000007dbfe27
Betriebsystemversion: 6.1.7601.2.1.0.256.4
Gebietsschema-ID: 2055
Zusatzinformation 1: c516
Zusatzinformation 2: c516bfdf78867a45b65f55f9a72f0328
Zusatzinformation 3: 2abc
Zusatzinformation 4: 2abc3a60b12a51f515354adc2ddacd65
Lesen Sie unsere Datenschutzbestimmungen online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0407
Wenn die Onlinedatenschutzbestimmungen nicht verfügbar sind, lesen Sie unsere Datenschutzbestimmungen offline:
C:\Windows\system32\de-DE\erofflps.txt
Nicolai Bloch
2015년 12월 18일
As per my original post (above), but using your code instead, this should do the trick:
cmd = sprintf(['SET KMP_STACKSIZE=2048k & "' ansys_path '"' ...
' -b' ...
' -j ' jobname ...
' -i "' skriptFileName '.inp"' ...
' -o "' outputFilename '.txt"' ...
]);
[o, txt] = system(cmd, '-echo');
Seth
2016년 4월 7일
Thank you - this thread was a big help to me several times (I forgot about the problem and rediscovered it a few times) ;-)
댓글 수: 0
Akshay Kumar
2018년 6월 13일
편집: Walter Roberson
2018년 6월 14일
Check this out, might be helpful. https://youtu.be/sE3NkH1m24w using MATLAB to run (ANSYS) APDL macro code
댓글 수: 0
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!