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 compiling problem (https://www.cfd-online.com/Forums/fluent-udf/107377-udf-compiling-problem.html)

epc1 September 25, 2012 19:36

UDF compiling problem
 
Hello i´m trying to compile the following udf:


# include "udf.h"

#define SDEN 2.66e-9
#define MWNI 58.6934
#define KO1 4.22e15
#define KO2 1.955e6
#define KO3 1.020e15
#define R_UNIV 8.314
#define EJ1 240100
#define EJ2 67130
#define EJ3 243900
#define KCH4 6.65e-4
#define KCO 8.23e-5
#define KH2 6.12e-9
#define KH2O 1.77e5
#define ENT1 -38280
#define ENT2 -70650
#define ENT3 -88680
#define ENT4 -82900
#define A1 1/3600
#define AS 5e5

real ksr,kwgs,kdsr;
real Ke1,Ke2,Ke3;
real Kch4,Kco,Kh2o,Kh2;
real Mwco2,Mwch4,Mwco,Mwh2o,Mwh2;
real s0,s1,s2,s3,s4;
real Pco2,Pch4,Pco,Ph2o,Ph2,Qr;
real r1,r2,r3,r4,r5,r6;
real pOp,sum;



DEFINE_SR_RATE(mecanismo,f,t,r,my,yi,rr)

{
Thread *t0=THREAD_T0(t);
cell_t c0=F_C0(f,t);
temp=C_T(c0,t0);


ksr=KO1*exp(-EJ1/(R_UNIV*temp));
kwgs=KO2*exp(-EJ2/(R_UNIV*temp));
kdsr=KO3*exp(-EJ3/(R_UNIV*temp));


Ke1=5.75e12*exp(-11476/temp);
Ke2=1.26e-2*exp(4639/temp);
Ke3=7.24e10*exp(-21646/temp);

Kch4=KCH4*exp(-ENT1/(R_UNIV*temp));
Kco=KCO*exp(-ENT2/(R_UNIV*temp));
Kh2o=KH2O*exp(-ENT3/(R_UNIV*temp));
Kh2=KH2*exp(-ENT4/(R_UNIV*temp));

Mwco2=my[0];
Mwch4=my[1];
Mwco=my[2];
Mwh2o=my[3];
Mwh2=my[4];

s0=yi[0];
s1=yi[1];
s2=yi[2];
s3=yi[3];
s4=yi[4];

/*Pco2=(s0*C_R(c0,t0)/Mwco2)*(R_UNIV*temp);
Pch4=(s1*C_R(c0,t0)/Mwch4)*(R_UNIV*temp);
Pco=(s2*C_R(c0,t0)/Mwco)*(R_UNIV*temp);
Ph2o=(s3*C_R(c0,t0)/Mwh2o)*(R_UNIV*temp);
Ph2=(s4*C_R(c0,t0)/Mwh2)*(R_UNIV*temp);*/


pOp=C_P(c0,t0)*1e-5; /*bar*/
sum=(s0/Mwco2+s1/Mwch4+s2/Mwco+s3/Mwh2o+s4/Mwh2);
Pco2=((s0*pOp)/(sum*Mwco2));
Pch4=((s1*pOp)/(sum*Mwch4));
Pco=((s2*pOp)/(sum*Mwco));
Ph2o=((s3*pOp)/(sum*Mwh2o));
Ph2=((s4*pOp)/(sum*Mwh2));


Qr=1+Kco*Pco+Kh2*Ph2+Kch4*Pch4+(Kh2o*Ph2o)/Ph2;


r1=(ksr/(pow(Ph2,2)*pow(Qr,2)))*(Pch4*Ph2o)*SDEN*MWNI*A1*A S;
r2=(ksr/(pow(Ph2,2)*pow(Qr,2)))*(Pco*pow(Ph2,3))*(1/Ke1)*SDEN*MWNI*A1*AS;
r3=(kwgs/(Ph2*pow(Qr,2)))*Pco*Ph2o*SDEN*MWNI*A1*AS;
r4=(kwgs/(Ph2*pow(Qr,2)))*(Ph2*Pco2)*(1/Ke2)*SDEN*MWNI*A1*AS;
r5=(kdsr/(pow(Ph2,3.5)*pow(Qr,2)))*(Pch4*pow(Ph2o,2))*SDEN* MWNI*A1*AS;
r6=(kdsr/(pow(Ph2,3.5)*pow(Qr,2)))*(pow(Ph2,4)*Pco2)*(1/Ke3)*SDEN*MWNI*A1*AS;

if(STREQ(r->name, "reaction-1"))

{
*rr=r1;
}

else if(STREQ(r->name, "reaction-2"))
{
*rr=r2;
}


else if(STREQ(r->name, "reaction-3"))
{
*rr=r3;
}


else if(STREQ(r->name, "reaction-4"))
{
*rr=r4;
}


else if(STREQ(r->name, "reaction-5"))
{
*rr=r5;
}


else if(STREQ(r->name, "reaction-6"))
{
*rr=r6;
}

}



When i do it the following error comes up:

# Generating udf_names.c because of makefile 6Rsurfaceratefinal.obj
udf_names.c
udf_names.c(7) : error C2059: syntax error : '}'
udf_names.c(8) : warning C4034: sizeof returns 0

Done.



I´ve read about this error and seems like it has to do with a space in between the end of the macro statement and the opening parenthesis, but i don´t have a space there.

Any ideas?

Thanks


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