CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

UDF has two DEFINE_PROPERTY statemens, only one available in fluent

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 28, 2012, 14:54
Default UDF has two DEFINE_PROPERTY statemens, only one available in fluent
  #1
New Member
 
Augusto Fontan
Join Date: Aug 2012
Location: Brazil
Posts: 13
Rep Power: 4
Fontan is on a distinguished road
I have made a simple UDF for ideal gas, in order to compare the results with fluent's own ideal gas parameters running the same case. The UDF has two DEFINE_PROPERTY macros, one for the density, the other for the speed of sound, as follows:

Quote:
#include "udf.h"

#define CGAS 287
#define GAMMA 1.4

DEFINE_PROPERTY(fluid_density, c, t)

{

real rho;
real press;
real p_operating;
real temp;
real t_operating;

p_operating = RP_Get_Real ("operating-pressure");
press = C_P(c,t) + p_operating;

t_operating = RP_Get_Real ("operating-temperature");
temp = C_T (c,t) + t_operating;

rho = press/(CGAS*temp);

return rho;
}

DEFINE_PROPERTY (sound_speed, c,t)

{

real a;
real temp;
real t_operating;

t_operating = RP_Get_Real ("operating-temperature");
temp = C_T (c,t) + t_operating;

a=sqrt(GAMMA*CGAS*temp);

return a;

}
I have managed to compile the UDF but, on the materials menu, when trying to set the properties as user-defined, I have only one option: fluid_density::libudf. I cannot find sound_speed as an option and cannot set it properly as a result.

Thanks in advance for the help.
Fontan is offline   Reply With Quote

Old   August 29, 2012, 07:47
Default
  #2
Senior Member
 
Join Date: Jun 2011
Posts: 108
Rep Power: 6
mali28 is on a distinguished road
Quote:
Originally Posted by Fontan View Post
I have made a simple UDF for ideal gas, in order to compare the results with fluent's own ideal gas parameters running the same case. The UDF has two DEFINE_PROPERTY macros, one for the density, the other for the speed of sound, as follows:



I have managed to compile the UDF but, on the materials menu, when trying to set the properties as user-defined, I have only one option: fluid_density::libudf. I cannot find sound_speed as an option and cannot set it properly as a result.

Thanks in advance for the help.
You may try compiling the second one separately and give it a different name.
mali28 is offline   Reply With Quote

Old   August 29, 2012, 17:39
Default
  #3
New Member
 
Augusto Fontan
Join Date: Aug 2012
Location: Brazil
Posts: 13
Rep Power: 4
Fontan is on a distinguished road
Thanks for the reply, mali28.

I did as you suggested, compiling the macros as two separate UDF's. The compilation was succesful, but the problem persists. In the Create/Edit Materials, only fluid_density is visible in the dialog box after choosing user-defined.
Fontan is offline   Reply With Quote

Old   August 30, 2012, 03:55
Default
  #4
Senior Member
 
Join Date: Jun 2011
Posts: 108
Rep Power: 6
mali28 is on a distinguished road
Quote:
Originally Posted by Fontan View Post
Thanks for the reply, mali28.

I did as you suggested, compiling the macros as two separate UDF's. The compilation was succesful, but the problem persists. In the Create/Edit Materials, only fluid_density is visible in the dialog box after choosing user-defined.
Compile sound_speed only and see if that appears in the list.
mali28 is offline   Reply With Quote

Old   August 30, 2012, 07:36
Thumbs up
  #5
akm
New Member
 
Join Date: Jan 2010
Location: United Kingdom
Posts: 27
Rep Power: 7
akm is on a distinguished road

its a trivial error.. (and i can tell u that because i have myself been stuck there before)

Code:
DEFINE_PROPERTY(fluid_density, c, t)
{
..
}

DEFINE_PROPERTY (sound_speed, c,t)
{
..
}
notice a difference between the two? the space character (' ') after DEFINE_PROPERTY and before parenthesis.
for some reason the macro is not loaded to the GUI if this happens.

try using:
Code:
DEFINE_PROPERTY(sound_speed, c,t)
{
..
}
akm is offline   Reply With Quote

Old   August 30, 2012, 17:09
Default
  #6
New Member
 
Augusto Fontan
Join Date: Aug 2012
Location: Brazil
Posts: 13
Rep Power: 4
Fontan is on a distinguished road
Trivial indeed, and that sorted it out. Now it appears in the dialog boxes.

New problem, though: I get the ACCESS_VIOLATION error when trying to initialize it. I have the udf's in the same folder as the case, energy equation is on. Any ideas?

Thank you very much, akm and mali28.
Fontan is offline   Reply With Quote

Reply

Tags
define_property, udf density, udf sound speed

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
fluent udf, saving data in udf mohsen zendehbad Fluent UDF and Scheme Programming 13 March 21, 2014 16:36
Transient pressure UDF for parallel fluent droberts Fluent UDF and Scheme Programming 5 October 11, 2010 04:13
Using Fluent with a UDF frm a remote m/c aarti FLUENT 2 September 11, 2008 19:53
UDF problem caused by various version of Fluent Yurong FLUENT 3 January 15, 2006 11:57
Can somebody send me a Fluent 6 UDF manual?? KKLAU FLUENT 4 April 14, 2004 16:37


All times are GMT -4. The time now is 05:40.