CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Multiple Surface Reaction DPM_PR_RATE (http://www.cfd-online.com/Forums/fluent/50201-multiple-surface-reaction-dpm_pr_rate.html)

David January 5, 2009 10:39

Multiple Surface Reaction DPM_PR_RATE
 
I used a UDF code from Fluent manual directly but cannot compile. it report an error in syntax correction. What is wrong with the CODE from FLUENT company ? Does anyone know about this, please help?

DAVID

#include "udf.h" #define c1 5e-12 #define A1 0.002 #define E1 7.9e7 #define tolerance 1e-4 #define order 0.9 real reaction_rate(real rate, real ruser[], int iuser[], cxboolean buser[], char *cuser) { return (ruser[2]*pow(MAX(0.,(ruser[0]-rate/ruser[1])),order) -rate); } DEFINE_PR_RATE(user_rate,c,t,r,mw,pp,p,sf,dif_i,ca t_i,rr) { if (!strcmp(r->name, "reaction-2")) { cxboolean ifail=FALSE; real ash_mass = P_INIT_MASS(p)*(1.-DPM_CHAR_FRACTION(p)-DPM_VOLATILE_FRACTION(p)); real one_minus_conv = MAX(0.,(P_MASS(p) -ash_mass) / P_INIT_MASS(p)/ DPM_CHAR_FRACTION(p));

c Fluent Inc. September 11, 2006 2-55 DEFINE Macros real ruser[3]; int iuser[1]; cxboolean buser[1]; char cuser[30]; real ratemin, ratemax, root; ruser[0] = pp[dif_i]; ruser[1] = MAX(1.E-15, (c1*pow(0.5*(P_T(p)+C_T(c,t)),0.75)/P_DIAM(p))); ruser[2] = A1*exp(-E1/UNIVERSAL_GAS_CONSTANT/P_T(p)); strcpy(cuser, "reaction-2"); ratemin=0; ratemax=ruser[1]*pp[dif_i]; /* arguments for auxiliary function zbrent_pr_rate */ root = zbrent_pr_rate(reaction_rate, ruser, iuser, buser, cuser, ratemin, ratemax, tolerance, &ifail); if (ifail) root=MAX(1.E-15,ruser[1]); *rr=-root*P_DIAM(p)*P_DIAM(p)*M_PI*sf[0]*one_minus_conv; Message("Fail status %d\n", ifail); Message("Reaction rate for reaction %s : %g\n", cuser, *rr); } }


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