cs_user_postprocess.c for Rij model

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
konst
Posts: 30
Joined: Sun Sep 17, 2017 7:41 pm

cs_user_postprocess.c for Rij model

Post by konst »

Hello !

I have a problem with saving profiles using cs_user_postprocess.c in case Rij-SSG turbulence model (for k-epsilon works well). For the moment I am using this approach to create a set of points in the profile:

Code: Select all

    cs_probe_set_t  *pset =
       cs_probe_set_create_from_segment("Prof1", // name
                                       4000,      // n_probes
                                       start,   // start coordinates
                                       end);    // end coordinates

    cs_probe_set_associate_writers(pset, 1, writer_ids);

....

    if (cs_glob_turb_rans_model->irijco) {
        cs_real_6_t *cvar_rij = (cs_real_6_t *)CS_F_(rij)->val;
        for (cs_lnum_t i = 0; i < n_cells; i++) {
          cs_lnum_t c_id = cell_list[i];
          for (cs_lnum_t j = 0; i < 6; i++)
            rij[i][j] = cvar_rij[c_id][j];
        }
    }
    else {
        for (cs_lnum_t i = 0; i < n_cells; i++) {
          cs_lnum_t c_id = cell_list[i];
          rij[i][0] = CS_F_(r11)->val[c_id];
          rij[i][1] = CS_F_(r22)->val[c_id];
          rij[i][2] = CS_F_(r33)->val[c_id];
          rij[i][3] = CS_F_(r12)->val[c_id];
          rij[i][4] = CS_F_(r23)->val[c_id];
          rij[i][5] = CS_F_(r13)->val[c_id];
        }
    }

These approach save proper velocities, but weird values of Rij into profiles, if I want to save the turbulence statistic from Rij-SSG turbulence model. But values are proper if I save results using GUI-defined profiles. Could give me a link to a C-code which executed while GUI-defined profiles are saving?
Attachments
cs_user_postprocess.c
postprocessing I am using in my code.
(18.46 KiB) Downloaded 184 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: cs_user_postprocess.c for Rij model

Post by Yvan Fournier »

Hello,

It seems you are applying the indirection in cell_list[] twice: once copying separate rij values to rij, then separating rij into components again.

I you want interleaved values, pass the local rij you built directly to cs_post_write_probe_values (with var_dim = 6). Otherwise, you do not need rij, just copy the required r11, R12, ... values to local val[] values passed to cs_post_write_probe_values. But in all cases the indirection should be applied once and only once.

Best regards,

Yvan
konst
Posts: 30
Joined: Sun Sep 17, 2017 7:41 pm

Re: cs_user_postprocess.c for Rij model

Post by konst »

Yes! You are right. Thanks for help Yvan!

Best regards,
Konstantin
Post Reply