cs_user_boundary_conditions.c in case of rough surface and Spalart-Allmaras

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_boundary_conditions.c in case of rough surface and Spalart-Allmaras

Post by konst »

Bonjour,

I am trying to run Spalart-Allmaras model with rough surface and prescribe BC by user-function in this way:

Code: Select all

    f = CS_F_(nusa);//get turbulence energy field
    int ivar_nu = cs_field_get_key_int(f, keyvar) - 1;  //ivar for k


    cs_selector_get_b_face_list("inlet or outlet", &nelts, lstelt);
    for (cs_lnum_t ilelt = 0; ilelt < nelts; ilelt++) {
      cs_lnum_t face_id = lstelt[ilelt];
      bc_type[face_id] = CS_INLET;
      cell_id = b_face_cells[face_id]; // associated boundary cell

      y_curr = cell_cen[cell_id][1]; // define height
      temp = interpolate_sa(profile, y_curr);

      //define Ux
      icodcl[(ivar_nu) * n_b_faces + face_id] = 1; //Dirihlet value
      rcodcl[(ivar_nu) * n_b_faces + face_id] = temp.u; //Value 
      ....
   }
     
And this approach does work perfectly in case of smooth surfaces. But in case rough surface and SA model it does not work, and this function generate some unrealistic values for boundary condition (all values is about 10e+33).

Probably in case of rough surfaces for SA model I need to prescribe BC in some particular way or this is kind of a bug?

Thank you for reply.
Best regards, Konstantin
Attachments
cs_user_boundary_conditions.c
(15.24 KiB) Downloaded 176 times
konst
Posts: 30
Joined: Sun Sep 17, 2017 7:41 pm

Re: cs_user_boundary_conditions.c in case of rough surface and Spalart-Allmaras

Post by konst »

I figured it out, maybe it will help to someone. The code is correct, but the problem was coming from the absence of convergence in model. So I found that it is better to use pseudo-coupled velocity-pressure solver and do not mix smooth and rough boundaries while using Spalart-Allmaras model.

Best regards,
Konstantin
Post Reply