9.0
general documentation
Loading...
Searching...
No Matches
pulverized_coal example

As usual, one can access any field using the field_get_val_s_by_name function. cvar_*(iel) is the value of this variable in cell number iel. ONLY done if there is no restart computation

pulverized_coal example

Local variables to be added

The following local variables need to be defined for the examples in this section:

Initialization

The following initialization block allows setting some variable values (variables not set here keep their GUI-defined or default values):

/* If this is restarted computation, do not reinitialize values */
if (domain->time_step->nt_prev > 0)
return;
/* Control Print */
bft_printf("%s: settings for pulverized coal\n", __func__);
/* All the domain is filled with the first oxidizer at TinitK
---------------------------------------------------------- */
/* Transported variables for the mix (solid+carrying gas)^2 */
const int ico2 = cm->ico2 - 1;
const int ih2o = cm->ih2o - 1;
const int in2 = cm->in2 - 1;
const int io2 = cm->io2 - 1;
for (int ige = 0; ige < CS_COMBUSTION_GAS_MAX_ELEMENTARY_COMPONENTS; ige++)
coefe[ige] = 0.;
/* Oxidizers are mix of O2, N2 (air), CO2 and H2O (recycled exhaust)
the composition of the fisrt oxidiser is taken in account. */
const int ioxy = 0;
cs_real_t dmas = cm->wmole[io2] * cm->oxyo2[ioxy]
+ cm->wmole[in2] * cm->oxyn2[ioxy]
+ cm->wmole[ih2o] * cm->oxyh2o[ioxy]
+ cm->wmole[ico2] * cm->oxyco2[ioxy];
coefe[io2] = cm->wmole[io2] * cm->oxyo2[ioxy ]/dmas;
coefe[ih2o] = cm->wmole[ih2o] * cm->oxyh2o[ioxy]/dmas;
coefe[ico2] = cm->wmole[ico2] * cm->oxyco2[ioxy]/dmas;
coefe[in2] = cm->wmole[in2] * cm->oxyn2[ioxy ]/dmas;
/* Computation of h1init and t1init */
cs_real_t t1init = fprops->t0;
cs_real_t h1init
cs_real_t *cvar_h = CS_F_(h)->val;
for (cs_lnum_t cell_id = 0; cell_id < n_cells; cell_id++)
cvar_h[cell_id] = h1init;
/* Transported variables for the mix (passive scalars, variance).
Variables not present here are initialized to 0. */
if (cm->ieqco2 >= 1) {
cs_real_t *cvar_yco2 = cs_field_by_name("x_c_co2")->val;
cs_real_t xco2 = cm->oxyco2[ioxy] * cm->wmole[ico2] / dmas;
for (cs_lnum_t cell_id = 0; cell_id < n_cells; cell_id++)
cvar_yco2[cell_id] = xco2;
}
if (cm->ieqnox == 1) {
cs_real_t *cvar_nox = cs_field_by_name("x_c_h_ox")->val;
for (cs_lnum_t cell_id = 0; cell_id < n_cells; cell_id++)
cvar_nox[cell_id] = h1init;
}