CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

Trouble setting user scalar and user memory names

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree5Likes
  • 5 Post By tstorm

Reply
 
LinkBack Thread Tools Display Modes
Old   August 5, 2009, 18:10
Default Trouble setting user scalar and user memory names
  #1
Member
 
Join Date: Apr 2009
Posts: 78
Rep Power: 8
tstorm is on a distinguished road
I'm trying to change the names of user-defined scalars and user-defined memory, but it isn't working. I have the following code at the end of my UDF, but it doesn't seem to change the names of the variables in FLUENT (they still show up as uds-0, uds-1, etc.)

What's wrong?

DEFINE_EXECUTE_ON_LOADING(rename_UDvars, libname)
{
Set_User_Scalar_Name(0,"UDS0: k");
Set_User_Scalar_Name(1,"UDS1: e");
Set_User_Scalar_Name(2,"UDS2: v2");
Set_User_Scalar_Name(3,"UDS3: f");
Set_User_Scalar_Name(4,"UDS4: Rxx");
Set_User_Scalar_Name(5,"UDS5: Ryy");
Set_User_Scalar_Name(6,"UDS6: Rzz");
Set_User_Scalar_Name(7,"UDS7: Rxy");
Set_User_Memory_Name(0,"UDM0: Turbulent viscosity");
Set_User_Memory_Name(1,"UDM1: Turbulent time scale");
Set_User_Memory_Name(2,"UDM2: Turbulent length scale");
Set_User_Memory_Name(3,"UDM3: mu_t*StrainRate");
}
tstorm is offline   Reply With Quote

Old   August 6, 2009, 06:02
Default
  #2
Member
 
Daniel Tanner
Join Date: Apr 2009
Posts: 54
Rep Power: 8
Daniel Tanner is on a distinguished road
I tried this before and had problems. I found that if I changed the UDM and UDS memories to zero and press ok and then change them back to 7 UDS's memories and 4 UDM's the names will be there. I found this painful so I just didn't use it.

Let me know how it goes!
Daniel Tanner is offline   Reply With Quote

Old   August 6, 2009, 10:21
Default
  #3
Member
 
Join Date: Apr 2009
Posts: 78
Rep Power: 8
tstorm is on a distinguished road
I tried setting the number of UDMs and UDSs to 4 and 8, then setting them both to 0, then back to 4 and 8 - they're still showing up as uds-0, uds-1, etc. So that didn't work. Thanks for the idea though.
Any other ideas?
tstorm is offline   Reply With Quote

Old   August 6, 2009, 10:35
Default
  #4
Member
 
Join Date: Apr 2009
Posts: 78
Rep Power: 8
tstorm is on a distinguished road
Nevermind, I worked it out. Thanks for your help.

I used a DEFINE_ON_DEMAND command rather than DEFINE_EXECUTE_ON_LOADING. I executed the code after loading the rest of the UDF. This code works:

DEFINE_ON_DEMAND(rename_UDvars)
{
Set_User_Scalar_Name(0,"UDS0: k");
Set_User_Scalar_Name(1,"UDS1: e");
Set_User_Scalar_Name(2,"UDS2: v2");
Set_User_Scalar_Name(3,"UDS3: f");
Set_User_Scalar_Name(4,"UDS4: Rxx");
Set_User_Scalar_Name(5,"UDS5: Ryy");
Set_User_Scalar_Name(6,"UDS6: Rzz");
Set_User_Scalar_Name(7,"UDS7: Rxy");
Set_User_Memory_Name(0,"UDM0: Turbulent viscosity");
Set_User_Memory_Name(1,"UDM1: Turbulent time scale");
Set_User_Memory_Name(2,"UDM2: Turbulent length scale");
Set_User_Memory_Name(3,"UDM3: mu_t*StrainRate");

}
tstorm is offline   Reply With Quote

Old   August 6, 2009, 14:38
Default
  #5
New Member
 
Denis Tschumperle
Join Date: Mar 2009
Posts: 5
Rep Power: 8
tschump is on a distinguished road
There is a "bug" related to the rename macros used in EXECUTE_ON_LOADING macros, so you'll better use those in other macros, like EXECUTE_ON_DEMAND.
tschump is offline   Reply With Quote

Old   April 19, 2013, 01:45
Default
  #6
Member
 
Join Date: Feb 2013
Posts: 31
Rep Power: 4
cinwendy is on a distinguished road
Thank you very much for the post. I am trying to rename my UDS. I am already using DEFINE_ON_DEMAND, but I get the following error:

..\..\src\DEFINE_ON_DEMAND.c(5) : error C2065: '"Si"' : undeclared identifier
..\..\src\DEFINE_ON_DEMAND.c(5) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
..\..\src\DEFINE_ON_DEMAND.c(5) : warning C4024: 'Set_User_Scalar_Name' : different types for formal and actual parameter 2
..\..\src\DEFINE_ON_DEMAND.c(6) : error C2065: '"Ss"' : undeclared identifier
..\..\src\DEFINE_ON_DEMAND.c(6) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'int'
..\..\src\DEFINE_ON_DEMAND.c(6) : warning C4024: 'Set_User_Scalar_Name' : different types for formal and actual parameter 2

...(continue for the rest of the course file)


My source file looks like this:
#include "udf.h"
#include "sg_udms.h"
DEFINE_ON_DEMAND(rename_UDS)
{
Set_User_Scalar_Name(0,”Si”);
Set_User_Scalar_Name(1,”Ss”);
....(similarly for other UDS)...
}

I can, however interpret or compile other UDF without error. May I know how to fix this?

Thanks!
cinwendy is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User defined scalar boundary condition Philip FLUENT 1 December 4, 2013 11:23
solving passive scalar by user function in AVLFIRE huyp Main CFD Forum 0 September 4, 2008 10:21
add user scalar in one phase zhu CFX 0 April 27, 2002 03:45
Using user scalar in USRRAT Jakub CFX 0 April 25, 2002 13:18
User Scalar B/C Greg Perkins FLUENT 5 April 5, 2001 22:29


All times are GMT -4. The time now is 01:08.