Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Control ANSYS with MATLAB

Status
Not open for further replies.

Tecknique

Mechanical
Mar 3, 2005
5
MATLAB 7.0 contains a C language compiler, but there is an additional fee to obtain a FORTRAN compiler. From the documentation notes for both software packages, Compaq Visual Fortran 6.6 is the only one that matches. However, is there still a way to externally control ANSYS by writing the APDL code within a C language program?
 
Replies continue below

Recommended for you

hi ,
I do wnat to know how to control ansys with matlab. I want to cann matlab from ansys letus say iteravative manner. if u know, please do know me. thanks in advance

nagesh
 
Well, I can't say that I know for sure but I'll tell you what I have learned to date. Ansys (I have Ansys version 8.1) gives one the capability to control it using an external user-written fortran program. If you take a look at the UPF's in the Ansys Inc\v81\custom\user directory you will see an Ansys.f file. This file executes the ansys main program call. It also contains an example of how to call ansys from external fortran . I kinda suspect that you can interface with ansys by way of a C-language program because the ansys.f file contains a function call (#include impcom.inc) to a file written in C. If you take a look at the Ansys Inc\v81\custom\include directory I think you will find a number of C-language files; some of which I think can be modified by the user.

Just for clarification, when you say "...control Matlab from Ansys" do you mean that you want to write an APDL program that controls Matlab?? If so, I am not sure if you can do this. Please provide a little more clarification in your next response.

However, what I do think you can do, and maybe this is what you are saying, is to write an external fortran or C program that first calls Ansys to execute a job. After completing the job, that fortran/C program then calls Matlab and delivers Ansys output data into Matlab to be used in further calculation. As I am still grappling with the Fortran-to-Ansys problem, I cannot be of great help yet on this part. However, Matlab allows one to control it with external fortran or C-code using the Mex-function capability. Look up "Mex-Function" in the Matlab online help. Unless you have seen it before, it may possibly take you a while to understand, but C/fortran-to-Matlab is completely possible.

Also, if you are thinking of trying to program for C or Fortran-to-Ansys you will need to look at the M-lab & Ansys documentation to see what compilers are compatible. I read in another thread that obtaining the exact compiler is a MUST. Although I have not proved this statement for myself I have chosen to take it as gospel and spend some money instead of wasting time trying to figure out if this is true. Hope this helps.

Tecknique
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor