Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling ANSYS from MATLAB

Status
Not open for further replies.

jpblasques

Marine/Ocean
Nov 24, 2006
20
0
0
DK
Hi everyone!

I have two batch files written in ANSYS APDL which I want to call from MATLAB. There is a small twist to it which is I would like to run them in parallel and not sequentially.

I am running both programs in a UNIX machine. ANSYS is a commercial FE code which I use for structural analysis.

So up to now I sorted out the following:

1. In the UNIX command prompt I can write something like

ansys100 <./Msc/Scripts/COMBI_SURF/MAIN.txt >./Msc/WD/OUT1.out -p aunivres -j Prop1 -s read -b list & ansys100 <./Msc/Scripts/COMBI/MAIN.txt >./Msc/WD/OUT2.out -p aunivres -j Prop2 -s read -b list &

which will run the two batch files (almost) in parallel. Note that this are two commands to launch ANSYS in batch mode separated by a '&'.

2. In MATLAB I can use the commands 'unix' or 'system' in order to write the former command to the command prompt. MATLAB would wait for the ANSYS analysis to finish before proceeding with the rest of the matlabe code if it was only one command. In this case there is a certain delay and the first command will finish first thus "saying" MATLAB that the analysis in ANSYS is over when in fact it is not true.

I think that the best solution for this problem would be to find a way to tell MATLAB to wait for a certain file (an output file from ANSYS) to exsit in a given directory before continuing reading from the MATLAB file. In this case, MATLAB would wait for the output from the second batch analysis before proceeding and my problems would be over.

Has anyone ever came across this problem and if so could you please help me with some tips? Do you have any other way of doing this?

Thanks a lot in advance.



DTU
Denmark
 
Status
Not open for further replies.
Back
Top