Internal wall not detected in code saturne 4.2

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
sagarcfd
Posts: 13
Joined: Mon Sep 12, 2016 7:08 am

Internal wall not detected in code saturne 4.2

Post by sagarcfd »

Hello,
I am trying to model internal wall as baffle using Code Saturne 4.2. During mesh creation I have created an internal face with name baffle. Also I have used subroutine cs_user_mesh.c as attached below. But baffle is not being detected in preprocessor listing so I am unable to provide wall boundary condition to baffle. Code saturne compiles user subroutine without error and run goes well but it do not take internal wall into account. Since flow is not affected by baffle streamlines are straight as shown below.
Image

Instead I am expecting flow to go like shown in picture below after detecting baffle

Image

User subroutine is as below:

Code: Select all

/*----------------------------------------------------------------------------
 * Insert thin wall into a mesh.
 *----------------------------------------------------------------------------*/

cs_user_mesh_thinwall(cs_mesh_t  *mesh)
{

  /* Example: thin wall along a plane */
  /*----------------------------------*/

  if (true) {
    cs_lnum_t   n_selected_faces = 1;
    cs_lnum_t  *selected_faces = 1;

    cs_real_t  *i_face_cog = 1, *i_face_normal = 1;

    /* example of multi-line character string */

    const char criteria[] = "baffle";

    cs_mesh_init_group_classes(mesh);

    cs_mesh_quantities_i_faces(mesh, &i_face_cog, &i_face_normal);

    cs_glob_mesh->select_i_faces = fvm_selector_create(mesh->dim,
                                                       mesh->n_i_faces,
                                                       mesh->class_defs,
                                                       mesh->i_face_family,
                                                       1,
                                                       i_face_cog,
                                                       i_face_normal);

    BFT_MALLOC(selected_faces, mesh->n_i_faces, cs_lnum_t);

    cs_selector_get_i_face_list(criteria,
                                &n_selected_faces,
                                selected_faces);

    BFT_FREE(i_face_cog);
    BFT_FREE(i_face_normal);

    mesh->class_defs = fvm_group_class_set_destroy(mesh->class_defs);
    mesh->select_i_faces = fvm_selector_destroy(mesh->select_i_faces);

    cs_create_thinwall(mesh,
                       selected_faces,
                       n_selected_faces);

    BFT_FREE(selected_faces);
  }
}
Please tell me what I am doing wrong.

Thanks and Regards,
Sagar
Attachments
Thinh_wall2.xml
.xml file
(6.15 KiB) Downloaded 234 times
cs_user_mesh.c
cs_user_mesh.c
(23.5 KiB) Downloaded 234 times
Mesh-4_new.zip
Mesh file in .msh format
(361.49 KiB) Downloaded 243 times
sagarcfd
Posts: 13
Joined: Mon Sep 12, 2016 7:08 am

Re: Internal wall not detected in code saturne 4.2

Post by sagarcfd »

Hello,
I am attaching images once again below. I am expecting flow to turn around baffle as shown in expected result.

Thanks and Regards,
Sagar
Attachments
Expected result
Expected result
Actual Result
Actual Result
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Internal wall not detected in code saturne 4.2

Post by Yvan Fournier »

Hello,

did you count the number of boundary faces (in the listing file) or visualize the mesh boundary (not volume) to make sure your faces were selected correctly ?

Regards,

Yvan
sagarcfd
Posts: 13
Joined: Mon Sep 12, 2016 7:08 am

Re: Internal wall not detected in code saturne 4.2

Post by sagarcfd »

Hello,

I have checked physical groups in gmesh and boundaries given in code saturne and they do match. I have attached snapshots for reference.

Thanks and Regards,
Sagar
Attachments
Boundary condition in code saturne
Boundary condition in code saturne
Physical groups
Physical groups
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Internal wall not detected in code saturne 4.2

Post by Yvan Fournier »

Hello,

Did you check the file I mentioned in my previous post ?

Regards,

Yvan
sagarcfd
Posts: 13
Joined: Mon Sep 12, 2016 7:08 am

Re: Internal wall not detected in code saturne 4.2

Post by sagarcfd »

Hello,

Yes I did checked. It shows as,
Groups:
"3"
cells: 20000
"5"
boundary faces: 8000
"6"
boundary faces: 100
"7"
boundary faces: 100
"8"
interior faces: 50
So it shows baffle as internal faces. Why it is so inspite of using subroutine and successfully compiling it?

Thanks and Regards,
Sagar
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Internal wall not detected in code saturne 4.2

Post by Yvan Fournier »

Hello,

Your selection criteria in the user subroutine is wrong, as Code_Saturne does not currently handle GMSH physical group names, but simply numbers.

Regards,

Yvan
sagarcfd
Posts: 13
Joined: Mon Sep 12, 2016 7:08 am

Re: Internal wall not detected in code saturne 4.2

Post by sagarcfd »

Hello,

Thanks for reply. I will use group number "8" of baffle in user subroutine instead of group name baffle and let you know about result.

Regards,
Sagar
sagarcfd
Posts: 13
Joined: Mon Sep 12, 2016 7:08 am

Re: Internal wall not detected in code saturne 4.2

Post by sagarcfd »

Hello,

Inspite of using group number "8" instead of its name result do not change. snapshot of straight streamlines is attached below.

Thanks and regards,
Sagar
Attachments
Streamline
Streamline
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: Internal wall not detected in code saturne 4.2

Post by Luciano Garelli »

Hello Sagar,

I uploaded an user function and a case file where your problem it is working (I attach a figure).

I used the default values in the user fuction like in the /REFERENCE/cs_user_mesh.c using as selection criteria "8" and the same selection criteria in the GUI to impose the wall BC.

Please, check if it is works for you.
Velocity.jpg
Regards,

Luciano
Attachments
Baffle.tar.gz
(7.15 KiB) Downloaded 272 times
Post Reply