Usage of cs_user_mesh_input subroutine

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
DH07120S

Usage of cs_user_mesh_input subroutine

Post by DH07120S »

Hello,

I want to have the translation of a mesh 5 times in heigh.
In this mesh, there are 4 boundary conditions : bas(down), haut(up), interne and externe.
But if make the translation, I have intermediate boundary conditions which are created.
So I remove the group but I don't succed to remove two groups : haut and bas.
It work for the first mesh and the last mesh because I remove only one group.
But CS create a group : no_group where I remove my groups.
I use the version 2.2.2 of CS.

My code is :

Code: Select all

void
cs_user_mesh_input(void)
{
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2",
                             "haut",NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
  }
 
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2",
                             "haut , bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.180}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2",
                             "haut , bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.360}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
    
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2",
                             "haut , bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.540}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2",
                             "bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.720}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
  }
}
Thank you,

Damien
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Usage of cs_user_mesh_input subroutine

Post by Yvan Fournier »

Hello,

Some of your renames arrays (the 2nd, 3rd, and 4th ones) seem to contain 5 values, while the should contain an even number of values (old1, new1, old2, new2, ..., with NULL allowed in place of new* for a group to remove).

Could you re-test with corrected renames arrays ?

Best regards

Yvan
DH07120S

Re: Usage of cs_user_mesh_input subroutine

Post by DH07120S »

I correct my code. It works.

Code: Select all

cs_user_mesh_input(void)
{
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2","haut",NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
  }
 
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2","haut",NULL,"bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.180}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",3,renames,transf_matrix); 
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2","haut",NULL,"bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.360}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",3,renames,transf_matrix); 
    
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2","haut",NULL,"bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.540}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",3,renames,transf_matrix); 
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"Inlet", "Injection_2","bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.720}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
  }
}
/*----------------------------------------------------------------------------*/ 
 
END_C_DECLS 
You must also put 3 in the function cs_preprocessor_data_add_file when you remove 2 groups.

Thank you,

Damien
DH07120S

Re: Usage of cs_user_mesh_input subroutine

Post by DH07120S »

It's better with this one :

Code: Select all

cs_user_mesh_input(void)
{
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"haut",NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",1,renames,transf_matrix); 
  }
 
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"haut",NULL,"bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.180}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"haut",NULL,"bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.360}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
    
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"haut",NULL,"bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.540}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",2,renames,transf_matrix); 
  }
  
  /* Add same mesh with transformations */
  if (true) {
    const char *renames[] = {"bas", NULL};
    const double transf_matrix[3][4] = {{1., 0., 0., 0.},
                                        {0., 1., 0., 0.},
                                        {0., 0., 1., 0.720}};

    cs_preprocessor_data_add_file("/home/DH07120S/2754/Etude_Hexa/19_aig_22/MESH/mesh_input/base",1,renames,transf_matrix); 
  }
}
DH07120S

Re: Usage of cs_user_mesh_input subroutine

Post by DH07120S »

Since the beginning, I only compute a preprocessor.
But when I run the calculation, CS puts a problem in my boudary conditions. Indeed, it creates a a groupe "no-group" where I remove my groups. I can't put nothing in this group "no-group" becoause it's a continuity condition.
How can I do ?

Damien
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Usage of cs_user_mesh_input subroutine

Post by Yvan Fournier »

Hello,

When you append meshes, boundaries remain boundaries, and there is absolutely no reason to believe that changing or removing a group's name will change that.

To transform boundary faces into volume faces, you need to use mesh joining (or periodicity, which is an extension of this).

Regards,

Yvan
Post Reply