CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Parse error (http://www.cfd-online.com/Forums/fluent/50767-parse-error.html)

Vamsee March 4, 2009 13:15

Parse error
 
Hello friends

While interpreting my UDf I am finding a problem. The Problem says as shown below.

cpp -IC:\Fluent.Inc\fluent6.2.16/src -IC:\Fluent.Inc\fluent6.2.16/cortex/src -IC:\Fluent.Inc\fluent6.2.16/client/src -IC:\Fluent.Inc\fluent6.2.16/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" C:\Fluent.Inc tbin tx86\source.c

Error: C:\Fluent.Inc\ntbin\ntx86\source.c: line 33: parse error.

my UDf goes like this

/* UDF for the Energy Source Term */

/*

C_UDMI(c,t,0) - x(hydroegn concentration)

C_UDMI(c,t,1) - dx/dt

C_UDMI(c,t,2) - P_eq

C_UDMI(c,t,3) - k */

#include "udf.h" #include "mem.h" #include "stdio.h"

#define R 8.314 /*Universal Gas Constant- J/mol K */

#define Ea 21170 /* Activation Energy - J/ mol K */

#define xi 0.0 /* Initial Concentration */

#define xf 1 /* Final concentration */

#define dh 28000 /* Enthalpy, J/mol */

#define ds 107.2 /* Entropy - J/mol K */

#define RR 75 /* Reaction Rate - /sec */

#define Na 4 /* Number of atoms/molecule */

#define Mol 400 /* Molecular weight of metal hydride, kg/Kmol */

#define fs 0.35 /* plateau slope factor */

#define fhys 0.12 /* hysterisis factor */

#define Ps 5*e5 /* supply pressure, Pa */

#define Pb 5*e5 /* Bed Pressure,Pa */

#define e 0.5 /* void fraction */

#define Rho 8400 /* density of metal hydride, kg/m3 */

DEFINE_SOURCE(energy_source,c,t,ds,eqn) /* LINE NO:33 */ {

real energy_source;

real time = RP_Get_Real("flow-time");

if(time==0)

{

C_UDMI(c,t,0) = xi;

C_UDMI(c,t,1) = 0;

}

energy_source = (1-e)*Rho*dh*500*Na/Mol *C-UDMI(c,t,1);

return energy_source; }

DEFINE_EXECUTE_AT_END(execute-at_end) {

double temp,K,P_eq;

Cell_t c;

Thread *t;

int ID= ; /* Zone ID of Porous Zone */

Domain *domain = Get_Domain(ID);

thread_loop_c(t,domain)

{

begin_c_loop(c,t)

{

Temp= C_T(c,t);

P_eq= exp((-dh/(R*Temp))+(ds/R)+fs+fhys);

C_UDMI(c,t,2) = P_eq;

K = RR*((Pb-P_eq)/P_eq)*exp(-Ea/(R*Temp));

C_UDMI(c,t,3)=K;

C_UDMI(c,t,1) = K*((C_UDMI(c,t,0)-xf)/(xi-xf));

c_UDMI(c,t,0) = C_UDMI(c,t,0)+(C_UDMI(c,t,1)*RP_Get_Real("Physical-time-step"));

}

end_c_loop(c,t)

} }

please help me.

Thanks in advance Vamsee

Vamsee March 4, 2009 23:39

Re: Parse error
 
hello friends...

anyone please help me in this problem

regards Vamsee

max March 5, 2009 03:42

Re: Parse error
 
hello Vamsee,

you really should take some time to have a look on both, Fluent's UDF User Guide and maybe some basic C-Programing book. Some things will then be straight forward for you, for example that you must not use something like C_UDMI() outside the body of any Macro (Define_.....)

cheers Max

Vamsee March 5, 2009 04:09

Re: Parse error
 
Hello Max,

the statement which your talking about are comments just written for my convenience. They are not defined. sh0oludn't I write like that? please help me if there are any more.

max March 5, 2009 05:00

Re: Parse error
 
Sorry Vamsee,

i was too blind to see. One thing you can try is to compile your udf instaed of using interpreted mode. Maybe the compiler directives "#" are causing the troubles.

cheers Max


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