My Project
programmer's documentation
Definition of post-processing writers

Writers may be defined in the cs_user_postprocess_writers function.

Mesh or sub-mesh output writers

The following local variable definitions can shared beween several examples:

double frequency_n = -1.0;
double frequency_t = -1.0;

In the following example, the default writer is redefined, so as to modify some parameters which have been set by default or by the GUI:

"results", /* writer name */
"postprocessing", /* directory name */
"EnSight Gold", /* format_name */
"", /* format_options */
false, /* output_at_start */
true, /* output_at_end */
-1, /* frequency_n */
-1.0); /* frequency_t */

Polygons and polyhedra may also be divided into simpler elements, as in the example below (only for polyhedra here), using MED format output:

cs_post_define_writer(1, /* writer_id */
"user_txt", /* writer name */
"postprocessing", /* directory name */
"MED", /* format name */
"divide_polyhedra",
false, /* output_at_start */
true, /* output_at_end */
-1, /* frequency_n */
-1.0); /* frequency_t */

In the next example, the defined writer discards polyhedra, and allows for transient mesh connectivity (i.e. meshes changing with time); text output is also forced:

cs_post_define_writer(2, /* writer_id */
"modif", /* writer name */
"postprocessing", /* directory name */
"ensight", /* format name */
"text",
false, /* output_at_start */
false, /* output_at_end */
3,
frequency_t);

Probe and profile plotting writers

Defining plot and profile writers

Default plot and probe writers, CS_POST_WRITER_PROBES and CS_POST_WRITER_PROFILES are defined by default. Redefining them here allows modifying some of their parameters.

In the following example, an additional plot writer is defined. Such a writer may be used to output probe, profile, or other point data (probes may be output to 3D formats, but plot and time plot outputs drop cell or face-based ouptut).

cs_post_define_writer(3, /* writer_id */
"profile", /* writer name */
"postprocessing", /* directory name */
"plot", /* format name */
"", /* format options */
false, /* output_at_start */
false, /* output_at_end */
100, /* nt_freq */
-1.0); /* dt_freq */

In the next example, the default profile output writer is redefined so as to modify its defaults, including the output format (.dat instead of the default CSV).

"", /* writer name */
"profiles",
"plot", /* format name */
"dat", /* format options */
false, /* output_at_start */
true, /* output at end */
-1, /* time step frequency */
-1.0); /* time value frequency */

Forcing plot output updates

Due to buffering, plots may not be updated at every time step, and frequency of that update depends both on the volume of data produced and the machine. Forcing updates at each time step while not required may degrade performance, so it is not done by default.

Flushing parameters for time plots may be defined here. By default, for best performance, time plot files are kept open, and flushing is not forced. This behavior may be modified, as in the following example. The default settings should be changed before time plots are defined.

cs_time_plot_set_flush_default(1800, /* flush_wtime */
-1); /* n_buffer_steps */

Histogram output

In this last example, a histogram writer is defined. The format can be changed, as well as the number of subdivisions in the format options. Here the format is tex (resulting tex file can be input in any tex document with package tikz and pgfplots), and the number of subdivisions is 10.

cs_post_define_writer(6, /* writer_id */
"Histogram", /* writer name */
"histograms", /* directory name */
"histogram", /* format name */
"10 tex", /* format options */
false, /* output_at_start */
true, /* output at end */
-1, /* time step frequency */
-1.0); /* time value frequency */
cs_post_define_writer
void cs_post_define_writer(int writer_id, const char *case_name, const char *dir_name, const char *fmt_name, const char *fmt_opts, fvm_writer_time_dep_t time_dep, bool output_at_start, bool output_at_end, int frequency_n, double frequency_t)
Define a writer; this objects manages a case's name, directory, and format, as well as associated mes...
Definition: cs_post.c:3456
FVM_WRITER_TRANSIENT_CONNECT
Definition: fvm_writer.h:61
FVM_WRITER_FIXED_MESH
Definition: fvm_writer.h:59
CS_POST_WRITER_PROFILES
#define CS_POST_WRITER_PROFILES
Definition: cs_post.h:73
CS_POST_WRITER_DEFAULT
#define CS_POST_WRITER_DEFAULT
Definition: cs_post.h:68
cs_time_plot_set_flush_default
void cs_time_plot_set_flush_default(float flush_wtime, int n_buffer_steps)
Definition: cs_time_plot.c:1277