Problem when selecting internal faces

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Stéphane Blanchet

Problem when selecting internal faces

Post by Stéphane Blanchet »

Hello,

I have a problem when selecting internal faces for the postprocessing. My mesh is a 2D mesh, with quadrangles at the walls, and triangles elsewhere, and I extruded the 2D mesh with one layer.

Then, when I select an internal face for the postprocessing using usdpst and usvpst, Code_Saturne only extract the quadrangles extruded.

I really don't know why since I have no problem when extraction a boundary face for the same mesh...

I attached both usdpst and usvpst.

Any idea would be really nice.

Best regards,

Stéphane
Attachments
usvpst.f90
(18.7 KiB) Downloaded 285 times
usdpst.f90
(14.59 KiB) Downloaded 271 times
Yvan Fournier

Re: Problem when selecting internal faces

Post by Yvan Fournier »

Hello,

You may want to run cs_preprocessor or "code_saturne check_mesh" using the --int-face option (along with --med, --ensight, or --cgns so as to obtain postprocessing output), so as to check how the extrusion dealt with face colors (unless you defined those colors after extrusion, it probably depends on the meshing tool you used).

Actually, the preprocessor log file may give you enough information about the number of interior faces with each given color that you do not even need to run this check.

Finally, I am not sure I understand the issue: as you have only one cell layer, the only interior faces should be extruded quadrangles. Do you mean you are only able to extract a smaller subset of those than expected ?

Best regards,

  Yvan
Stéphane Blanchet

Re: Problem when selecting internal faces

Post by Stéphane Blanchet »

Hello,

I checked the preprocessor log file, the number of faces corresponding to the internal face is bigger than those extracted.

Sorry if I was not clear... actually, I can't extract the triangles extruded from the 2D mesh. I can only extract the extruded quadrangles which belong to the quadrangles near the wall from the 2D mesh. I hope it is clearer now.

Best Regards,

Stéphane
Yvan Fournier

Re: Problem when selecting internal faces

Post by Yvan Fournier »

Hello,

Did you try "code_saturne check_mesh" using the --int-face option (along with --med, --ensight, or --cgns so as to obtain postprocessing output) ? It is quite possible that extruded "interior" faces do not have the correct color, in which case the solution would be either to use different extrusion options (if they exist) to propagate colors to the extruded mesh, or if this is not possible, to use a geometric criterion in Code_Saturne.

Best regards,

  Yvan
Stéphane Blanchet

Re: Problem when selecting internal faces

Post by Stéphane Blanchet »

Hello,

I tried your solution, I can see my internal face with my post processor software (Paraview).  But some cells are defined as "isolated faces" instead of the correct color and the number of cells for this "isolated face" correspond to the cells missing.

So I don't really know why I have the correct number of cells in the preprocessor file for the internal face, and why some cells are missing for the post processing.

By the way, I used Gmsh and defined the colors after the extrusion.

I will try the geometric criterion, and thanks for your help.

Best Regards,

Stéphane
Yvan Fournier

Re: Problem when selecting internal faces

Post by Yvan Fournier »

Hello,

FYI, "isolated faces" are faces which do not use the same vertex definitions as cells. The most probable explanation is that the extrusion generated copies of vertices (with identical coordinates but different numbers) instead of using the same vertices. Merging the 2 under Gmsh should help, though I believe that should be its default behavior.

Best regards,

  Yvan
Stéphane Blanchet

Re: Problem when selecting internal faces

Post by Stéphane Blanchet »

Hello,

Thank you for this information, but I still don't understand why in the listpre, the number of cells for the internal face is correct.

I have another question: I would like to create an HIST file with the average pressure on an internal face (this time, I use a geometric criterion), so I changed the usproj.f90 as follow:

Code: Select all

!******** Average Pressure calculation *********
! Initialisation 
  average_pressure = 0.D0
  surface = 0.D0
  call getfac('X = 0' ,nlfac, lstfac) 
  do ifac = 1, nlfac
    average_pressure = average_pressure + rtp(1,ipr(iphas)) * surfac(ndim,ifac)
    surface = surface + surfac(ndim,ifac)
  enddo
