general documentation
Boundary conditions using time table

Compute a time dependent parameter value from a time table defined by the user.

To access a time table defined variable when defining boundary conditions, a callback function of the type of type cs_dof_func_t can be defined, such as the following (for a time table named "inlet_temperature"):

static void
_time_table_t_inlet(cs_lnum_t n_elts,
const cs_lnum_t *elt_ids,
bool dense_output,
void *input,
cs_real_t *retval)
/* Get current time */
/* Compute inlet temperature from time table "inlet_temperature" */
cs_real_t inlet_temp =
1, /* 2nd column */
false); /* Don't overwrite last position */
/* Apply values at selected locations */
for (cs_lnum_t i = 0; i < n_elts; i++) {
const cs_lnum_t face_id = (elt_ids == NULL) ? i : elt_ids[i];
const cs_lnum_t j = dense_output ? i : face_id;
retval[j] = inlet_temp;
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
const cs_time_step_t * cs_glob_time_step
cs_real_t cs_time_table_compute_time_value(const char *name, cs_real_t t, const int col, bool overwrite_prev)
Compute value using a given abscissa and a specific column.
Definition: cs_time_table.c:643
double t_cur
Definition: cs_time_step.h:80

Note that accessing the time table value in the function above is done through the call to cs_time_table_compute_time_value.

The callback function can then be assigned to the zone named "inlet" for variable "scalar1" in the usual way (in cs_user_boundary_conditions_setup):

"inlet", // zone name
cs_flag_boundary_face, // location flag
_time_table_t_inlet, // callback function
NULL); // input structure
cs_equation_param_t * cs_equation_param_by_name(const char *eqname)
Return the cs_equation_param_t structure associated to a cs_equation_t structure based on the equatio...
Definition: cs_equation.c:614
cs_xdef_t * cs_equation_add_bc_by_dof_func(cs_equation_param_t *eqp, const cs_param_bc_type_t bc_type, const char *z_name, cs_flag_t loc_flag, cs_dof_func_t *func, void *input)
Define and initialize a new structure to set a boundary condition related to the given cs_equation_pa...
Definition: cs_equation_param.c:3063
const cs_flag_t cs_flag_boundary_face
Definition: cs_flag.c:80
Definition: cs_param_types.h:479
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:192