Introduction
This page provides an example of code blocks that may be used to perform a calculation with drift scalars.
Physical properties
Local variables to be added
The following local variables and associated initializations need to be defined for the examples in this section:
const cs_lnum_t n_cells = domain->mesh->n_cells;
Body
This example sets the scalar laminar diffusivity (for Brownian motion) to take thermophoresis into account.
Here is the corresponding code:
for (int iflid = 0; iflid < nfld; iflid++) {
continue;
cs_real_t *cpro_taup = NULL, *cpro_taufpt = NULL, *cpro_viscls = NULL;
if (ifcvsl > -1)
char df_name[128]; df_name[127] = '\0';
snprintf(df_name, 127,
"drift_tau_%s", f->
name);
snprintf(df_name, 127,
"drift_turb_tau_%s", f->
name);
}
if (diamp <= 1.e-6) {
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
cpro_taup[c_id] = cuning*diamp2*rhop / (18.*cpro_viscl[c_id]);
}
}
else {
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
cpro_taup[c_id] = diamp2*rhop / (18.*cpro_viscl[c_id]);
}
}
if (drift_flag & CS_DRIFT_SCALAR_TURBOPHORESIS) {
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
cpro_taufpt[c_id] = (3./2.)*(
cs_turb_cmu/turb_schmidt)*xk/xeps;
}
}
else if (t_mdl->
itytur == 3) {
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
+ cvar_rij[c_id][1]
+ cvar_rij[c_id][2]);
cpro_taufpt[c_id] = xk/xeps/beta1;
}
}
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
cpro_taufpt[c_id] = (3./2.)*(1./turb_schmidt)/xomg;
}
}
}
if (ifcvsl < 0)
"The diffusivity is uniform while a variable diffusivity\n"
"is computed.");
"The temperature field on which physical properties depend\n"
"does not seem to be present.");
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
}
}
}