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 SootThe reverse steam gasification reaction, which is CO + H2 ---> 1/25 Soot + H2O is written as the reactionshown above. So a negative rate means CO and H2 is consumed and H2O and Soot are generated. Note that noC(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 firstreaction, 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];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){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 ---> 2COSet 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 firstreaction, 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;double rr_turb = 1e+20;double T_g = MIN((MAX(TMIN,C_T(c,tp))),TMAX);/*1/25 Soot + CO2 ---> 2COSet 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 firstreaction, 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;/*2CO ---> CO2 + 1/25 SootThe reverse CO2 gasification reaction, which is 2CO ---> 1/25 Soot + CO2 is written as the reactionshown above. So a negative rate means CO is consumed and CO2 and Soot are generated. Note that noC(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 firstreaction, 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);}}}}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 CH4Set 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 bythe firstreaction, 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 ---> CH4Set 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 firstreaction, 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.;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 SootThe reverse H2 gasification reaction, which is 1/2 CH4 ---> 1/25 Soot + H2 is written as the reactionshown above. So a negative rate means CH4 is consumed and H2 and Soot are generated. Note that noC(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 firstreaction, 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_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.;y_carbon = yi[IP_SOOT][IS_SOOT];mol_weight = mw[IP_SOOT][IS_SOOT];if(C_VOF(c, ts) >= eps_s_small){if (rp_ke)rr_turb = Turbulent_rr(c, t, hr, yi);*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) /* positive value implies 1/2 C(s) + H2 ---> 1/2 CH4 */*rr = 0.0;else /* negative value implies 1/2 CH4 ---> H2 + (0.5)*1/25 Soot */{*rr = abs(*rr);*rr = MIN(*rr, rr_turb);}}}}double rr_h2_gasif(cell_t c, Thread *t, Thread *ts, Thread *tp, double p_h2, double p_ch4, double y_carbon, double mol_weight, double* direction){double rate = 0.0, prod;double T_g = MIN((MAX(TMIN,C_T(c,tp))), TMAX);double p_h2_star = pow ((p_ch4/(exp(-13.43 + 10999/T_g))), 0.5);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 = p_h2-p_h2_star;if(*direction < 0.0) /* this implies reverse H2 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 = exp( -7.087 - 8078/T_g )* prod * *direction ; /* mol/cm^3.s */}if(PCCL_Gasif){*direction = p_h2;rate = A_h2_gasification*exp(-E_h2_gasification/Rgas/T_g)*Annealing_h2_gasification * prod * *direction; /* mol/cm^3.s */}rate *= 1000.; /* kmol/(m^3 .s) */return rate;}DEFINE_HET_RXN_RATE(coal_combustion,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 */double mol_weight, y_carbon, y_ash;*rr = 0.0;/* 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 firstreaction, defined in the heterogeneous reaction panel in FLUENT GUI.*/if(IS_ASH == 0)SetSpeciesIndex();if( C_YI(c,tp,IS_O2) >= spe_small){SolidFuel_Reactant(c, t, hr, &y_carbon, &mol_weight);y_ash = yi[index_phase][IS_ASH];*rr = rr_combustion(c, t, ts, tp, yi[IP_O2][IS_O2], y_ash, y_carbon); /* mol/(cm^3 .s) */*rr *= 1000.; /* kmol/(m^3 .s) */}}double rr_combustion(cell_t c, Thread *t, Thread *ts, Thread *tp, double yi_O2, double y_ash,double y_carbon){double rd, k_f, k_r, factor, k_a, rate = 0.0, vrel;double Pt = MAX(0.1, (op_pres+C_P(c,t))/101325);double gas_constant = 82.06; /* atm.cm^3/mol.K */double T = C_T(c,tp), T_s = C_T(c,ts), D_p = C_PHASE_DIAMETER(c,ts)*100.;double p_o2 = C_R(c,tp)*UNIVERSAL_GAS_CONSTANT* T *yi_O2/mw[IP_O2][IS_O2] / 101325.; /* atm */if(fc_ar > 0.){if (y_ash > 0.){rd = pow( (y_carbon * ash_ar/100.)/(y_ash * fc_ar/100.), (1./3.) );rd = MIN(1., rd);}elserd = 1.;}elserd = 0.;double diff = MAX((4.26 * pow((T/1800.),1.75)/Pt), 1.e-10); /* cm^2/s */double Sc1o3 = pow(C_MU_L(c,tp)/(C_R(c,tp) * diff * 1.e-4), 1./3.);#if RP_2Dvrel = pow(( (C_U(c,tp)-C_U(c,ts))*(C_U(c,tp)-C_U(c,ts)) +(C_V(c,tp)-C_V(c,ts))*(C_V(c,tp)-C_V(c,ts))), 0.5);#endif#if RP_3Dvrel = pow(( (C_U(c,tp)-C_U(c,ts))*(C_U(c,tp)-C_U(c,ts)) +(C_V(c,tp)-C_V(c,ts))*(C_V(c,tp)-C_V(c,ts)) +(C_W(c,tp)-C_W(c,ts))*(C_W(c,tp)-C_W(c,ts)) ), 0.5);#endifdouble Re = C_VOF(c,tp) * D_p/100. * vrel * C_R(c,tp)/(C_MU_L(c,tp)+SMALL_S);double N_sherwood = (7. - 10. * C_VOF(c,tp) + 5. * C_VOF(c,tp) * C_VOF(c,tp) )*(1. + 0.7 * pow(Re, 0.2) * Sc1o3) +(1.33 - 2.4 * C_VOF(c,tp) + 1.2 * C_VOF(c,tp) * C_VOF(c,tp)) *pow(Re, 0.7) * Sc1o3;if ( rd <= 0. || C_VOF(c, ts) <= 0. ){rate = 0.;}else{k_f = diff * N_sherwood / (D_p * gas_constant/mw[IP_O2][IS_O2] * T ); /* g/(atm.cm^2.s) */k_r = A_c_combustion * exp( -E_c_combustion/Rgas/T_s ) * rd * rd;if ( rd >= 1.){rate = 1. / (1./k_f + 1./k_r);}else{k_a = 2. * rd * diff * f_ep_a / (D_p * (1.-rd) * gas_constant/mw[IP_O2][IS_O2] * T_s );rate = 1. / (1./k_f + 1./k_r + 1./k_a);}factor = y_carbon / (y_carbon + 1.e-6);rate *= p_o2 * 6. * C_VOF(c,ts) * factor / (D_p * 32.); /* mol/(cm^3 .s) */ }return rate;}#if !RP_NODE || !PARALLELvoid volatile_mass_fractions(){read_c3m_data();/* pan2 : Oct 2012 ... added CX_Messages for debugging */CX_Message("PCCL_Devol = %d\n",PCCL_Devol);CX_Message("MGAS_Devol = %d\n",MGAS_Devol);CX_Message("CPD_Devol = %d\n",CPD_Devol);CX_Message("FGDVC_Devol = %d\n",FGDVC_Devol);CX_Message("HPTR_Devol = %d\n",HPTR_Devol);CX_Message("MGAS_Moisture = %d\n",MGAS_Moisture);CX_Message("PCCL_Moisture = %d\n",PCCL_Moisture);CX_Message("MGAS_TarCracking = %d\n",MGAS_TarCracking);CX_Message("PCCL_2nd_Pyro = %d\n",PCCL_2nd_Pyro);CX_Message("MGAS_gasif = %d\n",MGAS_Gasif);CX_Message("PCCL_gasif = %d\n",PCCL_Gasif);CX_Message("PCCL_TarCracking = %d\n",PCCL_TarCracking);CX_Message("MGAS_WGS = %d\n",MGAS_WGS);CX_Message("PCCL_soot_gasif = %d\n",PCCL_soot_gasif);CX_Message("MGAS_char_combustion = %d\n",MGAS_char_combustion);CX_Message("PCCL_char_combustion = %d\n",PCCL_char_combustion);CX_Message("PCCL_soot_oxidation = %d\n",PCCL_soot_oxidation);CX_Message("TAR_oxidation = %d\n",TAR_oxidation);CX_Message("MGAS_gas_phase_oxidation = %d\n",MGAS_gas_phase_oxidation);CX_Message("fc_ar = %f\n",fc_ar);CX_Message("vm_ar = %f\n",vm_ar);CX_Message("ash_ar = %f\n",ash_ar);CX_Message("moist_ar = %f\n",moist_ar);CX_Message("a1_devolatilization = %f\n",A1_devolatilization);CX_Message("e1_devolatilization = %f\n",E1_devolatilization);CX_Message("a2_devolatilization = %f\n",A2_devolatilization);CX_Message("e2_devolatilization = %f\n",E2_devolatilization);CX_Message("a_tar_cracking = %f\n",A_tar_cracking);CX_Message("e_tar_cracking = %f\n",E_tar_cracking);CX_Message("A_steam_gasification = %f\n",A_steam_gasification);CX_Message("E_steam_gasification = %f\n",E_steam_gasification);CX_Message("K_steam_gasification = %f\n",K_steam_gasification);CX_Message("N_steam_gasification = %f\n",N_steam_gasification);CX_Message("Annealing_steam_gasification = %f\n",Annealing_steam_gasification);CX_Message("A_co2_gasification = %f\n",A_co2_gasification);CX_Message("E_co2_gasification = %f\n",E_co2_gasification);CX_Message("K_co2_gasification = %f\n",K_co2_gasification);CX_Message("N_co2_gasification = %f\n",N_co2_gasification);CX_Message("Annealing_co2_gasification = %f\n",Annealing_co2_gasification);CX_Message("A_h2_gasification = %f\n",A_h2_gasification);CX_Message("E_h2_gasification = %f\n",E_h2_gasification);CX_Message("N_h2_gasification = %f\n",N_h2_gasification);CX_Message("Annealing_h2_gasification = %f\n",Annealing_h2_gasification);CX_Message("A_soot_steam_gasification = %f\n",A_soot_steam_gasification);CX_Message("E_soot_steam_gasification = %f\n",E_soot_steam_gasification);CX_Message("K_soot_steam_gasification = %f\n",K_soot_steam_gasification);CX_Message("N_soot_steam_gasification = %f\n",N_soot_steam_gasification);CX_Message("Annealing_soot_steam_gasification= %f\n",Annealing_soot_steam_gasification);CX_Message("A_soot_co2_gasification = %f\n",A_soot_co2_gasification);CX_Message("E_soot_co2_gasification = %f\n",E_soot_co2_gasification);CX_Message("K_soot_co2_gasification = %f\n",K_soot_co2_gasification);CX_Message("N_soot_co2_gasification = %f\n",N_soot_co2_gasification);CX_Message("Annealing_soot_co2_gasification= %f\n",Annealing_soot_co2_gasification);CX_Message("A_soot_h2_gasification = %f\n",A_soot_h2_gasification);CX_Message("E_soot_h2_gasification = %f\n",E_soot_h2_gasification);CX_Message("N_soot_h2_gasification = %f\n",N_soot_h2_gasification);CX_Message("Annealing_soot_h2_gasification = %f\n",Annealing_soot_h2_gasification);CX_Message("A_soot_combustion = %f\n",A_Soot_Combustion);CX_Message("E_soot_combustion = %f\n",E_Soot_Combustion);CX_Message("A_c_combustion = %f\n",A_c_combustion);CX_Message("E_c_combustion = %f\n",E_c_combustion);CX_Message("N_c_combustion = %f\n",N_c_combustion);CX_Message("Annealing_c_combustion = %f\n",Annealing_c_combustion);CX_Message("A_moisture_release = %f\n",A_moisture_release);CX_Message("E_moisture_release = %f\n",E_moisture_release);CX_Message("wg3 = %f\n",wg3);CX_Message("moisture_flux = %f\n",Moisture_Flux);/* f_ep_a is used in shrinking core model, in coal combustion model */double ep_a = 0.25 + 0.75*(1-ash_ar/100.);f_ep_a = pow(ep_a,2.5);}/* pan c3m start */static void SetBooleanValue(char * var , char * svalue) /* pan : Oct 2012 ... new function */ {cxboolean value;if ( strcmp(svalue,"true") == 0) /* pan2 : Oct 2012 : correction */value = TRUE;elsevalue = FALSE;if (strcmp(var,"pccl_devol") == 0) PCCL_Devol = value;if (strcmp(var,"mgas_devol") == 0) MGAS_Devol = value;if (strcmp(var,"cpd_devol") == 0) CPD_Devol = value;if (strcmp(var,"fgdvc_devol") == 0) FGDVC_Devol = value;if (strcmp(var,"hptr_devol") == 0) HPTR_Devol = value;if (strcmp(var,"mgas_moisture") == 0) MGAS_Moisture = value;if (strcmp(var,"pccl_moisture") == 0) PCCL_Moisture = value;if (strcmp(var,"mgas_tarcracking") == 0) MGAS_TarCracking = value;if (strcmp(var,"pccl_2nd_pyro") == 0) PCCL_2nd_Pyro = value;if (strcmp(var,"mgas_gasif") == 0) MGAS_Gasif = value;if (strcmp(var,"pccl_gasif") == 0) PCCL_Gasif = value;if (strcmp(var,"pccl_tarcracking") == 0) PCCL_TarCracking = value;if (strcmp(var,"mgas_wgs") == 0) MGAS_WGS = value;if (strcmp(var,"pccl_soot_gasif") == 0) PCCL_soot_gasif = value;if (strcmp(var,"mgas_char_combustion") == 0) MGAS_char_combustion = value;if (strcmp(var,"pccl_char_combustion") == 0) PCCL_char_combustion = value;if (strcmp(var,"pccl_soot_oxidation") == 0) PCCL_soot_oxidation = value;if (strcmp(var,"tar_oxidation") == 0) TAR_oxidation = value;if (strcmp(var,"mgas_gas_phase_oxidation") == 0) MGAS_gas_phase_oxidation = value;}static void SetValue(char * var , char * svalue) /* pan : oct 2012 ... replace entire function */{char * pEnd;double value = strtod(svalue,&pEnd);if (strcmp(var,"fc_ar") == 0) fc_ar = value;if (strcmp(var,"vm_ar") == 0) vm_ar = value;if (strcmp(var,"ash_ar") == 0) ash_ar = value;if (strcmp(var,"moist_ar") == 0) moist_ar = value;/* NOTE:If the two stage devolatilization model is not used, A2 and E2 have to be set to zero*/if (strcmp(var,"a1_devolatilization") == 0) A1_devolatilization = value;if (strcmp(var,"e1_devolatilization") == 0) E1_devolatilization = value;if (strcmp(var,"a2_devolatilization") == 0) A2_devolatilization = value;if (strcmp(var,"e2_devolatilization") == 0) E2_devolatilization = value;/* if (strcmp(var,"c3m_aem") == 0) c3m_aem = value; should not be used pan : Oct 2012 */if (strcmp(var,"a_tar_cracking") == 0) A_tar_cracking = value;if (strcmp(var,"e_tar_cracking") == 0) E_tar_cracking = value;if (strcmp(var,"a_steam_gasification") == 0) A_steam_gasification = value;if (strcmp(var,"e_steam_gasification") == 0) E_steam_gasification = value;if (strcmp(var,"annealing_steam_gasification") == 0) Annealing_steam_gasification = value;if (strcmp(var,"k_steam_gasification") == 0) K_steam_gasification = value;if (strcmp(var,"n_steam_gasification") == 0) N_steam_gasification = value;if (strcmp(var,"a_co2_gasification") == 0) A_co2_gasification = value;if (strcmp(var,"e_co2_gasification") == 0) E_co2_gasification = value;if (strcmp(var,"annealing_co2_gasification") == 0) Annealing_co2_gasification = value;if (strcmp(var,"k_co2_gasification") == 0) K_co2_gasification = value;if (strcmp(var,"n_co2_gasification") == 0) N_co2_gasification = value;if (strcmp(var,"a_h2_gasification") == 0) A_h2_gasification = value;if (strcmp(var,"e_h2_gasification") == 0) E_h2_gasification = value;if (strcmp(var,"annealing_h2_gasification") == 0) Annealing_h2_gasification = value;if (strcmp(var,"n_h2_gasification") == 0) N_h2_gasification = value;if (strcmp(var,"a_soot_steam_gasification") == 0) A_soot_steam_gasification = value;if (strcmp(var,"e_soot_steam_gasification") == 0) E_soot_steam_gasification = value;if (strcmp(var,"annealing_soot_steam_gasification") == 0) Annealing_soot_steam_gasification = value;if (strcmp(var,"k_soot_steam_gasification") == 0) K_soot_steam_gasification = value;if (strcmp(var,"n_soot_steam_gasification") == 0) N_soot_steam_gasification = value;if (strcmp(var,"a_soot_co2_gasification") == 0) A_soot_co2_gasification = value;if (strcmp(var,"e_soot_co2_gasification") == 0) E_soot_co2_gasification = value;if (strcmp(var,"annealing_soot_co2_gasification") == 0) Annealing_soot_co2_gasification = value;if (strcmp(var,"k_soot_co2_gasification") == 0) K_soot_co2_gasification = value;if (strcmp(var,"n_soot_co2_gasification") == 0) N_soot_co2_gasification= value;if (strcmp(var,"a_soot_h2_gasification") == 0) A_soot_h2_gasification = value;if (strcmp(var,"e_soot_h2_gasification") == 0) E_soot_h2_gasification = value;if (strcmp(var,"annealing_soot_h2_gasification") == 0) Annealing_soot_h2_gasification = value;if (strcmp(var,"n_soot_h2_gasification") == 0) N_soot_h2_gasification = value;if (strcmp(var,"a_soot_combustion") == 0) A_Soot_Combustion = value;if (strcmp(var,"e_soot_combustion") == 0) E_Soot_Combustion = value;if (strcmp(var,"a_c_combustion") == 0) A_c_combustion = value;if (strcmp(var,"e_c_combustion") == 0) E_c_combustion = value;if (strcmp(var,"n_c_combustion") == 0) N_c_combustion = value;if (strcmp(var,"annealing_c_combustion") == 0) Annealing_c_combustion = value;if (strcmp(var,"a_moisture_release") == 0) A_moisture_release = value;if (strcmp(var,"e_moisture_release") == 0) E_moisture_release = value;if (strcmp(var,"c3m_wg3") == 0) wg3 = value;if (strcmp(var,"moisture_flux") == 0) Moisture_Flux = value;/* if (strcmp(var,"c3m_ae5") == 0) c3m_ae5 = value; pan : Oct 2012 ... should not be used */}void read_c3m_data(){CX_Message("start of read_c3m_data \n");FILE * pFile;char line[80];char field1[80];char field2[80];char *pch;int i , field_index;pFile = fopen("fluent_c3m_udf.inp","r");if (pFile != NULL){CX_Message("fopen OK \n");char * pEnd = line;while (pEnd != NULL){/* CX_Message("read a line - start \n"); */pEnd = fgets(line,80,pFile);if (pEnd != NULL){for (i=0; i<80; ++i) line[i] = tolower(line[i]);pch = strtok(line," ,\t\n=");field_index = 0;while (pch != NULL){if (field_index == 0){strcpy(field1,pch);field_index = 1;/* CX_Message("token %s \n",field1); */}else{strcpy(field2,pch);field_index = 0;SetValue(field1,field2);SetBooleanValue(field1,field2); /* pan : Oct 2012 *//*CX_Message("\n\n");CX_Message("token %s \n",field1);CX_Message("token %s \n",field2);*/}pch = strtok(NULL," ,\t\n=");}}}fclose(pFile);}。