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:
This example sets the scalar laminar dynamic diffusivity (for Brownian motion) to take thermophoresis into account.
for (int iflid = 0; iflid < nfld; iflid++) {
continue;
if (ifcvsl > -1)
}
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]);
}
}
const auto cvar_k =
CS_F_(
k)->get_val_s();
const auto cvar_eps =
CS_F_(
eps)->get_val_s();
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) {
const auto cvar_rij =
CS_F_(
rij)->get_val_t();
const auto cvar_eps =
CS_F_(
eps)->get_val_s();
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;
}
}
const auto cvar_omg =
CS_F_(
omg)->get_val_s();
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.");
const auto cvar_t =
CS_F_(
t)->get_val_s();
const auto cpro_rom =
CS_F_(
rho)->get_val_s();
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.cpp:187
Define a templated mdspan class (non owner of data)
Definition: cs_mdspan.h:68
Field descriptor.
Definition: cs_field.h:275
int get_key_int(int key_id) const
Return a integer value for a given key associated with a field.
Definition: cs_field.cpp:4507
cs_span< cs_real_t > get_val_s(const int time_id=0) const
Return a 1D span view of field values. If the field is not a scalar a fatal error is provoked.
Definition: cs_field.cpp:5080
int type
Definition: cs_field.h:282
double get_key_double(int key_id) const
Return a floating point value for a given key associated with a field.
Definition: cs_field.cpp:4745
const char * name
Definition: cs_field.h:279
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
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:2486
cs_field_t * cs_field(int id)
Return a pointer to a field based on its id. This function requires that a field of the given id is d...
Definition: cs_field.cpp:4295
@ t
Definition: cs_field_pointer.h:91
@ k
Definition: cs_field_pointer.h:68
@ eps
Definition: cs_field_pointer.h:69
@ omg
Definition: cs_field_pointer.h:78
@ rho
Definition: cs_field_pointer.h:96
@ rij
Definition: cs_field_pointer.h:71
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:902
static constexpr cs_real_t cs_math_pi
Definition: cs_math.h:111
@ CS_DRIFT_SCALAR_ADD_DRIFT_FLUX
Definition: cs_parameters.h:118
@ CS_DRIFT_SCALAR_TURBOPHORESIS
Definition: cs_parameters.h:120
const double cs_physical_constants_kb
Definition: cs_physical_constants.cpp:442
double cs_turb_cmu
Definition: cs_turbulence_model.cpp:484
double cs_turb_xkappa
Definition: cs_turbulence_model.cpp:422
const cs_turb_model_t * cs_glob_turb_model
#define CS_FIELD_VARIABLE
Definition: cs_field.h:66
Turbulence model general options descriptor.
Definition: cs_turbulence_model.h:126
int itytur
Definition: cs_turbulence_model.h:169