!Calculation of the average pressure
  call parsom(average_pressure)
  call parsom(surface)
  average_pressure = average_pressure / surface
  if (irangp.le.0) then
    if (ntcabs.eq.ntpabs+1) open (unit = 10, file = 'Averagepressure.hst', status = 'unknown',  position = 'append')
    !  this is a restart calculation
    write (10,5500) average_pressure
5500 format(' USPROJ: Average Pressure =',E14.5)
    if (ntcabs.eq.ntmabs) close(10)
  endif 
But I get this error in the listing file:
 
Error parsing expression: X = 0   ^ Expected operator instead of operand.
 
Do I have to use for instance:  call getfac('X >= 0 and X <= 0.001 ' ,nlfac, lstfac) ?
 
Best regards,
 
Stéphane
David Monfort

Re: Problem when selecting internal faces

Post by David Monfort »

[edited: sun 18 June 2010] take into account Stéphane's remark about the wrong formulae of the area calculation...

Hello Stéphane,

To begin with, could you attach your mesh file (provided it isn't too big) so that we can test such meshes ? I don't recall someone having tested such feature in Gmsh (but I may be wrong...).

Concerning your other question about face selection, indeed you cannot directly ask for something equal to a value. In this case, you can use (see chapter 2.9 of the user guide) either:
getfac('-0.0001 < x < 0.0001', nfac, lstfac)
or with the plane tool:  ax+by+cz+d=0, epsilon
getfac('plane[1.,0.,0.,0.,espilon=0.0001]', nfac, lstfac)

Lastly, I think you have a typo in your code. Assuming you want to compute the pressue on faces along the X=0 plane, you want to use the X-component of the surface vector, and not the Z-component as you wrote. Furthemore, the area calculation should be either "sqrt(surfac(1,ifac)**2+surfac(2,ifac)**2+surfac(3,ifac)**2)" or "ra(isrfan + ifac-1)".

David
Stéphane Blanchet

Re: Problem when selecting internal faces

Post by Stéphane Blanchet »

Hello,

The mesh file is too big, even in tar.gz, I will try to send you later when I could access a file sharing website. But maybe you have your own sharing zone....
 
Concerning the other question:
- For the area calculation, the code should be sqrt(surfac(1,ifac)**2 + surfac(2,ifac)**2 + surfac(3,ifac)**2) instead of "sqrt(surfac(1,ifac)**2 + sqrt(surfac(2,ifac)**2 + sqrt(surfac(3,ifac)**2)", right?
- About the z-component I wrote, are you refering this part of the code:  average_pressure = average_pressure + rtp(1,ipr(iphas)) * surfac(ndim,ifac) ?

Anyway, I tried with this code:
 

Code: Select all

!******** Average Pressure calculation *********
! Initialisation
  average_pressure = 0.D0
  surface = 0.D0
  call getfac('-0.0001 < x < 0.0001' ,nfac, lstfac)
  do ifac = 1, nfac
    average_pressure = average_pressure + rtp(1,ipr(iphas)) *ra(isrfan + ifac-1)
    surface = surface + ra(isrfan + ifac-1)
  enddo
  !Calculation of the average pressure
  call parsom(average_pressure)
  call parsom(surface)
  average_pressure = average_pressure / surface
  if (irangp.le.0) then
    if (ntcabs.eq.ntpabs+1) open (unit = 10, file = 'Averagepressure.hst', status = 'unknown',  position = 'append')     !  this is a restart calculation
    write (10,5500) average_pressure
5500 format(' USPROJ: Average Pressure =',E14.5)
    if (ntcabs.eq.ntmabs) close(10)
  endif
 
But when I start the calculation, it "crashes" after the partitioning  without returning any error. An error file exists but there is nothing inside. (I attached the listing file).

Any idea?
 
Best regards,
 
Stéphane
Attachments
listing.txt
(24.46 KiB) Downloaded 270 times
Stéphane Blanchet

Re: Problem when selecting internal faces

Post by Stéphane Blanchet »

Hello,

The mesh is in the link I send you in the topic "Pressure drop after restarting the simulation".

Best Regards,

Stéphane
Post Reply