CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Salome] Hybrid meshes with boundary layers (https://www.cfd-online.com/Forums/openfoam-meshing/250513-hybrid-meshes-boundary-layers.html)

giorgianig June 21, 2023 09:11

Hybrid meshes with boundary layers
 
Dear all,

I am modeling a network of pipes, here is a simplified geometry that contains the issue:
https://www.cfd-online.com/Forums/me...-21-143523.jpg

I would like to mesh the three straight pipes with structured hexahedra and the Ts with unstructured thetrahedra. I have make a partition with 10 solids (3 Ts and 7 straight pipes) :
https://www.cfd-online.com/Forums/me...-21-143701.jpg

I start meshing using submeshes from the central T with Netgen 3D-2D-1D, applying boundary layers on walls, and propogating on pipes with 3D extrusion, everything seems to go smoothly
https://www.cfd-online.com/Forums/me...-21-144033.jpg
There is the boundary layer on the walls as wanted
https://www.cfd-online.com/Forums/me...-21-143900.jpg
However, when I try to export to OpenFoam (I use salomeToOpenFOAM.py because there are piramids in the mesh), the export fails
https://www.cfd-online.com/Forums/me...-21-143928.jpg
and some defaultPatches are generated in the mesh tree:
https://www.cfd-online.com/Forums/me...118-image1.jpg
I think those defaultPatches are generating the export error, and I think they are generated because the mesh is not conformal. I visualized these patches, here is where they are located:
https://www.cfd-online.com/Forums/me...119-image2.jpg
and here is the shape
https://www.cfd-online.com/Forums/me...-21-144051.jpg
So those patches are genereated at the interface pipe/T when the T mesh is generated AFTER the pipe mesh. Using a clip also it is clear the mesh is not conformal.

Before the T
https://www.cfd-online.com/Forums/me...-21-144507.jpg

After the T:
https://www.cfd-online.com/Forums/me...-21-144802.jpg

Does anyone know how to fix it and generate a valid mesh?
Thanks in advance

Alczem June 21, 2023 09:34

Hey, me again :D


I tried to mesh several junctions the way you tried, and failed too, it seems impossible to create an extrusion with boundary layers between two junctions.


After seeing the pictures you attached, I think you should give cfMesh a try. It can generate nice boundary layers everywhere, and you can apply a nonuniform stretching to cells in the straight pipes to lower the cell count.

giorgianig June 21, 2023 10:40

Quote:

Originally Posted by Alczem (Post 852157)
Hey, me again :D


I tried to mesh several junctions the way you tried, and failed too, it seems impossible to create an extrusion with boundary layers between two junctions.


After seeing the pictures you attached, I think you should give cfMesh a try. It can generate nice boundary layers everywhere, and you can apply a nonuniform stretching to cells in the straight pipes to lower the cell count.

Hey Alczem, thanks again :)
This problem is really giving me headhaches!
I'll try out cfMesh right away

GerhardHolzinger June 22, 2023 11:18

1 Attachment(s)
You could try to separate your pipe geometry into two distinct entities: the pipe interior and the wall layer. In my experience, it is easier to generate matching meshes, when using tet and extrusion meshing, if you do not bother with boundary layers in the first step.


So, instead of meshing the T-sections using a tet meshing algorithm with a boundary layer hypothesis; you would mesh the interior of the T-section using tets, and then mesh the boundary layer region using an extrusion algorithm.


This increases the complexity of your geometry and the meshing workflow, but in my experience it is not possible to "inform" a boundary layer hypothesis from the outside.



I hope this makes somewhat sense.


Salome is very good at making meshes in a bottom-up approach. Hence, if you separate meshing of the interior and the creation of the boundary layers, you will be able to achieve nice meshes.

giorgianig June 23, 2023 09:03

Quote:

Originally Posted by GerhardHolzinger (Post 852216)
You could try to separate your pipe geometry into two distinct entities: the pipe interior and the wall layer. In my experience, it is easier to generate matching meshes, when using tet and extrusion meshing, if you do not bother with boundary layers in the first step.


So, instead of meshing the T-sections using a tet meshing algorithm with a boundary layer hypothesis; you would mesh the interior of the T-section using tets, and then mesh the boundary layer region using an extrusion algorithm.


This increases the complexity of your geometry and the meshing workflow, but in my experience it is not possible to "inform" a boundary layer hypothesis from the outside.



I hope this makes somewhat sense.


Salome is very good at making meshes in a bottom-up approach. Hence, if you separate meshing of the interior and the creation of the boundary layers, you will be able to achieve nice meshes.


Thanks for your reply. It seems unnecessarily complicated. I don't even know how to extract the inner geometry (inside the boundary layer) at the intersection between the pipes.

I mean, this is a trivial geometry, it's unbelievable it cannot be done with a classic procedure...

