8.3
general documentation
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:

const cs_lnum_t n_cells = domain->mesh->n_cells;
cs_coal_model_t * cs_glob_coal_model
Definition: cs_coal.cpp:96
#define CS_COMBUSTION_GAS_MAX_ELEMENTARY_COMPONENTS
Definition: cs_combustion_gas.h:59
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
const cs_fluid_properties_t * cs_glob_fluid_properties
Definition: cs_physical_constants.cpp:465
Definition: cs_coal.h:96
Fluid properties descriptor.
Definition: cs_physical_constants.h:61

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;
}
int bft_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition: bft_printf.cpp:140
cs_real_t cs_coal_ht_convert_h_to_t_gas_by_yi(cs_real_t eh, const cs_real_t xesp[])
Calculation of the gas temperature from gas enthalpy and given mass fractions for coal combustion.
Definition: cs_coal_ht_convert.cpp:524
cs_field_t * cs_field_by_name(const char *name)
Return a pointer to a field based on its name.
Definition: cs_field.cpp:2489
@ h
Definition: cs_field_pointer.h:93
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:51
real(c_double), pointer, save xco2
Molar coefficient of CO2.
Definition: ppthch.f90:149
integer(c_int), pointer, save ico2
Definition: cpincl.f90:105
integer(c_int), pointer, save in2
Definition: cpincl.f90:105
integer(c_int), pointer, save ih2o
Definition: cpincl.f90:105
integer(c_int), pointer, save io2
Definition: cpincl.f90:105
int ico2
Definition: cs_coal.h:385
int in2
Definition: cs_coal.h:384
int ih2o
Definition: cs_coal.h:383
double oxyo2[CS_COMBUSTION_COAL_MAX_OXYDANTS]
Definition: cs_coal.h:124
double oxyn2[CS_COMBUSTION_COAL_MAX_OXYDANTS]
Definition: cs_coal.h:127
double wmole[CS_COMBUSTION_COAL_MAX_ELEMENTARY_COMPONENTS]
Definition: cs_coal.h:118
int ieqco2
Definition: cs_coal.h:158
double oxyco2[CS_COMBUSTION_COAL_MAX_OXYDANTS]
Definition: cs_coal.h:133
int ieqnox
Definition: cs_coal.h:166
int io2
Definition: cs_coal.h:382
double oxyh2o[CS_COMBUSTION_COAL_MAX_OXYDANTS]
Definition: cs_coal.h:130
cs_real_t * val
Definition: cs_field.h:152
double t0
Definition: cs_physical_constants.h:82