Page 1 of 2

Internal wall not detected in code saturne 4.2

Posted: Mon Nov 07, 2016 12:04 pm
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

Re: Internal wall not detected in code saturne 4.2

Posted: Mon Nov 07, 2016 12:11 pm
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

Re: Internal wall not detected in code saturne 4.2

Posted: Wed Nov 09, 2016 1:51 am
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

Re: Internal wall not detected in code saturne 4.2

Posted: Wed Nov 09, 2016 9:57 am
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

Re: Internal wall not detected in code saturne 4.2

Posted: Wed Nov 09, 2016 10:21 am
by Yvan Fournier
Hello,

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

Regards,

Yvan

Re: Internal wall not detected in code saturne 4.2

Posted: Wed Nov 09, 2016 10:28 am
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

Re: Internal wall not detected in code saturne 4.2

Posted: Wed Nov 09, 2016 11:30 am
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

Re: Internal wall not detected in code saturne 4.2

Posted: Wed Nov 09, 2016 11:36 am
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

Re: Internal wall not detected in code saturne 4.2

Posted: Wed Nov 09, 2016 12:16 pm
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

Re: Internal wall not detected in code saturne 4.2

Posted: Mon Nov 14, 2016 4:11 pm
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