linnemann June 23, 2023 14:57

If you dont mind sharing the Geometry (BREP) I can give it a quick go

giorgianig June 24, 2023 10:26

Quote:

Originally Posted by linnemann (Post 852282)
If you dont mind sharing the Geometry (BREP) I can give it a quick go

Sure, here it is.

https://www.dropbox.com/scl/fi/una1c...kpspxm472x52fd

linnemann June 24, 2023 15:29

2 Attachment(s)
Hi


Here is the results after about 30min.
The trick is to mesh the Tee first, parallel project the inletFace of the Tee to the internalFace of the Tee.
Project each of the Mesh faces of the Tee to their own face from the geo.
Use the projected mesh to make an extrusion of the face into 3D along a 1D line Mesh.
Make a mesh compund of the Tee and the Vertical Mesh.
Copy that 2 times, copy the internal pipe 1 time and mirror the inlet mesh around the center.
Make a Compund mesh of all these meshes and that will automatically merge internal nodes/faces if they lie on top of each other.


I have provided a link to the Study and the resulting UNV file for you to look at.
checkMesh shows nice values.


https://drive.google.com/file/d/1Ddo...ew?usp=sharing


Code:

Checking geometry...
    Overall domain bounding box (-300 -10 -10) (300 10 300)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (-6.36013e-17 1.32379e-17 -3.5847e-17) OK.
    Max cell openness = 3.46929e-16 OK.
    Max aspect ratio = 42.7402 OK.
    Minimum face area = 0.19949. Maximum face area = 31.8451.  Face area magnitudes OK.
    Min volume = 0.141434. Max volume = 29.4749.  Total volume = 460177.  Cell volumes OK.
    Mesh non-orthogonality Max: 60.3271 average: 8.61917
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 2.06016 OK.
    Coupled point location match (average 0) OK.



giorgianig June 26, 2023 07:22

Quote:

Originally Posted by linnemann (Post 852311)
Hi


Here is the results after about 30min.
The trick is to mesh the Tee first, parallel project the inletFace of the Tee to the internalFace of the Tee.
Project each of the Mesh faces of the Tee to their own face from the geo.
Use the projected mesh to make an extrusion of the face into 3D along a 1D line Mesh.
Make a mesh compund of the Tee and the Vertical Mesh.
Copy that 2 times, copy the internal pipe 1 time and mirror the inlet mesh around the center.
Make a Compund mesh of all these meshes and that will automatically merge internal nodes/faces if they lie on top of each other.


I have provided a link to the Study and the resulting UNV file for you to look at.
checkMesh shows nice values.


https://drive.google.com/file/d/1Ddo...ew?usp=sharing


Code:

Checking geometry...
    Overall domain bounding box (-300 -10 -10) (300 10 300)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (-6.36013e-17 1.32379e-17 -3.5847e-17) OK.
    Max cell openness = 3.46929e-16 OK.
    Max aspect ratio = 42.7402 OK.
    Minimum face area = 0.19949. Maximum face area = 31.8451.  Face area magnitudes OK.
    Min volume = 0.141434. Max volume = 29.4749.  Total volume = 460177.  Cell volumes OK.
    Mesh non-orthogonality Max: 60.3271 average: 8.61917
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 2.06016 OK.
    Coupled point location match (average 0) OK.




Dear linnemann,

Thank you for the explication and the link :) Indeed, your solution is very interesting, but it does not apply to my real case. In fact, this is a simplified geometry, and in your procedure you exploited the symmetry of it. In my real case I can't do that.

https://www.cfd-online.com/Forums/me...-26-131116.jpg

In my case, I cannot avoid to generate the mesh of a T imposing the mesh on one (or more) of the external faces connected to the pipes. In your procedure, you meshed one T (without constraints), and copied that mesh. This cannot be done in a real case where every T is different from the other.

However, seeing what you did, I think I understood some key ingredients I was missing in Salome. Maybe I can mesh a T imposing the mesh on the faces using the 1D projections as you did in this simplified case?

giorgianig June 26, 2023 09:01

1 Attachment(s)
Quote:

Originally Posted by linnemann (Post 852311)
Hi


Here is the results after about 30min.
The trick is to mesh the Tee first, parallel project the inletFace of the Tee to the internalFace of the Tee.
Project each of the Mesh faces of the Tee to their own face from the geo.
Use the projected mesh to make an extrusion of the face into 3D along a 1D line Mesh.
Make a mesh compund of the Tee and the Vertical Mesh.
Copy that 2 times, copy the internal pipe 1 time and mirror the inlet mesh around the center.
Make a Compund mesh of all these meshes and that will automatically merge internal nodes/faces if they lie on top of each other.


I have provided a link to the Study and the resulting UNV file for you to look at.
checkMesh shows nice values.


