Basic example
Local variables to be added
Initialization
One can get any field using cs_field_by_name function (use cs_field_by_name_try if one is not sure the field exists). "scalar1" is the name related to the first user-defined scalar variable. f->val[cell_id] is the value of this variable in cell number cell_id.
ONLY done if there is no restart computation.
const cs_lnum_t n_cells = domain->mesh->n_cells;
if (domain->time_step->nt_prev > 0)
return;
if (fld != nullptr) {
for (
cs_lnum_t cell_id = 0; cell_id < n_cells; cell_id++)
cvar_fld[cell_id] = 25;
}
auto cvar_fm =
CS_F_(
fm)->get_val_s();
for (
cs_lnum_t c_id = 0; c_id < n_cells; c_id++) {
cvar_fm[c_id] = 25;
cvar_ygfm[c_id] = 25;
cvar_scalt[c_id] = 25;
}
Field descriptor.
Definition: cs_field.h:275
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 cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
cs_field_t * cs_field_try(int id)
Return a pointer to a field based on its id. If no field of the given name is defined,...
Definition: cs_field.cpp:4371
@ ygfm
Definition: cs_field_pointer.h:131
@ fm
Definition: cs_field_pointer.h:126
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:47
cs_field_t * cs_thermal_model_field(void)
Definition: cs_thermal_model.cpp:180