|
[Sponsors] |
Trouble setting user scalar and user memory names |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 5, 2009, 19:10 |
Trouble setting user scalar and user memory names
|
#1 |
Member
Join Date: Apr 2009
Posts: 78
Rep Power: 17 |
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"); } |
|
August 6, 2009, 07:02 |
|
#2 |
Member
Daniel Tanner
Join Date: Apr 2009
Posts: 54
Rep Power: 18 |
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! |
|
August 6, 2009, 11:21 |
|
#3 |
Member
Join Date: Apr 2009
Posts: 78
Rep Power: 17 |
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? |
|
August 6, 2009, 11:35 |
|
#4 |
Member
Join Date: Apr 2009
Posts: 78
Rep Power: 17 |
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"); } |
|
August 6, 2009, 15:38 |
|
#5 |
New Member
Denis Tschumperle
Join Date: Mar 2009
Posts: 5
Rep Power: 17 |
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.
|
|
April 19, 2013, 02:45 |
|
#6 |
Member
Join Date: Feb 2013
Posts: 31
Rep Power: 13 |
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! |
|
November 23, 2022, 04:58 |
DEFINE_EXECUTE_ON_LOADING(rename_UDvars, libname)
|
#7 |
New Member
wujun
Join Date: Apr 2012
Posts: 13
Rep Power: 14 |
(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". |
|
|
|
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 |