Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Interfacing ANSYS with MATLAB 2

Status
Not open for further replies.

brango

Mechanical
Feb 26, 2008
17
Hello,

I previously, interfaced ANSYS and MATLAB. I used finite element code in MATLAB for a certain design. After optimizing the design in MATLAB, I saved the results (thickness of each element) in a .dat file, and using APDL, I read that file and constructed the same design on ANSYS to verify the results I got in MATLAB.

What I am trying to do now is to directly use ANSYS for finite element. This would give me better results.

So, I have to write an advanced interface code, where MATLAB orders ANSYS to start, reads the results ANSYS got, and start optimizing.

so the structure should look something like this:

MATLAB gives ANSYS design data (example: thickness of each element)

ANSYS does the fEA for the specified data, and saves output.

MATLAB reads the output file and optimizes the design accordingly.

Same cycle keeps repeating until the design is optimized.

This would give me more accurate results, and eliminate the additional step of verifying my design.

If it is too difficult to explain here, maybe you could point me to some online refereces, or books I can buy that tackle this issue.

Thank you for your help.
 
Replies continue below

Recommended for you

I think this could be done in one of three ways - you need a script that controls the running of both programs, plus data transfer between them. So either you write a script in Matlab, in Ansys or in a standalone DOS script. I would be tempted to use Matlab probably as it has the most advanced programming language and is already running some of your programs. So I would suggest you do something like this: write a matlab m file that, for a given input set, runs ansys. Check out section 3.4.1 in the Operations Guide of Ansys for how to run ansys jobs in batch mode. You will need of course to write an APDL input file for ansys to run, and use matlab to edit the parameters in the file (I am not sure exactly how to do this in Matlab, but am very sure that it is possible). In your input file (for ansys) you should include any post processing that you require, and acquire specific results using *get or *vget. You can then write vectors to a text file using *vwrite. You can also write parameters using PARASAV. These can all be written to the same file, or to separate ones - try playing around with it to see what format they appear in. Now, you can read the text file from your matlab m file and transfer the parameters to Matlab.

Hope this helps,
Will
 
Dear Brango,

If you had success in writting the mentioned advanced interface code than kindly share it.

Thanks in advance.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor