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/)
-   -   ACCESS_VIOLATION error (https://www.cfd-online.com/Forums/fluent-udf/106976-access_violation-error.html)

Fontan September 13, 2012 18:14

ACCESS_VIOLATION error
 
Good evening, everyone.

I'm trying to get the hang of UDF's as I'll need to use them for real gas simulations in the future for my master's program, so I've made a simple UDF for perfect gas in order to test and compare values. I manage to compile it without problem, but when initializing the problem I get the ACCESS_VIOLATION error.

I get the same error when interpreting the UDF, and it also says "temp definition shadows previous definition" after interpreting.

Here is the UDF:

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;

}
Thanks in advance


All times are GMT -4. The time now is 22:23.