CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   How to Start ANSYS CFD-POST from MATLAB? (https://www.cfd-online.com/Forums/cfx/133809-how-start-ansys-cfd-post-matlab.html)

juzer_700 April 21, 2014 07:59

How to Start ANSYS CFD-POST from MATLAB?
 
Hello Guys,

I want to write a code in matlab which starts ansys cfd-post, loads the result file and then loads the session file.

I will really appreciate any help from you guys.

Steps:
1) Start CFD-Post
2) Load .res file
3) Load .cse file

Thanks.

ghorrocks April 22, 2014 07:06

Load up CFD-Post and record a session file. Do the actions you describe and the commands to do it get recorded in the session file. Then you have a text file for the session file you can edit to do whatever you want.

juzer_700 April 22, 2014 08:43

Quote:

Originally Posted by ghorrocks (Post 487472)
Load up CFD-Post and record a session file. Do the actions you describe and the commands to do it get recorded in the session file. Then you have a text file for the session file you can edit to do whatever you want.

Thanks for your valuable suggestion.

I did the same. Now I a have a session file (say Session2.cse) which

1) loads the result file,
2) then performs all tasks (such as goemetry spilt-up and storing values in another .txt file) and
3) then quits CFX-Post.

But my problem remains the same.

I can use system() command in matlab to start CFX-POST. But then how do I load the Session2.cse file which performs the three steps.

Is there a command I can give from matlab or run the .cse file or any command line that loads the session file in CFX-Post

Thanking you in anticipation.

Lance April 22, 2014 09:43

cfdpost accepts the following arguments:
[-gui|-line|-batch <file>] [-report <option> [-outdir <dir>] [-name <name>]]
[-graphics ogl|mesa] [-state <statefile>] [-session <sessionfile>]
[-display <display>] [-multiconfig single|separate|last] [-help] [-v]

so,
Code:

cfdpost -session my_session_file.cse
would then start post and load the file "my_session_file.cse".

juzer_700 April 23, 2014 12:00

Quote:

Originally Posted by Lance (Post 487510)
cfdpost accepts the following arguments:
[-gui|-line|-batch <file>] [-report <option> [-outdir <dir>] [-name <name>]]
[-graphics ogl|mesa] [-state <statefile>] [-session <sessionfile>]
[-display <display>] [-multiconfig single|separate|last] [-help] [-v]

so,
Code:

cfdpost -session my_session_file.cse
would then start post and load the file "my_session_file.cse".

Thanks for your help.

Initially I wrote this code in Matlab:

status=system('cd /ansys_inc/v145/CFD-Post/bin/');
status=system('&cfdpost -line);

This opened a command promt of CFX in Matlab where again I had to type

CFX< readsession filename=Session_final.cse

I wanted to avoid this as it became manual entering of command. But then with your help I used the below code which worked perfectly fine.

status=system('cd /ansys_inc/v145/CFD-Post/bin/');
status=system('cfdpost -session Session_final.cse');

This automatically does everything I wanted. Thanks for your help.

smartsoldier July 12, 2014 10:01

I am trying to do the same as you, however my MATLAB won't connect the two system() commands. When I run them I get an error: cfdpost not valid command. As if it is trying to run cfdpost from a regular cmd that hasn't navigated to the cfdpost folder, even though I told it to on the line before. Any ideas?

cfd seeker May 14, 2015 10:25

@Lance @Juzer

Can you guys tell me if there is any difference between the session file created on Linux platform and Windows? do the session file created on Linux should work on Windows PC also?

Best Regards

cfd seeker May 15, 2015 07:57

Quote:

status=system('cd /ansys_inc/v145/CFD-Post/bin/');
status=system('cfdpost -session Session_final.cse');
@Juzer @Lance
The above commands(syntax) is working for me on Linux but not on Windows. Any suggestions how I can implement it on windows?

ghorrocks May 15, 2015 08:02

Didn't I just answer this question on your other thread? http://www.cfd-online.com/Forums/cfx...ows-linux.html


All times are GMT -4. The time now is 05:29.