Convert ANSYS.f to Fortran subroutine
Convert ANSYS.f to Fortran subroutine
(OP)
The ansys.f (I have version 8.1) main program allows one to modify it for use as a subroutine in the user's independent Fortran code. I am trying to understand where to place the *USE command in order to call and execute a macro that will build my model. In contrast to the example subroutine given in which multiple calls were made, I will only need to call ANSYS once. Therefore, I can eliminate the DO-Loops and OPEN file statements. Correct???
Also, I have the following code for Subroutine Ansys:
subroutine ansys
#include "impcom.inc
external mainan, menusb
integer mainan
character*640 Command
nCommand = 14
Command = 'START_OF_ANSYS'
200 where = mainan(nCommand,Command)
if (where.eq.-1) goto 900
*** Should I put Command = '*USE,model.mac' here ***
*** since this is the command I want to execute??? ***
call menusb(nCommand,Command)
goto 200
900 return
end
Finally, I was a little puzzled by the presence of the # in the INCLUDE statement. #Include is a C-language command. Fortran 90 should just be INCLUDE 'filename.f' correct. Any ideas?
Also, I have the following code for Subroutine Ansys:
subroutine ansys
#include "impcom.inc
external mainan, menusb
integer mainan
character*640 Command
nCommand = 14
Command = 'START_OF_ANSYS'
200 where = mainan(nCommand,Command)
if (where.eq.-1) goto 900
*** Should I put Command = '*USE,model.mac' here ***
*** since this is the command I want to execute??? ***
call menusb(nCommand,Command)
goto 200
900 return
end
Finally, I was a little puzzled by the presence of the # in the INCLUDE statement. #Include is a C-language command. Fortran 90 should just be INCLUDE 'filename.f' correct. Any ideas?





RE: Convert ANSYS.f to Fortran subroutine
Also, I would like to share with users out there a huge lesson that I learned. At the outset of my work I was attempting to call ANSYS from Matlab 7.1. Now, Matlab allows, through the use MEX functions, one to call any external C/C++ or Fortran programs. I had the Intel 8.1 Fortran compiler which is compatible with both Matlab and ANSYS. I had intended to use Matlab's MEX capability with the ANSYS.f subroutine to automate, on an iterative basis, the running of a set of ANSYS macros. Periodically, the FE solution data would be delivered back to Matlab where it would be further post-processed by my own native Matlab code. Based on certain criterion, the necessity of further ANSYS runs would then be determined and executed. Well, this was a great idea with the exception of one crucial piece of information which was to be the source of my downfall. The capability for ANSYS to run as a subroutine works only on UNIX platforms. Apparently there are some files and some extra program restructuring that the ANSYS company would have to do in order to make this feature work on the Windows OS. This brings me to the wonderful lesson that I learned: WINDOWS SUCKS!!!!!
Fortunately, I have been able to use a "bubblegum and duct tape approach" to solving my problem. Although the lessons I learned are invaluable, I hope that this post will save someone with similar ideas a lot of time. If any UNIX OS users are out there who have used the ANSYS.f subroutine or any of the Fortran capabilities, please submit a post and let me know how well it works and what the steps are to making Fortran code and ANSYS work together.
Thanks,
Tecknique
RE: Convert ANSYS.f to Fortran subroutine