FLUENT UDF代码 - 颗粒(煤或生物质)床层多相流燃烧过程数值模拟-第2部分-完结 联系客服

发布时间 : 星期一 文章FLUENT UDF代码 - 颗粒(煤或生物质)床层多相流燃烧过程数值模拟-第2部分-完结更新完毕开始阅读

/*

2CO ---> CO2 + 1/25 Soot

The reverse CO2 gasification reaction, which is 2CO ---> 1/25 Soot + CO2 is written as the reaction

shown above. So a negative rate means CO is consumed and CO2 and Soot are generated. Note that no

C(s) is generated, the stoich coeff for C(s) in the above reation is zero.

Set the phase and species indices. Ash species index is initialized to zero, with all other indices.

Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the first

reaction, defined in the heterogeneous reaction panel in FLUENT GUI. */

if(IS_ASH == 0)

SetSpeciesIndex();

if(MGAS_Gasif) {

double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp); double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.;

double p_co2 = RoRT * yi[IP_CO2][IS_CO2]/mw[IP_CO2][IS_CO2] / 101325.;

y_carbon = yi[IP_SOOT][IS_SOOT]; mol_weight = mw[IP_SOOT][IS_SOOT];

if (rp_ke)

rr_turb = Turbulent_rr(c, t, hr, yi);

if(C_VOF(c, ts) >= eps_s_small) {

*rr = rr_co2_gasif(c, t, ts, tp, p_co, p_co2, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */

if( direction > 0.0) /* positive value implies C(s) + CO2 ---> 2CO */ *rr = 0.0; else /* negative value implies 2CO ---> CO2 + 1/25 Soot */ { *rr = abs(*rr); *rr = MIN(*rr, rr_turb); }

5

} } }

double rr_co2_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_co, double p_co2, double y_carbon, double mol_weight, double* direction) {

double T_g = MIN(MAX(TMIN,C_T(c,tp)), TMAX), prod; double p_co2_star = p_co * p_co/(exp(20.92 - 20282/T_g));

if(MGAS_Gasif) *direction = p_co2-p_co2_star;

if(PCCL_Gasif) *direction = pow(p_co2, N_co2_gasification)/(1. + K_co2_gasification * p_co);

prod = y_carbon*C_R(c,ts)*1.e-3/mol_weight* C_VOF(c,ts); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */

if(MGAS_Gasif && *direction < 0.0) /* this implies reverse CO2 gasification */

prod = y_carbon*(C_R(c,tp)*1e-03)/mol_weight*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */

double rate = A_co2_gasification*exp(-E_co2_gasification/Rgas/T_g)*Annealing_co2_gasification * prod * (*direction); /* mol/cm^3.s */

rate *= 1000.; /* kmol/(m^3 .s) */ return rate; }

DEFINE_HET_RXN_RATE(H2Gasif,c,t,hr,mw,yi,rr,rr_t) {

Thread **pt = THREAD_SUB_THREADS(t); Thread *tp = pt[0]; /* gas phase */

int index_phase = Get_Phase_Index(hr);

Thread *ts = pt[index_phase]; /* solid phase */

*rr = 0;

double direction = 0.0, mol_weight, y_carbon; /*

1/2 C(s) + H2 ---> 1/2 CH4

Set the phase and species indices. Ash species index is initialized to zero, with all other indices.

Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by

6

the first

reaction, defined in the heterogeneous reaction panel in FLUENT GUI. */

if(IS_ASH == 0)

SetSpeciesIndex();

double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp); double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;

double p_ch4 = RoRT * yi[IP_CH4][IS_CH4]/mw[IP_CH4][IS_CH4] / 101325.;

SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);

if(C_VOF(c, ts) >= eps_s_small) {

*rr = rr_h2_gasif(c, t, ts, tp, p_h2, p_ch4, y_carbon, mol_weight, &direction); /* mol/(cm^3 .s) */

if( direction < 0.0) /* negative implies reverse steam gasification */ *rr = 0.0; } }

DEFINE_HET_RXN_RATE(Soot_H2_Gasif,c,t,r,mw,yi,rr,rr_t) {

Thread **pt = THREAD_SUB_THREADS(t); Thread *tp = pt[0]; /* gas phase */

*rr = 0;

double rr_turb = 1e+20;

double T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX); /*

1/25 Soot + 2H2 ---> CH4

Set the phase and species indices. Ash species index is initialized to zero, with all other indices.

Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the first

reaction, defined in the heterogeneous reaction panel in FLUENT GUI. */

if(IS_ASH == 0)

7

SetSpeciesIndex();

double RoRT = C_R(c,tp) * UNIVERSAL_GAS_CONSTANT * C_T(c,tp);

double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.;

if (rp_ke)

rr_turb = Turbulent_rr(c, t, r, yi); double prod = yi[IP_SOOT][IS_SOOT]*(C_R(c,tp)*1e-03)/mw[IP_SOOT][IS_SOOT]*C_VOF(c,tp); /*1e-3 is to convert density from kg/m^3 to g/cm^3 */ *rr = A_soot_h2_gasification*exp(-E_soot_h2_gasification/Rgas/T_g)* Annealing_soot_h2_gasification * prod *

pow(p_h2, N_soot_h2_gasification); /* mol/cm^3.s */ *rr *= 1000.; /* kmol/(m^3 .s) */ *rr = MIN(*rr, rr_turb); }

DEFINE_HET_RXN_RATE(H2Gasif_Rev_MGAS,c,t,hr,mw,yi,rr,rr_t) {

Thread **pt = THREAD_SUB_THREADS(t); Thread *tp = pt[0]; /* gas phase */

int index_phase = Get_Phase_Index(hr);

Thread *ts = pt[index_phase]; /* solid phase */

*rr = 0;

double direction = 0.0, mol_weight, y_carbon, rr_turb = 1e+20; /*

1/2 CH4 ---> H2 + (0.5)*1/25 Soot

The reverse H2 gasification reaction, which is 1/2 CH4 ---> 1/25 Soot + H2 is written as the reaction

shown above. So a negative rate means CH4 is consumed and H2 and Soot are generated. Note that no

C(s) is generated, the stoich coeff for C(s) in the above reation is zero.

Set the phase and species indices. Ash species index is initialized to zero, with all other indices.

Ash species index is used as a flag to execute SetSpeciesIndex only once. This is done by the first

reaction, defined in the heterogeneous reaction panel in FLUENT GUI. */

8