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

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

Fluent-UDF_Coal-Combustion-Multiphase-Flow-Processes

---Codes for various kinds of heterogeneous reactions

【第二部分-Part2】

DEFINE_HET_RXN_RATE(SteamGasif_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; /*

CO + H2 ---> H2O + 1/25 Soot

The reverse steam gasification reaction, which is CO + H2 ---> 1/25 Soot + H2O is written as the reaction

shown above. So a negative rate means CO and H2 is consumed and H2O 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_h2o = RoRT * yi[IP_H2O][IS_H2O]/mw[IP_H2O][IS_H2O]/ 101325.; double p_co = RoRT * yi[IP_CO][IS_CO]/mw[IP_CO][IS_CO] / 101325.; double p_h2 = RoRT * yi[IP_H2][IS_H2]/mw[IP_H2][IS_H2] / 101325.; y_carbon = yi[IP_SOOT][IS_SOOT]; mol_weight = mw[IP_SOOT][IS_SOOT];

1

if (rp_ke)

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

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

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

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

double rr_steam_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_h2o, double p_co, double p_h2, double y_carbon, double mol_weight, double* direction) {

double rate, prod, T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX); double p_h2o_star = p_h2 * p_co / ( exp(17.29 - 16326/T_g) );

if(MGAS_Gasif) *direction = p_h2o - p_h2o_star; if(PCCL_Gasif) *direction = pow(p_h2o, N_steam_gasification)/(1.+K_steam_gasification*p_h2);

prod = y_carbon*(C_R(c,ts)*1e-03)/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 H2O 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 */ rate = A_steam_gasification*exp(-E_steam_gasification/Rgas/T_g)* Annealing_steam_gasification * prod * *direction; /* mol/cm^3.s */ rate *= 1000.; /* kmol/(m^3 .s) */ return rate; }

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

2

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; /*

C(s) + CO2 ---> 2CO

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();

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.;

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

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) /* negative implies reverse steam gasification */ *rr = 0.0; } }

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

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

*rr = 0;

3

double rr_turb = 1e+20;

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

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

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();

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.;

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_co2_gasification*exp(-E_soot_co2_gasification/Rgas/T_g)* Annealing_soot_co2_gasification * prod *

pow(p_co2, N_soot_co2_gasification)/(1.+K_soot_co2_gasification*p_co); /* mol/cm^3.s */

*rr *= 1000.; /* kmol/(m^3 .s) */ *rr = MIN(*rr, rr_turb); }

DEFINE_HET_RXN_RATE(Co2Gasif_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;

4