8.0
general documentation
Boundary conditions using notebook

Get a user parameter defined in the GUI notebook.

To access a notebook-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 notebook variable named "t_inlet"):

static void
_notebook_t_inlet(cs_lnum_t n_elts,
const cs_lnum_t *elt_ids,
bool dense_output,
void *input,
cs_real_t *retval)
{
/* Get a user parameter defined in the GUI notebook */
/* 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] = t_bnd;
}
}
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
cs_real_t cs_notebook_parameter_value_by_name(const char *name)
Return a parameter value (real).
Definition: cs_notebook.c:383

Note that accessing the notebook value in the function above is done through the call to cs_notebook_parameter_value_by_name.

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
_notebook_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:570
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:2856
const cs_flag_t cs_flag_boundary_face
Definition: cs_flag.c:77
@ CS_PARAM_BC_DIRICHLET
Definition: cs_param_types.h:478
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:192