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]);
}
}
#define BFT_FREE(_ptr)
Definition: bft_mem.h:90
void cs_array_real_fill_zero(cs_lnum_t size, cs_real_t a[])
Assign zero to all elements of an array.
Definition: cs_array.cpp:1019
void cs_array_real_set_scalar(cs_lnum_t n_elts, cs_real_t ref_val, cs_real_t a[])
Assign a constant scalar value to an array.
Definition: cs_array.cpp:720
int cs_field_get_key_int(const cs_field_t *f, int key_id)
Return a integer value for a given key associated with a field.
Definition: cs_field.cpp:3275
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
cs_field_t * cs_field_by_composite_name(const char *name_prefix, const char *name_suffix)
Return a pointer to a field based on a composite name.
Definition: cs_field.cpp:2539
@ t
Definition: cs_field_pointer.h:94
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:51
static CS_F_HOST_DEVICE cs_real_t cs_math_pow3(cs_real_t x)
Compute the cube of a real value.
Definition: cs_math.h:577
static CS_F_HOST_DEVICE cs_real_t cs_math_pow2(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:561
@ CS_DRIFT_SCALAR_ADD_DRIFT_FLUX
Definition: cs_parameters.h:120
const cs_fluid_properties_t * cs_glob_fluid_properties
Definition: cs_physical_constants.cpp:465
const cs_time_step_t * cs_glob_time_step
real(c_double), pointer, save viscl0
reference molecular dynamic viscosity.
Definition: cstphy.f90:160
real(c_double), pointer, save ro0
reference density.
Definition: cstphy.f90:153
real(c_double), dimension(:), pointer, save diam20
Definition: cpincl.f90:99
real(c_double), dimension(:), pointer, save rho20
Definition: cpincl.f90:99
double diam20[CS_COMBUSTION_COAL_MAX_CLASSES]
Definition: cs_coal.h:361
double rho20[CS_COMBUSTION_COAL_MAX_CLASSES]
Definition: cs_coal.h:367
int nclacp
Definition: cs_coal.h:149
Field descriptor.
Definition: cs_field.h:131
const char * name
Definition: cs_field.h:133
double viscl0
Definition: cs_physical_constants.h:75
double ro0
Definition: cs_physical_constants.h:74
int nt_cur
Definition: cs_time_step.h:74