7.0
general documentation
Boundary conditions using notebook

Get a user parameter defined in the GUI notebook.

Define some variables needed for the boundary condition specification.

const cs_lnum_t n_b_faces = cs_glob_mesh->n_b_faces;
cs_field_t *scalar = cs_field_by_name_try("scalar1");
int var_id = cs_field_get_key_int(scalar, cs_field_key_id("variable_id")) - 1;
cs_lnum_t nelts = 0;
cs_lnum_t *lstelt = NULL;

Apply a Dirichlet boundary condition on temperature at inlet by using the user parameter "t_inlet" which value has been retrieved above.

BFT_MALLOC(lstelt, n_b_faces, cs_lnum_t);
cs_selector_get_b_face_list("inlet", &nelts, lstelt);
for (cs_lnum_t ielt = 0; ielt < nelts; ielt++) {
cs_lnum_t face_id = lstelt[ielt];
icodcl[var_id*n_b_faces + face_id] = 1;
rcodcl[var_id*n_b_faces + face_id] = t_bnd;
}
BFT_FREE(lstelt);