I tried to use the "cs_post_stress_tangential" function for calculating time-averaged wall shear stress on the fly. But unfortunately, without success.
The codes are shown below. When I compile them, some warnings occur but without error. I suppose there are some mistakes in the codes, but I cannot fine them. If you could check for me that will be much appreciated.
Code: Select all
static void
_boundary_shear_stress(const void *input,
cs_real_3_t *vals)
{
const int location_id = CS_MESH_LOCATION_BOUNDARY_FACES;
const cs_lnum_t n_elts = cs_mesh_location_get_n_elts(location_id)[0];
cs_post_stress_tangential(n_elts, NULL, vals);
}
void
cs_user_time_moments(void)
{
{
const char *sum_comp_name[] = {"shear_stress_mean", "shear_stress_variance"};
cs_time_moment_type_t m_type[] = {CS_TIME_MOMENT_MEAN,
CS_TIME_MOMENT_VARIANCE};
for (int i = 0; i < 2; i++) {
cs_time_moment_define_by_func(sum_comp_name[i],
CS_MESH_LOCATION_BOUNDARY_FACES,
3, /* field dimension */
_boundary_shear_stress, /* data_func */
NULL, /* data_input */
NULL, /* w_data_func */
NULL, /* w_data_input */
m_type[i],
106841, /* nt_start */
-1, /* t_start */
CS_TIME_MOMENT_RESTART_AUTO,
NULL);
}
}
cs_field_set_key_int_bits(cs_field_by_name("shear_stress_mean"),
cs_field_key_id("post_vis"),
CS_POST_ON_LOCATION);
cs_field_set_key_int_bits(cs_field_by_name("shear_stress_variance"),
cs_field_key_id("post_vis"),
CS_POST_ON_LOCATION);
}
The subroutine, xml, mesh and log files are attached. Thank you very much for helping me.** WALL DISTANCE
-------------
Min distance = 0.16443E-03 Max distance = 0.76789E-02
SIGSEGV signal (forbidden memory area access) intercepted!
Call stack:
1: 0x7f18bda14750 <cs_post_stress_tangential+0x120> (libsaturne-7.1.so)
2: 0x7f18bda55654 <cs_time_moment_update_all+0x6c4> (libsaturne-7.1.so)
3: 0x7f18bd94e087 <caltri_+0x1d74> (libsaturne-7.1.so)
4: 0x7f18bea2f8e0 <main+0x6f0> (libcs_solver-7.1.so)
5: 0x7f18bcd46b97 <__libc_start_main+0xe7> (libc.so.6)
6: 0x55b7f0e31fca <_start+0x2a> (cs_solver)
End of stack
Best regards,
Ruonan