Sets of probes may also be defined through the cs_user_postprocess_probes function, to allow for extraction and output of values at specific mesh locations, often with a higher time frequency than for volume or surface meshes.
Probe sets, and profiles (which can be viewed as a series of probes lying on a user-defined curve) are handled as a point mesh, which can be associated with plot and time_plot 2D-plot writers, as well as any of the general (3D-output) writer types (the priviledged writer types being plot for a profile, and time_plot for other probes).
Probe sets may be defined using the cs_probe_set_create_from_array function. In some cases, it might be useful to define those in multiple stages, using first cs_probe_set_create then a series of calls to cs_probe_set_add_probe.
The following example shows how probes may be added using that function.
The same set could also be defined using predifined arrays:
In both cases, labels are optional (NULL may be used instead).
Probe set creation functions return a pointer to a cs_probe_set_t structure which can be used to specify additional options using the cs_probe_set_option function.
A writer (id = CS_POST_WRITER_PROBES) using the format "time_plot" is associated by default to a set of monitoring probes. This is not the case for profiles.
Profiles are special probe sets, for which a curvilinear coordinate is usually provided (or deduced, when cs_probe_set_create_from_segment or cs_probe_set_create_from_local construction function is used). Curvilinear coordinates may also be assigned to probe sets generated using cs_probe_set_create or cs_probe_set_create_from_array by using the cs_probe_set_assign_curvilinear_abscissa function.
Instead of being assigned by default to a time plot, profiles are generally used with writers using the "plot" format (with a "dat" or "csv" sub-option). Instead of using one file per variable with one column per point and one line per output time, this produces one file pour output time, with une column per variable and one line per point. But they may also be used with time plots (as a regular probe set), or as with any post-processing output mesh, with 3D formats such as EnSight or MED.
The following example shows how to simply define a profile on a given segment, and associate it to writer 2:
Probe sets (including profiles) may also be located along the domain boundary, if this is specified. In the following example, we set the "boundary" option to "true" to specify that the probes should be located on the boundary instead of the default volume mesh. We could also set a "criteria" option to define a selection filter for the portion of the mesh in which probes should be located (by default, the whole mesh).
Here We also choose to "snap" the points to the nearest vertices. Snapping probes to cell centers or vertices is useful mainly when the values to plot are located on those points.
To select a specific set of fields to output with a given probe set or profile, the cs_probe_set_associate_field function may be used. It allows specifying whether the output relates to all associated writers or specific ones, and for multidimensional fields, allows selecting specific components (comp_id
= -1 for all components, or the (0 to n-1)-th component if filtering is desired.
This is used in general for probe sets whose "automatic" variables output is turned off (using cs_probe_set_auto_var), though it can be used to extend that glob setting.
Finally, the user may choose to output the curvilinear coordinates associated with a profile and/or the point coordinates, using the cs_probe_set_auto_curvilinear_coords and cs_probe_set_auto_cartesian_coords respectively, since these are not output by default.
This last example illustrates a combination of those possibilities:
As with regular meshes, profiles may be defined using user functions.
In this example, we define a series of profiles. To avoid redundant code, an array defining both the name of each profile and the matching x coordinate (as a text string) is defined. The code then loops along these array values to define the series:
Probes and profiles may also be associated to the mesh boundary.
In the following example, a profile is defined based on a mesh boundary selection criterion, using the predefined cs_b_face_criterion_probes_define (which assumes curvilinear coordinates based on the "x" direction):
and in the below example using an array of 2 selection criteria:
In this example, we provide a local selection function (which may be defined in the private function definitions section near the beginning of the file) and whose code is shown below: