This page provides an example of code blocks that may be used to perform a calculation with drift scalars for coal combustion.
for (int icla = 0; icla < n_class; icla++) {
char rho_name[64], diam_name[64];
snprintf(rho_name, 63, "rho_p_%02d", icla+1);
snprintf(diam_name, 63, "diam_p_%02d", icla+1);
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
cpro_rom2[c_id] = rho20[icla];
cpro_diam2[c_id] = diam20[icla];
}
}
}
const cs_real_t aa1 = 4.0495e-6, bb1 = 6.2200e-8;
const cs_real_t cc1 = -2.3032e-11, dd1 = 4.4077e-15;
const cs_real_t aa2 = 9.9987e-6, bb2 = 5.1578e-8;
const cs_real_t cc2 = -1.8383e-11, dd2 = 3.33307e-15;
const cs_real_t aa3 = 2.8940e-6, bb3 = 2.22508e-8;
const cs_real_t cc3 = -8.041e-12, dd3 = 1.4619e-15;
const cs_real_t aa4 = 4.3093e-6, bb4 = 5.0516e-8;
const cs_real_t cc4 = -1.7869e-11, dd4 = 3.2136e-15;
const cs_real_t aa5 = -1.9889e-6, bb5 = 5.365e-8;
const cs_real_t cc5 = -1.4286e-11, dd5 = 2.1639e-15;
const cs_real_t aa6 = -1.293e-6, bb6 = 4.1194e-8;
const cs_real_t cc6 = -1.7720e-11, dd6 = 1.8699e-15;
const cs_real_t aa7 = 4.4822e-7, bb7 = 5.4327e-8;
const cs_real_t cc7 = -1.7581e-11, dd7 = 2.9979e-15;
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
const cs_real_t visco_O2 = aa1 + xvart*bb1 + cc1*xvart2 + dd1*xvart3;
const cs_real_t visco_CO = aa2 + xvart*bb2 + cc2*xvart2 + dd2*xvart3;
const cs_real_t visco_H2 = aa3 + xvart*bb3 + cc3*xvart2 + dd3*xvart3;
const cs_real_t visco_N2 = aa4 + xvart*bb4 + cc4*xvart2 + dd4*xvart3;
const cs_real_t visco_SO2 = aa5 + xvart*bb5 + cc5*xvart2 + dd5*xvart3;
const cs_real_t visco_NH3 = aa6 + xvart*bb6 + cc6*xvart2 + dd6*xvart3;
const cs_real_t visco_CO2 = aa7 + xvart*bb7 + cc7*xvart2 + dd7*xvart3;
visco[c_id] = ( cpro_ym1_8[c_id] * visco_O2
+ cpro_ym1_3[c_id] * visco_CO
+ cpro_ym1_5[c_id] * visco_H2
+ cpro_ym1_12[c_id]* visco_N2
+ cpro_ym1_11[c_id]* visco_SO2
+ cpro_ym1_7[c_id] * visco_NH3
+ cpro_ym1_9[c_id] * visco_CO2)
/ ( cpro_ym1_8[c_id] + cpro_ym1_3[c_id]
+ cpro_ym1_5[c_id] + cpro_ym1_12[c_id]
+ cpro_ym1_11[c_id] + cpro_ym1_7[c_id]
+ cpro_ym1_9[c_id]);
}
}
for (int f_id = 0; f_id < n_fields; f_id++) {
}
}
for (int f_id = 0; f_id < n_fields; f_id++) {
char rho_name[64], diam_name[64], x2_name[64];
snprintf(rho_name, 63, "rho_p_%02d", icla+1);
snprintf(diam_name, 63, "diam_p_%02d", icla+1);
snprintf(x2_name, 63, "x_p_%02d", icla+1);
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
cpro_taup[c_id] = cpro_x1[c_id] * cpro_rom2[c_id]
/ (18.0*visco[c_id]);
}
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++)
cpro_taup[c_id] += -(cpro_taup[c_id]*cpro_x2[c_id]);
}
}