Volume and boundary zones may be defined using the GUI, or through the cs_user_zones (in cs_user_zones.cpp).
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]",
}
int cs_volume_zone_define(const char *name, const char *criteria, int type_flag)
Define a new volume zone using a selection criteria string.
Definition: cs_volume_zone.cpp:574
#define CS_VOLUME_ZONE_HEAD_LOSS
Definition: cs_volume_zone.h:67
Or you can define 3 spherical source term zones based on geometrical criteria described by a rule.
{
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]);
}
}
#define CS_VOLUME_ZONE_SOURCE_TERM
Definition: cs_volume_zone.h:70
Advanced volume zone examples
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;
}
#define BFT_FREE(_ptr)
Definition: bft_mem.h:90
#define BFT_MALLOC(_ptr, _ni, _type)
Definition: bft_mem.h:58
#define CS_UNUSED(x)
Definition: cs_defs.h:528
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
void cs_selector_get_b_face_list(const char *criteria, cs_lnum_t *n_b_faces, cs_lnum_t b_face_list[])
Fill a list of boundary faces verifying a given selection criteria.
Definition: cs_selector.cpp:213
cs_lnum_t * b_face_cells
Definition: cs_mesh.h:112
cs_lnum_t n_b_faces
Definition: cs_mesh.h:99
cs_lnum_t n_cells
Definition: cs_mesh.h:97
It can then simply be used in a zone definition:
{
}
int cs_volume_zone_define_by_func(const char *name, cs_mesh_location_select_t *func, void *input, int type_flag)
Define a new mesh location with an associated selection function.
Definition: cs_volume_zone.cpp:618
Advanced boundary zone examples
You can define simple boundary zones, allowing all faces not in the "INLET" or "OUTLET" groups to be considered as walls
{
}
int cs_boundary_zone_define(const char *name, const char *criteria, int type_flag)
Define a new boundary zone using a selection criteria string.
Definition: cs_boundary_zone.cpp:608
void cs_boundary_zone_set_overlay(int id, bool allow_overlay)
Set overlay behavior for a given boundary zone.
Definition: cs_boundary_zone.cpp:826
Or simply allow overlapping for an existing zone:
{
}
const cs_zone_t * cs_boundary_zone_by_name(const char *name)
Return a pointer to a boundary zone based on its name if present.
Definition: cs_boundary_zone.cpp:711
int id
Definition: cs_zone.h:59