(cs_user_zones.c)
Volume and boundary zones may be defined using the GUI, or through the cs_user_zones (in cs_user_zones.c).
Simple volume zone example
Most zones may be defined in a simple manner using the general selection criteria, such as in the following example:
{
"box[4.0, 6.0, -1e6, 2.0, 8.0, 1e6]",
}
Advanced volume zone example
More complex selections can be done by defining an appropriate selection function. For example, to select cells adjacent to boundary faces belonging to a group named "G3", the following selection function must first be defined:
static void
_g3_boundary_cells(void *input,
int location_id,
{
char *cell_flag;
cell_flag[i] = 0;
cell_flag[c_id] = 1;
}
if (cell_flag[i] != 0)
_n_elts++;
}
_n_elts = 0;
if (cell_flag[i] != 0) {
_elt_ids[_n_elts] = i;
_n_elts++;
}
}
*n_elts = _n_elts;
*elt_ids = _elt_ids;
}
It can then simply be used in a zone definition:
{
char name[128], criteria[128];
for (int i = 0; i < 3; i++) {
double s_coords[] = {0, 0, 2.0*i};
snprintf(name, 127, "source_%d", i);
snprintf(criteria, 127, "sphere[%f, %f, %f, 0.5]",
s_coords[0], s_coords[1], s_coords[2]);
}
}