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

Trouble setting user scalar and user memory names

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 7 Post By tstorm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2009, 19:10
Default Trouble setting user scalar and user memory names
  #1
Member
 
Join Date: Apr 2009
Posts: 78
Rep Power: 17
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, 07:02
Default
  #2
Member
 
Daniel Tanner
Join Date: Apr 2009
Posts: 54
Rep Power: 18
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, 11:21
Default
  #3
Member
 
Join Date: Apr 2009
Posts: 78
Rep Power: 17
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, 11:35
Default
  #4
Member
 
Join Date: Apr 2009
Posts: 78
Rep Power: 17
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, 15:38
Default
  #5
New Member
 
Denis Tschumperle
Join Date: Mar 2009
Posts: 5
Rep Power: 17
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, 02:45
Default
  #6
Member
 
Join Date: Feb 2013
Posts: 31
Rep Power: 13
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

Old   November 23, 2022, 04:58
Default DEFINE_EXECUTE_ON_LOADING(rename_UDvars, libname)
  #7
New Member
 
wujun
Join Date: Apr 2012
Posts: 13
Rep Power: 14
309558927 is on a distinguished road
(1)I worked it out using the marco EFINE_EXECUTE_ON_LOADING(rename_UDvars, libname);
(2)you are check if used the "sg_udms.h".
309558927 is offline   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


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 11:21
add user scalar in one phase zhu CFX 0 April 27, 2002 04:45
Using user scalar in USRRAT Jakub CFX 0 April 25, 2002 14:18
User Scalar B/C Greg Perkins FLUENT 5 April 5, 2001 23:29


All times are GMT -4. The time now is 17:57.