https://drive.google.com/file/d/1Ddo...ew?usp=sharing


Code:

Checking geometry...
    Overall domain bounding box (-300 -10 -10) (300 10 300)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (-6.36013e-17 1.32379e-17 -3.5847e-17) OK.
    Max cell openness = 3.46929e-16 OK.
    Max aspect ratio = 42.7402 OK.
    Minimum face area = 0.19949. Maximum face area = 31.8451.  Face area magnitudes OK.
    Min volume = 0.141434. Max volume = 29.4749.  Total volume = 460177.  Cell volumes OK.
    Mesh non-orthogonality Max: 60.3271 average: 8.61917
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 2.06016 OK.
    Coupled point location match (average 0) OK.



There is something I don't understand in your procedure: when I display the mesh called InletMesh it shows a 3D mesh, but when I try to edit I can only see a 2D algorithm, as you meshed only the face on the base:



How is it done exactly this 3d extrusion?

Thanks in advance

linnemann June 26, 2023 14:00

2 Attachment(s)
Sure, attached are the steps.


Regarding your real case.
You can do the same with "Extrusion along path" and the projecting the faces where they are in-line.
The face meshes need to match up in order for the merging of nodes on the compound mesh.
So its doable, just takes a bit of time.

giorgianig June 27, 2023 08:32

Quote:

Originally Posted by linnemann (Post 852374)
Sure, attached are the steps.


Regarding your real case.
You can do the same with "Extrusion along path" and the projecting the faces where they are in-line.
The face meshes need to match up in order for the merging of nodes on the compound mesh.
So its doable, just takes a bit of time.

Well, I am not sure. Every time I try, it fails. The problem resides on the fact that the Netgen 3D algorithms seems incompatible with the imposition of a face mesh. I am able to propagate the mesh from an unstructured to a structured (3d extrusion) one, but not the other way around.

giorgianig June 27, 2023 08:52

Quote:

Originally Posted by linnemann (Post 852374)
Sure, attached are the steps.


Regarding your real case.
You can do the same with "Extrusion along path" and the projecting the faces where they are in-line.
The face meshes need to match up in order for the merging of nodes on the compound mesh.
So its doable, just takes a bit of time.



See this example: I am extruding a mesh in a pipe, I get this

https://www.cfd-online.com/Forums/me...-27-144216.png

Now I need to mesh the next connected part (this cone):

https://www.cfd-online.com/Forums/me...-27-144106.png

I projet the 2D mesh from the pipe to the upper face of the cone

https://www.cfd-online.com/Forums/me...-27-144508.png

this goes well:

https://www.cfd-online.com/Forums/me...-27-144553.png

Now I want to mesh the cone with an unstructured mesh, keeping the mesh of the face on the top. Here I am not sure what algorithm to use.. If I use Netgen 3D-2D-1D, the final mesh looks like this

https://www.cfd-online.com/Forums/me...-27-144939.png

See what I mean? The mesh of the top face has changed! Why is it doing that is beyond my comprehension.

If I just mesh using Net 3D-2D-1D WITHOUT projecting the face mesh before, the mesh on the top face looks kind of OK, but the nodes are not matching (which is understandable since the two meshes are completely independent)

linnemann June 27, 2023 14:18

1 Attachment(s)
Hi


You are correct, doing it this way for you case breaks the face mesh when it is projected when it has boundary layers. Without BL it works fine.


There is a way to do it using the "Extrusion 3D" meshing strategy.


Here is a link to the case and the checkMesh output.


https://drive.google.com/file/d/1De3...ew?usp=sharing


Code:

Checking geometry...
    Overall domain bounding box (0 -49.9013 -49.6057) (700 49.9013 50)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (7.93909e-17 3.36127e-18 -1.20437e-17) OK.
    Max cell openness = 7.47279e-16 OK.
    Max aspect ratio = 46.4566 OK.
    Minimum face area = 1.33659. Maximum face area = 316.204.  Face area magnitudes OK.
    Min volume = 8.42164. Max volume = 973.656.  Total volume = 3.36768e+06.  Cell volumes OK.
    Mesh non-orthogonality Max: 19.7951 average: 7.36319
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.315532 OK.
    Coupled point location match (average 0) OK.

Mesh OK.


giorgianig June 28, 2023 03:44

Quote:

Originally Posted by linnemann (Post 852413)
Hi


You are correct, doing it this way for you case breaks the face mesh when it is projected when it has boundary layers. Without BL it works fine.


There is a way to do it using the "Extrusion 3D" meshing strategy.


Here is a link to the case and the checkMesh output.


https://drive.google.com/file/d/1De3...ew?usp=sharing


Code:

