CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   HELP----Surface Reaction UDF (

Ashi May 25, 2009 09:39

HELP----Surface Reaction UDF
Hi to all,,

I am finding difficulty to define the "Surface Reaction" UDF for "Ethanol steam reforming reaction'.

I have tried to define it on face but it doesn't work. Its is giving error.:(

I request you to kindly help me regarding the same, so that I can proceed with my work further.
Hope for your kind reply.:)

#include "udf.h"
#include "math.h"
/* This function defines the volumetric rate of reaction mechanism*/
DEFINE_SR_RATE( rate,f,t,r,my,yi,rr)

/*Pre-exponential factors and Activation energies. The pre-exponential factors are multiplied by the density of the
catalyst multiplied by the effectiveness factor final for Ethanol*/
#define A1 33*1400*.001
#define A2 297*1400*.001
#define A3 7.31e12*1400*.001
#define A4 2.10e10*1400*.001
#define E1 10.1e3
#define E2 21e3
#define E3 2e3
#define E4 13.9e3

/* Species numbers. Must match order in Fluent panel*/
#define CO 0
#define H2 1
#define C2H6O 2
#define H2O 3
#define CO2 4
#define N2 5

#define NUM_SPECS 6

/* Mol. Wt of Species */
#define MW_CO 28
#define MW_H2 2
#define MW_C2H6O 46
#define MW_H2O 18
#define MW_CO2 44
#define MW_N2 28

/*Heats of adsorption (J/kmol)
#define HCO -70.65e3
#define HH2 -82.9e3
#define HC2H6O -38.28e3/*(same)*/
#define HH2O 88.68e3

/*Universal Gas Constant (J/mol*K) */
#define UGC 8.314
/*Adsorption pre-exponential constants */
#define ACO 8.23e-5
#define AH2 6.12e-9
#define AC2H6O 6.65e-4
#define AH2O 1.57e4

/*Adsorption coefficient final for ethanol*/
real KCO=ACO*exp(-HCO/(UGC*F_T(f,t)));
real KH2=AH2*exp(-HH2/(UGC*F_T(f,t)));
real KC2H6O=AC2H6O*exp(-HC2H6O/(UGC*F_T(f,t)));
real KH2O=AH2O*exp(-HH2O/(UGC*F_T(f,t)));
real KCO2=ACO2*exp(-HCO2/(UGC*F_T(f,t)));
/*Mass fractions final for ethanol*/
real mC2H6O=F_YI(f,t,0);
real mH2O=F_YI(f,t,1);
real mCO2=F_YI(f,t,2);
real mN2=F_YI(f,t,3);
real mCO=F_YI(f,t,4);
real mH2=F_YI(f,t,5);
/*Partial pressures final for ethanol*/
real pOp=1.01; /*operating pressure (bar)*/
real sum=(mC2H6O/46+mH2O/18+mCO2/44+mN2/28+mCO/28+mH2/2);
real pC2H6O=mC2H6O/46/sum*pOp;
real pH2O=mH2O/18/sum*pOp;
real pCO2=mCO2/44/sum*pOp;
real pN2=mN2/28/sum*pOp;
real pCO=mCO/28/sum*pOp;

/* Initialize equilibrium constants final for ethanol*/
real K1=2.33e+09;
real K2=1.49e+4;
real K3=3e+09;
real K4=K3;

if (!strcmp(r->name, "reaction-2"))
else if (!strcmp(r->name, "reaction-1"))
else if (!strcmp(r->name, "reaction-3"))
else if (!strcmp(r->name, "reaction-4"))
if (*rate>10) /* stops reaction rate from becoming unreasonable high; facilitates convergence */
else if (*rate<-10)

All times are GMT -4. The time now is 00:59.