This page provides an example of code blocks that may be used to perform a calculation with drift scalars.
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;
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
int cs_field_n_fields(void)
Return the number of defined fields.
Definition: cs_field.c:1527
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.c:2570
@ mu
Definition: cs_field_pointer.h:103
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:51
integer, save kivisl
variable diffusivity field id key for scalars
Definition: numvar.f90:193
This example sets the scalar laminar diffusivity (for Brownian motion) to take thermophoresis into account.
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]);
}
}
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++) {
}
}
}
void bft_error(const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
Calls the error handler (set by bft_error_handler_set() or default).
Definition: bft_error.c:193
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:334
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition: cs_field.c:2316
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.c:3064
double cs_field_get_key_double(const cs_field_t *f, int key_id)
Return a floating point value for a given key associated with a field.
Definition: cs_field.c:3244
cs_field_t * cs_field_by_name(const char *name)
Return a pointer to a field based on its name.
Definition: cs_field.c:2340
@ t
Definition: cs_field_pointer.h:92
@ k
Definition: cs_field_pointer.h:70
@ eps
Definition: cs_field_pointer.h:71
@ omg
Definition: cs_field_pointer.h:80
@ rho
Definition: cs_field_pointer.h:97
@ rij
Definition: cs_field_pointer.h:73
static cs_real_t cs_math_pow2(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:238
const cs_real_t cs_math_pi
@ CS_DRIFT_SCALAR_ADD_DRIFT_FLUX
Definition: cs_parameters.h:117
@ CS_DRIFT_SCALAR_TURBOPHORESIS
Definition: cs_parameters.h:119
const double cs_physical_constants_kb
Definition: cs_physical_constants.c:384
double cs_turb_cmu
Definition: cs_turbulence_model.c:496
double cs_turb_xkappa
Definition: cs_turbulence_model.c:437
const cs_turb_model_t * cs_glob_turb_model
#define CS_FIELD_VARIABLE
Definition: cs_field.h:63
integer, save ksigmas
turbulent schmidt key for scalars
Definition: numvar.f90:208
Field descriptor.
Definition: cs_field.h:130
int type
Definition: cs_field.h:135
const char * name
Definition: cs_field.h:132
cs_real_t * val
Definition: cs_field.h:151
Turbulence model general options descriptor.
Definition: cs_turbulence_model.h:115
int itytur
Definition: cs_turbulence_model.h:139