CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF has two DEFINE_PROPERTY statemens, only one available in fluent (https://www.cfd-online.com/Forums/fluent-udf/106423-udf-has-two-define_property-statemens-only-one-available-fluent.html)

Fontan August 28, 2012 14:54

UDF has two DEFINE_PROPERTY statemens, only one available in fluent
 
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.

mali28 August 29, 2012 07:47

Quote:

Originally Posted by Fontan (Post 379163)
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.

Fontan August 29, 2012 17:39

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.

mali28 August 30, 2012 03:55

Quote:

Originally Posted by Fontan (Post 379398)
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.

akm August 30, 2012 07:36

:)
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)
{
..
}


Fontan August 30, 2012 17:09

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.


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