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/)
-   -   HELP----Surface Reaction UDF (https://www.cfd-online.com/Forums/fluent-udf/64808-help-surface-reaction-udf.html)

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;
pH2=mH2/2/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"))
{K2=1.49e+4;
*rate=A2*exp(-E2/(8.314*(F_T(f,t))))*((pC2H60)-((pCO2*pCO2*pH2*pH2*pH2*pH2*pH2*pH2)/(K1*pH2O*pH2O*pH2O)))/(1+5*pC2H6O);}
else if (!strcmp(r->name, "reaction-1"))
{*rate=A1*exp(-E1/(8.314*(F_T(f,t))))*((pC2H6O)-((pCO2*pCO2*pH2*pH2*pH2*pH2*pH2*pH2)/(K1*pH2O*pH2O*pH2O)));}
else if (!strcmp(r->name, "reaction-3"))
{K3=3e+09;
*rate=A3*exp(-E3/(8.314*(F_T(f,t))))*(((pC2H6O*pH2O*pH2O*pH2O)/(pCO2*pH2*pH2*pH2))-((pCO2*pH2*pH2*pH2)/K3))/((1+2e+16*pC2H6O+((3.3e+07*pC2H6O*pH2O*pH2O)/(pCO2*pH2*pH2*pH2)));}
else if (!strcmp(r->name, "reaction-4"))
{K4=3e+09;
*rate=(A4*exp(-E4/(8.314*(F_T(f,t))))*(((pC2H6O*pH2O*pH2O*pH2O)/(pCO2*pH2*pH2*pH2))-((pCO2*pH2*pH2*pH2)/K4))/((1+2.73e+12*pC2H6O+((100000*pCO2*pH2*PH2*pH2)/pH2O))));}
if (*rate>10) /* stops reaction rate from becoming unreasonable high; facilitates convergence */
{*rate=10;}
else if (*rate<-10)
{*rate=-10;}
*rr=*rate;

WZX May 19, 2020 21:13

Hello,friend.My doctoral project is aslo about Steam Reforming of ethanol by using CFD.
I also face the same problem. How did you solve it?


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