|
[Sponsors] |
March 7, 2005, 19:42 |
Fortran subroutine
|
#1 |
Guest
Posts: n/a
|
Hi cfx-users.
I'm using CFX 5.7.1, and I'm trying to get the second derivative of some variables. For that, I'm using a Fortran routine to obtain the derivative of a variable. But I'm facing with problems. My routine looks like this: #include "cfx5ext.h" dllexport(grad2p) SUBROUTINE GRAD2P (NLOC, NRET, NARG, RET, ARGS, CRESLT, & CZ,DZ,IZ,LZ,RZ) IMPLICIT NONE C Calculate magnitude of the additional variable gradient #include "stack_point.h" C Result flag CHARACTER CRESLT*(*) INTEGER NLOC INTEGER NARG INTEGER NRET REAL ARGS(NLOC,NARG) REAL RET(NLOC,NRET) INTEGER IZ(*) CHARACTER CZ(*)*(1) DOUBLE PRECISION DZ(*) LOGICAL LZ(*) REAL RZ(*) __stack_point__ pGradrv C Obtain AV gradient and calculate its magnitude CALL USER_GETVAR ('mypgrad.Gradient',CRESLT, pGradrv, & CZ,DZ,IZ,LZ,RZ) CALL SET_A_magU (RET(1,1), RZ(pGradrv), 3, NLOC) END I then I get the following error message when I compile it: Linking... .\Debug\essai.obj : fatal error LNK1136: invalid or corrupt file Error executing link.exe. Fortran_routine.exe - 1 error(s), 0 warning(s) As I'm not so good in Fortran, I don't know where does this error comes from (even by checking the help and some books). So I wonder if someone can help me with that (it would be really kind), or if someone is faced with the same situation by trying to get the second derivative of variables. I need some help. Thanks Best regards, Thomas |
|
March 8, 2005, 07:14 |
Re: Fortran subroutine
|
#2 |
Guest
Posts: n/a
|
hi,
what compiler do you use? regards peter |
|
March 8, 2005, 07:46 |
Re: Fortran subroutine
|
#3 |
Guest
Posts: n/a
|
Hi.
I'm using Compaq Visual Fortran Standard Edition 6.6.a. (Developper Studio). Regards, Thomas |
|
March 9, 2005, 01:41 |
Re: Fortran subroutine
|
#4 |
Guest
Posts: n/a
|
Thomas,
This file should not be linking. Are you compiling with the cfx5mkext script? Try: cfx5mkext filename.F Make sure the file has an uppercase F on the end. The cfx5 script requires the Fortran pre-processor to be run on the file for the included header files. The uppercase F ensures that. Jeff |
|
March 11, 2005, 10:26 |
Re: Fortran subroutine
|
#5 |
Guest
Posts: n/a
|
Hi.
Thank you for this advise Jeff. But now it's an error occuring with the following message: Error: Syntax error, found END-OF-STATEMENT when expecting one of: ( : % . = => __stack_point__ pGradrv rror: This statement is positioned incorrectly and/or has syntax errors. __stack_point__ pGradrv It seems to be the definition of the stack point, but I don't know exactly what's going on? Who can help me? Thanks Thomas |
|
March 12, 2005, 12:40 |
Re: Fortran subroutine
|
#6 |
Guest
Posts: n/a
|
Look at one of the examples. __stack_point__ is a variable type pGradv is the variable. Make sure you've got as space between the type and the variable, as well as being careful with the number of underscores in th type (I may have them wrong above).
Jeff |
|
March 14, 2005, 07:59 |
Re: Fortran subroutine
|
#7 |
Guest
Posts: n/a
|
Hey.
Yes of course I looked carefully at the examples, and I think I haven't done any mistakes. But it still doesn't work when I compile it! Is it working for you if you try to compile it?? Thanks, Thomas |
|
March 14, 2005, 23:00 |
Re: Fortran subroutine
|
#8 |
Guest
Posts: n/a
|
I've not had any problem with this. I can't tell exact syntax and columns on these posting because all your lines end up in column 1 on CFD-online. It does look here that there is no space between your type and your variable pGrad. Of course this may not be the case in your actual code.
Last guess is that the compiler you're using is forcing Fortran 95. I've gotten Fortran 95 to work, but the #include has been replaced by something called a DEC directive. If this is the case, your stackpoint.h header file is not being properly included, and your pointer type is then not defined or understood. Also (I may have mentioned this above) the file name must end in .F (uppercase) to invoke the Fortran pre-processor which compiles the header file. Those are all I can think of. Jeff |
|
March 14, 2005, 23:02 |
Re: Fortran subroutine
|
#9 |
Guest
Posts: n/a
|
Can you compile one of the examples, or even one of the templates with out a problem?
Jeff |
|
March 17, 2005, 09:09 |
Re: Fortran subroutine
|
#10 |
Guest
Posts: n/a
|
Hi,
i tried to compile your file, too. It works. I used Compaq Visual Fortran 6. Did you use cfx5mkext from the command window? Claudia |
|
March 18, 2005, 08:42 |
Re: Fortran subroutine
|
#11 |
Guest
Posts: n/a
|
Hi.
Thank you. As you said, it seems that the include statement is not recognized. And it the same when I compile some example in the tutorials. Nevertheless, when I use cfx5mkext from the command window, it works. So maybe it's ok like this? But my simulation is still not working, but for another problem... regards, Thomas |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fortran Subroutine Error | sergiorbrett | CFX | 12 | September 3, 2012 08:40 |
Fortran subroutine (Perl not found) | gillou_sk8@hotmail.com | CFX | 0 | June 20, 2008 10:59 |
error on CFX compile fortran subroutine | billpeace | CFX | 0 | May 18, 2006 05:44 |
FORTRAN Subroutine | Neser25 | CFX | 3 | October 20, 2005 15:55 |
Parallel Processing of Fortran Subroutine | Ashwini Mishra | CFX | 1 | November 3, 2004 11:02 |