|
[Sponsors] |
October 25, 2005, 14:57 |
user_getvar
|
#1 |
Guest
Posts: n/a
|
I has some experience of using user fortran in cfx4.4 and just started to use user fortran in cfx5. Really have hard time to switch.
Right now I am trying to extract fluid "Dynamic viscosity" in user fortran and do some modification. I tried with user_getvar, but running cfx5mkext always says "unresolved external symbol _USER_GETVAR@36.....". Do I miss something here, e.g., missing include some .h files? My sample code is below. Can someone send me a user_getvar example code? Thanks! My email stonebrook2003@hotmail.com #include "cfx5ext.h" dllexport(myviscosity) SUBROUTINE myviscosity ( & NLOC, NRET, NARG, RET, ARGS, CRESLT, CZ,DZ,IZ,LZ,RZ ) #include "MMS.h" #include "stack_point.h" INTEGER NLOC,NARG,NRET C CHARACTER CRESLT*(*) C REAL ARGS(NLOC,NARG), RET(NLOC,NRET) C INTEGER IZ(*) CHARACTER CZ(*)*(1) DOUBLE PRECISION DZ(*) LOGICAL LZ(*) REAL RZ(*) C ------------------------------ __stack_point__ PVISCOSITY end C Send any diagnostic messages via master process. CALL MESAGE( 'WRITE','Hello World!' ) C C Initialise RET(1:NLOC*NRET) to zero. CALL SET_A_0( RET, NLOC*NRET ) C C Copy first argument ARGS(1:NLOC,1) to RET(1:NLOC,1). CALL SET_A_B( RET, ARGS, NLOC ) C C Set success flag. CRESLT = 'GOOD' CALL USER_GETVAR ('DYNAMIC VISCOSITY',CRESLT,PVISCOSITY, + CZ,DZ,IZ,LZ,RZ) C LATER END |
|
October 25, 2005, 18:20 |
Re: user_getvar
|
#2 |
Guest
Posts: n/a
|
Dear Adma,
I have always used the following call CALL USER_GETVAR(User_Name, CRESLT, pVAR, CZ,DZ,IZ,LZ,RZ) I never hardcode the User_Name in the arg list, and in your case it should say 'Dynamic Viscosity' since ANSYS CFX solver is case sensitive to user names. The @36 in the compiler message indicates that the summation of the types of all arg in the list takes 36 bytes. It seems as if you have 9 arguments of 4 bytes each: - CZ,DZ,IZ,LZ,RZ are each 4 bytes for a partial sum of 20bytes - pVISCOSITY is 4 bytes - CRESLT is 4 bytes - For 'DYNAMIC VISCOSITY' I have no idea. Good luck |
|
October 25, 2005, 23:31 |
Re: user_getvar
|
#3 |
Guest
Posts: n/a
|
Thank you first for your kind reply. I keep having the problem I described. I guess I must make a very simple mistake and I am just blind to it.
Would you send me or post here a short CFX user fortran code using USER_GETVAR? I think I will know where is my problem if I can see a correct sample. Thanks a lot! |
|
October 25, 2005, 23:50 |
Re: user_getvar
|
#4 |
Guest
Posts: n/a
|
just found my problem, missing something in the early part of the code...better be more careful. Ready for next step.
Thanks for help! |
|
|
|