My Project
programmer's documentation
Definition of post-processing and mesh zones

About postprocessing meshes

Postprocessing meshes may be defined in the cs_user_postprocess_meshes function, using one of several postprocessing mesh creation functions (cs_post_define_volume_mesh, cs_post_define_volume_mesh_by_func, cs_post_define_surface_mesh, cs_post_define_surface_mesh_by_func, cs_post_define_particles_mesh, cs_post_define_particles_mesh_by_func, cs_post_define_existing_mesh, cs_post_define_edges_mesh, and the probe set creation functions cs_probe_set_create, cs_probe_set_create_from_array, cs_probe_set_create_from_segment, cs_probe_set_create_from_local).

It is possible to output variables which are normally automatically output on the main volume or boundary meshes to a user mesh which is a subset of one of these by setting the auto_variables argument of one of the cs_post_define_..._mesh to true.

It is not possible to mix cells and faces in the same mesh (most of the post-processing tools being perturbed by such a case). More precisely, faces adjacent to selected cells and belonging to face or cell groups may be selected when the add_groups of cs_post_define_..._mesh functions is set to true, so as to maintain group information, but those faces will only be written for formats supporting this (such as MED), and will only bear groups, not variable fields.

The additional variables to post-process on the defined meshes will be specified in the cs_user_postprocess_values function.

Warning
In the parallel case, some meshes may not contain any local elements on a given process rank. This is not a problem at all, as long as the mesh is defined for all ranks (empty or not). It would in fact not be a good idea at all to define a post-processing mesh only if it contains local elements, global operations on that mesh would become impossible, leading to probable deadlocks or crashes.}

Example: reconfigure predefined meshes

In the example below, the default boundary mesh output is suppressed by redefining it, with no writer association:

{
int n_writers = 0;
const int *writer_ids = NULL;
"Boundary", /* mesh name */
NULL, /* interior face selection criteria */
"all[]", /* boundary face selection criteria */
true, /* add_groups */
true, /* automatic variables output */
n_writers,
writer_ids);
}

Note that the default behavior for meshes -1 and -2 is:

int n_writers = 1;
const int writer_ids[] = {-1});

Example: select interior faces with y = 0.5

In the following example, we use a geometric criteria to output only a subset of the main mesh, and associate the resulting mesh with user-defined writers 1 and 4:

{
const int n_writers = 2;
const int writer_ids[] = {1, 4}; /* Associate to writers 1 and 4 */
const char *interior_criteria = "plane[0, -1, 0, 0.5, "
"epsilon = 0.0001]";
const char *boundary_criteria = NULL;
cs_post_define_surface_mesh(1, /* mesh id */
"Median plane",
interior_criteria,
boundary_criteria,
false, /* add_groups */
false, /* auto_variables */
n_writers,
writer_ids);
}

Associating with writers

By default, meshes are associated with writers at the time of their definition, either explicitly for regular postprocessing meshes, or implicitely for probes and profiles. To prepare for future unification of those approaches, a previously defined mesh may be associated with a given writer. This allows ataching meshes to writers without requiring redefinition of their other characteristics.

Example: attach mesh to a histogram writer

Post-processing meshes can be associated to writers.

In the following example, the default boundary mesh is associated to the default histogram writer. The format of this writer is txt (text files) and it writes only at the end of the calculation.

In the following example, the default volume mesh is now associated to a user defined writer of Id 6.

cs_post_define_surface_mesh
void cs_post_define_surface_mesh(int mesh_id, const char *mesh_name, const char *i_face_criteria, const char *b_face_criteria, bool add_groups, bool auto_variables, int n_writers, const int writer_ids[])
Define a surface post-processing mesh.
Definition: cs_post.c:3699
CS_POST_MESH_VOLUME
#define CS_POST_MESH_VOLUME
Definition: cs_post.h:78
CS_POST_MESH_BOUNDARY
#define CS_POST_MESH_BOUNDARY
Definition: cs_post.h:79
CS_POST_WRITER_HISTOGRAMS
#define CS_POST_WRITER_HISTOGRAMS
Definition: cs_post.h:74
cs_post_mesh_attach_writer
void cs_post_mesh_attach_writer(int mesh_id, int writer_id)
Associate a writer to a postprocessing mesh.
Definition: cs_post.c:4141