Checking geometry...
    Overall domain bounding box (0 -49.9013 -49.6057) (700 49.9013 50)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (7.93909e-17 3.36127e-18 -1.20437e-17) OK.
    Max cell openness = 7.47279e-16 OK.
    Max aspect ratio = 46.4566 OK.
    Minimum face area = 1.33659. Maximum face area = 316.204.  Face area magnitudes OK.
    Min volume = 8.42164. Max volume = 973.656.  Total volume = 3.36768e+06.  Cell volumes OK.
    Mesh non-orthogonality Max: 19.7951 average: 7.36319
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.315532 OK.
    Coupled point location match (average 0) OK.

Mesh OK.


Yes of course, but that was just an example. What I need is an unstructured mesh. What do you do if you have a T instead of a cone?

GerhardHolzinger June 28, 2023 04:31

Quote:

Originally Posted by linnemann (Post 852413)

You are correct, doing it this way for you case breaks the face mesh when it is projected when it has boundary layers. Without BL it works fine.




This observed behaviour is exactly why I suggested to split-off the geometric region which is to contain the boundary layer. So, that you can create your hybrid mesh of tets and extrusions without the hassle of boundary layers. And then in a second step, extrude your boundary layers radially from the surface of the interior region.


This is a lot of extra work; but Salome is really good at creating meshes in a bottom-up approach as long as the individual steps are simple.

linnemann June 28, 2023 13:34

Quote:

Originally Posted by giorgianig (Post 852428)
Yes of course, but that was just an example. What I need is an unstructured mesh. What do you do if you have a T instead of a cone?

I see your problem now. If I make a Tee after the cone, the project face trick does not work anymore as the BL will cause issues in that instance.

So the best approach IMO is either to make the connection between the parts with AMI and live with the small interpolation errors introduced.
It can be done in Salome, but it will be tedious and error prone.

Or, you do as previously suggested and use cfMesh and live with the higher cellcount. This would be my prefered method.
You will loose some time in solving, but you will gain it back manyfold by not having to deal with the mesh.

Do you want to share the complex shape in post #9? I can give it a quick cfMesh go.

giorgianig June 29, 2023 03:47

Quote:

Originally Posted by linnemann (Post 852446)
I see your problem now. If I make a Tee after the cone, the project face trick does not work anymore as the BL will cause issues in that instance.

So the best approach IMO is either to make the connection between the parts with AMI and live with the small interpolation errors introduced.
It can be done in Salome, but it will be tedious and error prone.

Or, you do as previously suggested and use cfMesh and live with the higher cellcount. This would be my prefered method.
You will loose some time in solving, but you will gain it back manyfold by not having to deal with the mesh.

Do you want to share the complex shape in post #9? I can give it a quick cfMesh go.

Thank you Niels. Yes, here is the geometry:

https://www.dropbox.com/scl/fi/b7zpl...i9k426iwzt83gf

I have already tried cfMesh. Without anisotropic refinement, it produces a good mesh with about 500K elements. I believe this case could be done with a good resolution with less then 200K. Unfortunately, I think there is a bug in the anisotropic refinement in cfmesh. I posted the issue on a simplified case here:

https://www.cfd-online.com/Forums/op...t-working.html

and here

https://www.cfd-online.com/Forums/op...ent-fails.html

If you could take a look to it and tell me what you think it would be great.

Your help is really appreciated.
Giorgio

giorgianig June 29, 2023 04:00

Quote:

Originally Posted by GerhardHolzinger (Post 852429)
This observed behaviour is exactly why I suggested to split-off the geometric region which is to contain the boundary layer. So, that you can create your hybrid mesh of tets and extrusions without the hassle of boundary layers. And then in a second step, extrude your boundary layers radially from the surface of the interior region.


This is a lot of extra work; but Salome is really good at creating meshes in a bottom-up approach as long as the individual steps are simple.

Dear Gerhard, your approach would certainly work. However, it is not useful to me. What I am doing here is to investigate the possibility of opening a CFD activity in my company using opensource codes. I am trying to find out procedures to approach real cases. These procedures must obviously be competitive with proprietary softwares. I think the approach you propose it's too involved to be competitive.

All in all this turns out to be a big limitation of Salome. The geometry is simple, the strategy is clear, and yet you can't do it. That's a pity since the software is appealing in so many other aspects.

GerhardHolzinger June 29, 2023 09:02

Dear Giorgio,


Even if you need to use a different meshing software for meshing the geometry in question, take this episode as a vital learning experience. If you understand what Salome can easily do, and what not; you may benefit in the future.


Depending on your workflows, you may help your meshing efforts in the geometry creation stage prior to beginning meshing. Sometimes it is easier to accomodate the needs of the meshing software when creating the geometry, rather than working around issues within the meshing software.


The beauty of applying open source software is that you can use apply all of them. With expensive commerical software, you would likely select the most fitting one, and that would be it. With open source, you can simply use them all.


All times are GMT -4. The time now is 07:05.