8.1
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;
#define CS_COMBUSTION_MAX_COALS
Definition: cs_coal.h:51
cs_combustion_model_t * cs_glob_combustion_model
Definition: cs_combustion_model.c:120
#define CS_COMBUSTION_GAS_MAX_ELEMENTARY_COMPONENTS
Definition: cs_combustion_model.h:56
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
const cs_fluid_properties_t * cs_glob_fluid_properties
Definition: cs_physical_constants.c:424
Definition: cs_combustion_model.h:104
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;
for (int icha = 0; icha < CS_COMBUSTION_MAX_COALS; icha++) {
f1mc[icha] = 0;
f2mc[icha] = 0;
}
/* Computation of h1init and t1init */
cs_real_t t1init = fprops->t0;
cs_real_t h1init = cs_coal_thconvers1(coefe, f1mc, f2mc, t1init);
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.c:140
double cs_coal_thconvers1(const double xesp[], const double f1mc[], const double f2mc[], cs_real_t tp)
Compute gas enthalpy Function with gas temperature and concentrations.
cs_field_t * cs_field_by_name(const char *name)
Return a pointer to a field based on its name.
Definition: cs_field.c:2344
@ h
Definition: cs_field_pointer.h:91
#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:165
integer(c_int), pointer, save ico2
Definition: cpincl.f90:233
integer(c_int), pointer, save in2
Definition: cpincl.f90:233
integer(c_int), pointer, save ih2o
Definition: cpincl.f90:233
integer(c_int), pointer, save io2
Definition: cpincl.f90:233
int ico2
Definition: cs_combustion_model.h:130
int in2
Definition: cs_combustion_model.h:129
int ih2o
Definition: cs_combustion_model.h:131
double wmole[CS_COMBUSTION_GAS_MAX_ELEMENTARY_COMPONENTS]
Definition: cs_combustion_model.h:143
double oxyo2[CS_COMBUSTION_MAX_OXYDANTS]
Definition: cs_combustion_model.h:146
int ieqco2
Definition: cs_combustion_model.h:118
int ieqnox
Definition: cs_combustion_model.h:124
double oxyh2o[CS_COMBUSTION_MAX_OXYDANTS]
Definition: cs_combustion_model.h:152
double oxyco2[CS_COMBUSTION_MAX_OXYDANTS]
Definition: cs_combustion_model.h:155
int io2
Definition: cs_combustion_model.h:128
double oxyn2[CS_COMBUSTION_MAX_OXYDANTS]
Definition: cs_combustion_model.h:149
cs_real_t * val
Definition: cs_field.h:152
double t0
Definition: cs_physical_constants.h:80