Could you help me with my problem. I am using Code_Saturne 5.2.
And I am trying to use cs_user_postprocess.c to define profiles.
It does not work even for very simple definition. I was adapting file EXAMPLES/cs_user_postprocess-profiles.c for my case. But it gives me error:
Code: Select all
cs_probe.c:573: Fatal error.
Stop execution since the given cs_probe_set_t structure is empty.
Please check your settings.
Code: Select all
BEGIN_C_DECLS
void
cs_user_postprocess_writers(void)
{
/* Set time plot file writer flush behavior defaults. */
// /* ----------------------- */
cs_post_define_writer(CS_POST_WRITER_PROFILES, /* writer_id */
"", /* writer name */
"profiles",
"plot", /* format name */
"dat", /* format options */
FVM_WRITER_FIXED_MESH,
false, /* output_at_start */
true, /* output at end */
1, /* time step frequency */
-1.0); /* time value frequency */
}
void
cs_user_postprocess_probes(void)
{
cs_coord_3_t start = {0., 0.0, 0.0};
cs_coord_3_t end = {0., 4.0, 0.0};
int writer_ids[] = {CS_POST_WRITER_PROFILES};
cs_probe_set_t *pset =
cs_probe_set_create_from_segment("Prof1", // name
101, // n_probes
start, // start coordinates
end); // end coordinates
cs_probe_set_associate_writers(pset, 1, writer_ids);
}
void
cs_user_postprocess_values(const char *mesh_name,
int mesh_id,
int cat_id,
cs_probe_set_t *probes,
cs_lnum_t n_cells,
cs_lnum_t n_i_faces,
cs_lnum_t n_b_faces,
cs_lnum_t n_vertices,
const cs_lnum_t cell_list[],
const cs_lnum_t i_face_list[],
const cs_lnum_t b_face_list[],
const cs_lnum_t vertex_list[],
const cs_time_step_t *ts)
{
/* Output of k=1/2(R11+R22+R33) for the Rij-epsilon model
------------------------------------------------------ */
if (cs_glob_turb_model->itytur == 3) {
cs_real_t *s_cell;
BFT_MALLOC(s_cell, n_cells, cs_real_t);
if (cs_glob_turb_rans_model->irijco) {
const cs_real_6_t *cvar_r = (const cs_real_6_t *)(CS_F_(rij)->val);
for (cs_lnum_t i = 0; i < n_cells; i++) {
cs_lnum_t cell_id = cell_list[i];
s_cell[i] = 0.5* ( cvar_r[cell_id][0]
+ cvar_r[cell_id][1]
+ cvar_r[cell_id][2]);
}
}
else {
const cs_real_t *cvar_r11 = CS_F_(r11)->val;
const cs_real_t *cvar_r22 = CS_F_(r22)->val;
const cs_real_t *cvar_r33 = CS_F_(r33)->val;
for (cs_lnum_t i = 0; i < n_cells; i++) {
cs_lnum_t cell_id = cell_list[i];
s_cell[i] = 0.5* ( cvar_r11[cell_id]
+ cvar_r22[cell_id]
+ cvar_r33[cell_id]);
}
}
cs_post_write_probe_values(mesh_id,
CS_POST_WRITER_PROFILES, /* writer id filter */
"turb energy", /* var_name */
1, /* var_dim */
CS_POST_TYPE_cs_real_t, /* var_type */
0, /* parent location id */
NULL, /* default interpolation */
NULL, /* interpolation input */
s_cell, /* cel_vals */
ts);
BFT_FREE(s_cell);
}
}
void
cs_user_postprocess_activate(int nt_max_abs,
int nt_cur_abs,
double t_cur_abs)
{
if (nt_max_abs < 10) {
int writer_id = CS_POST_WRITER_PROFILES;
cs_post_activate_writer(writer_id, false);
}
}
END_C_DECLS
Maybe I defined something in a wrong way?