CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

user_getvar

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2005, 14:57
Default user_getvar
  #1
adma
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

  Reply With Quote

Old   October 25, 2005, 18:20
Default Re: user_getvar
  #2
opaque
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
  Reply With Quote

Old   October 25, 2005, 23:31
Default Re: user_getvar
  #3
adam
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!
  Reply With Quote

Old   October 25, 2005, 23:50
Default Re: user_getvar
  #4
adam
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!
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 21:52.