Defining faces as physical surfaces in Salome

Mesh generators, CAD programs, and other tools
tibich72
Posts: 63
Joined: 07 Dec 2009, 05:16

Defining faces as physical surfaces in Salome

Post by tibich72 » 27 Sep 2011, 00:34

I'm trying to migrate from Gmsh to Salome for meshing my geometries, but I'm encountering significant differences in results between the two. Basically, In Gmsh I was scripting the .geo file such that every solid and every face from the .brep geometry file becomes a physical volume and physical surface, respectively. Basically, the script is something like this:

Code: Select all

Physical Surface (1) = {1};
Physical Surface (2) = {2};
Physical Surface (3) = {3};
....
Physical Surface (165) = {165};
Physical Surface (166) = {166};
Physical Surface (167) = {167};
Physical Volume (1) = {1};
Physical Volume (2) = {2};
Physical Volume (3) = {3};
....
Physical Volume (26) = {26};
Physical Volume (27) = {27};
Physical Volume (28) = {28};
This enables me to identify the boundaries and bodies in the .sif file in an 1-indexed fashion (boundaries indices start at 1, and body indices start at 1 too).

However, for Salome, there does not seem to be possible to have the separate indices for faces and bodies -- there can only be groups. In the Salome meshing script, I'm basically finding all solids and all faces, and then declaring each one as a group:

Code: Select all

demo_brep_1 = geompy.Import("<my file path>", "BREP")
geompy.addToStudy( demo_brep_1, "demo.brep_1" )

solids = geompy.SubShapeAll(demo_brep_1, geompy.ShapeType["SOLID"])
faces = geompy.SubShapeAll(demo_brep_1, geompy.ShapeType["FACE"])

#.... create study, do meshing ....

for idx in range(len(solids)):
  sld = solids[idx]
  sld_g = Mesh_1.Group(sld)

for idx in range(len(faces)) :
  face = faces[idx]
  face_g = Mesh_1.Group(face)
The mesh is saved in UNV file format. When importing with ElmerGrid, this is what I get:

Code: Select all

Reading group 1 with 35404 entities: sld_0
Reading group 2 with 13001 entities: sld_1
Reading group 3 with 11 entities: sld_2
...
Reading group 26 with 270 entities: sld_25
Reading group 27 with 530 entities: sld_26
Reading group 28 with 3584 entities: sld_27

Reading group 29 with 62 entities: face_0
Reading group 30 with 62 entities: face_1
Reading group 31 with 90 entities: face_2
...
Reading group 193 with 52 entities: face_164
Reading group 194 with 90 entities: face_165
Reading group 195 with 213 entities: face_166
So, basically, the faces are given group numbers that start after the highest solid index. For simulation, what was before in the .sif file with Gmsh meshing:

Code: Select all

Boundary Condition 1
  Target Boundaries(1) = 1                 <----
  Name = "Airbox Boundary 1"
  Temperature = 25
End
should become:

Code: Select all

Boundary Condition 1
  Target Boundaries(1) = 29                 <----
  Name = "Airbox Boundary 1"
  Temperature = 25
End
Is this the correct way to change the .sif file? Is group 29 really interpreted as a face, or is interpreted as a degenerate solid of width 0?

Is there a way to have the physical faces numbered starting from 1? Alternatively, are there any additional parameters that should be passed to ElmerGrid to achieve this?

As I've mentioned, the differences between the results with Gmsh and Salome are quite large for similar sized meshes, about 25% -- and this indexing of faces seems to be the only difference between the two simulations.

Thanks

raback
Site Admin
Posts: 3264
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Defining faces as physical surfaces in Salome

Post by raback » 27 Sep 2011, 01:10

Hi
Is there a way to have the physical faces numbered starting from 1?
Try "-boundorder" flag of ElmerGrid.

-Peter

tibich72
Posts: 63
Joined: 07 Dec 2009, 05:16

Re: Defining faces as physical surfaces in Salome

Post by tibich72 » 27 Sep 2011, 04:06

Thanks for the suggestion. I've used that flag and it almost does what I need. Here's the (truncated) output:

Code: Select all

Reading group 1 with 35404 entities: sld_0
Reading group 2 with 13001 entities: sld_1    <-- group 2 is a solid
Reading group 3 with 11 entities: sld_2
Reading group 4 with 42 entities: sld_3
.....
Initial boundary interval [2,195]
boundary index changed 29 -> 1 in 62 elements
boundary index changed 30 -> 2 in 62 elements
boundary index changed 31 -> 3 in 90 elements
....
boundary index changed 193 -> 165 in 52 elements
boundary index changed 194 -> 166 in 90 elements
boundary index changed 195 -> 167 in 213 elements
boundary index changed 2 -> 168 in 1441 elements            <--- strangeness
Mapping boundary types from [2 195] to [1 168]
Somehow the translation ends up with an extra boundary (index 2), which becomes now boundary 168. There are only 167 faces in the geometry. Group 2 is a solid, with 13001 tets (checked that in Salome).

Could this is the reason for the difference in results: group #2 is somehow imported by ElmerGrid as an empty shell instead of a solid?

Thanks,
Tibi

raback
Site Admin
Posts: 3264
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Defining faces as physical surfaces in Salome

Post by raback » 27 Sep 2011, 09:32

Hi Tibi

Yes, that seems strange. Perhaps you could sent the .unv file for debugging.

-Peter

tibich72
Posts: 63
Joined: 07 Dec 2009, 05:16

Re: Defining faces as physical surfaces in Salome

Post by tibich72 » 27 Sep 2011, 16:41

Hi Peter,

I'm trying to attach the gzip-ed unv file (it's 1.3MB) -- hopefully it can be processed. As mentioned, the UNV file is produced using Salome 5.1.5 for Windows. I'm using Elmer 6.1 for Windows.

Thanks for taking a look at this.

Tibi
Attachments
demo.unv.gz
Gzip-ed unv file
(1.36 MiB) Downloaded 127 times

tibich72
Posts: 63
Joined: 07 Dec 2009, 05:16

Re: Defining faces as physical surfaces in Salome

Post by tibich72 » 20 Oct 2011, 17:38

Hi Peter,

any luck identifying the problem in the ElmerGrid conversion?

Thanks,
Tibi

raback
Site Admin
Posts: 3264
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Defining faces as physical surfaces in Salome

Post by raback » 20 Oct 2011, 18:04

tibich72 wrote:any luck identifying the problem in the ElmerGrid conversion?
Sorry, been too busy lately. Looking already forward for Xmas when the real work takes a pause ;-) Still I'll try to find a slot but cannot promise any schedule.

-Peter

tibich72
Posts: 63
Joined: 07 Dec 2009, 05:16

Re: Defining faces as physical surfaces in Salome

Post by tibich72 » 20 Oct 2011, 18:34

Thanks for the update. I'm also looking at the ElmerGrid code, maybe I can spot the problem myself; I'm also trying to figure out whether the formatting of the file is somehow wrong, but I have a hard time finding a document with the specifications for UNV files: do you know of any such document?

Will post to this thread if I've made any progress.
Tibi

raback
Site Admin
Posts: 3264
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Defining faces as physical surfaces in Salome

Post by raback » 20 Oct 2011, 19:01

Hi

http://www.sdrl.uc.edu/universal-file-f ... le-formats

This is perhaps the ugliest format I've made a parser for, so no wonder if it does not always work. Basically one cannot write a generic parser froms scratch as there are so many fields. So rather I've just coded the fields that I've encountered.

-Peter

tibich72
Posts: 63
Joined: 07 Dec 2009, 05:16

Re: Defining faces as physical surfaces in Salome

Post by tibich72 » 20 Oct 2011, 20:13

You mean the UNV format can have any of those 3300+ fields? Yeah, that'd be pretty complicated.

I don't know if this helps -- I've tried to import the mesh in Gmsh (which should understand UNV files too). Gmsh was able to import a single volume, which is number 2, the one that's imported as a shell by ElmerGrid. So, there seems to be something special or weird about that volume.

Thanks,
Tibi

Post Reply