CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[mesh manipulation] Refine a 3D-Mesh resulting in pure hex-mesh

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 2 Post By Phicau
  • 1 Post By vatavuk
  • 1 Post By mturcios777
  • 3 Post By mturcios777

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 5, 2015, 15:30
Default Refine a 3D-Mesh resulting in pure hex-mesh
  #1
New Member
 
Join Date: Nov 2014
Posts: 10
Rep Power: 12
smoerebroet is on a distinguished road
Hi FOAMers!

I tried to use refineMesh to refine some regions of my mesh. Unfortunately, it produces polyhedral-cells, which are unacceptable for our purposes. Does anyone of you have any idea how to refine those cells while not producing non-hexa-cells. Hanging nodes are not a problem. Normally it should be possible to split every convex hexa cell in eight smaller hexas, by simply splitting the edges in half and adding 7 additional vertices, or am I mistaken? If it is possible, do you know if there is a tool, which does exactly that?

Thank you very much in advance!!

Thomas

Last edited by smoerebroet; February 5, 2015 at 15:31. Reason: hexa polyhedral refine
smoerebroet is offline   Reply With Quote

Old   February 6, 2015, 11:34
Default
  #2
New Member
 
Join Date: Nov 2014
Posts: 10
Rep Power: 12
smoerebroet is on a distinguished road
It would even be helpful, if somebody knew that its not possible in openFoam! Or even better would know a tool which can refine keeping up the hexa-structure of mesh.

Thanks alot!
smoerebroet is offline   Reply With Quote

Old   February 6, 2015, 13:02
Default
  #3
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
The answer depends on a few parameters:

1) Is your original mesh hexahedral only?
2) What coordinate system and directions are your refining your region in?

A visual example and your refineMeshDict would be helpful.
mturcios777 is offline   Reply With Quote

Old   February 9, 2015, 20:00
Default
  #4
New Member
 
Join Date: Nov 2014
Posts: 10
Rep Power: 12
smoerebroet is on a distinguished road
Hi Marco!

Thanks alot for your reply! I hope you had a nice weekend. Sorry for answering late. I didnt find the time to write earlier. Regarding your questions:

Quote:
Originally Posted by mturcios777 View Post
1) Is your original mesh hexahedral only?
Yes, it is.

Quote:
Originally Posted by mturcios777 View Post
2) What coordinate system and directions are your refining your region in?

A visual example and your refineMeshDict would be helpful.
I am refining in all three directions. Unfortunately, the geometry is quite complicated. A refinement in less than one direction therefore is not adequate. As you can see in pics attached, I try to mesh a complex shaped room. For the visual exaples, I cut the geometry vertically in the first two pictures and horizontaly in the last two pictures. In the centre there is a circular area, where eight pipes are arranged in radial direction. Each of the pipes is intersecting a wall, where there is a gap between the wall and the pipe. Since this gap is quite small compared to our mesh size we would like to locally refine it. As I said the hexaedral mesh is essential for our solver. However, when refining in the intersection area between the refined cells and the non-refined cells polyhedrical cells are emerging.

My refineMeshDict:

Quote:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

set toBeRefined;

coordinateSystem global;

globalCoeffs
{
tan1 ( 1 0 0 );
tan2 ( 0 1 0 );
tan3 ( 0 0 1 );
}

directions (tan1, tan2, normal);

useHexTopology yes;

geometricCut no;

writeMesh no;

// ************************************************** *********************** //
Thanks very much for your reply. I am thankful for any thought you or someone else might have!

Thomas
Attached Images
File Type: jpg horizontalPlane.jpg (92.0 KB, 277 views)
File Type: jpg horizontalPlane_refined.jpg (92.3 KB, 249 views)
File Type: jpg verticalPlane.jpg (98.0 KB, 216 views)
File Type: jpg verticalPlane_refined.jpg (97.6 KB, 174 views)
smoerebroet is offline   Reply With Quote

Old   February 10, 2015, 05:16
Default
  #5
Senior Member
 
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 200
Rep Power: 18
vatavuk is on a distinguished road
Hi,
Are you sure that the resulting mesh has polyhedral cells? Sometimes Paraview produces artifacts in the image showing some edges that are not really in the model. I've seen a thread about this some time ago, but I wasn't able to locate it. Does checkmesh report polyhedral cells?
Best Regards,
Paulo
vatavuk is offline   Reply With Quote

Old   February 10, 2015, 08:38
Default
  #6
New Member
 
Join Date: Nov 2014
Posts: 10
Rep Power: 12
smoerebroet is on a distinguished road
Hi Paulo,

thank you for your relpy. Indeed checkMesh reports polyhedral cells. And as I said it seems as though they are located at the interface between the refined and the non-refined cells.

Best regards,

Thomas
smoerebroet is offline   Reply With Quote

Old   February 10, 2015, 12:04
Default
  #7
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi Thomas,

this is totally normal, so don't worry, if they were hexahedral cells initially that has not changed with the refinement. See this example of a general (level 0) hex next to a refined one:

Code:
·----·----·--------·
|    |    |        |
·----·----·        |
|    |    |        |
·----·----·--------·
You can note that one of the faces of the level 0 hex has been splitted into 4 (in 3D), so that the cell does no longer have 6 faces, but 9. Therefore, it is no longer a hex for OpenFOAM although it really is.

Also don't pay attention on how paraview splits the cells, it is just a visualization artifact.

Best,

Pablo
kindle and RicardoFE95 like this.
Phicau is offline   Reply With Quote

Old   February 10, 2015, 13:47
Default
  #8
Senior Member
 
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 200
Rep Power: 18
vatavuk is on a distinguished road
Hi Thomas,
Pablo is correct; you always will have polyhedral cells in the interface, and Paraview divides polyhedral cells in tetrahedra before visualization.
The only remaining question is: Do you need to be completely sure that there are only hexahedra in your mesh?
I found the thread about the visualization artifacts:
http://www.cfd-online.com/Forums/ope...-parafoam.html
Best Regards,
Paulo
kindle likes this.
vatavuk is offline   Reply With Quote

Old   February 10, 2015, 15:54
Default
  #9
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Excellent response from Vatatuk. There is another thing you should be aware of. When you refine in the global direction, things get weird when your faces are not aligned with major coordinate sections. Think of refining a cube rotated 45 degrees on the z axis. If you refine in x and y, you will need to cut the cell into triangles (cutting from corner to corner) so you get the same number of cells in x as in y, something like this: http://www.mathematische-basteleien....0of%20a%20Cube

If you want the division to be aligned with the local coordinate system, you will need to use the patchLocal coordinate system, and only refine a subset where a patch normal can be aligned to one of the local coordinate systems.
lukasf likes this.
mturcios777 is offline   Reply With Quote

Old   February 10, 2015, 16:33
Default
  #10
New Member
 
Join Date: Nov 2014
Posts: 10
Rep Power: 12
smoerebroet is on a distinguished road
Thank you Pablo and Paulo for your replies. It fells like I am one step closer to the solution, if there is any.

Ok, so what you are saying, Pablo is that at the interface of refined to non refined cells the faces get split. Therefore, the unrefined cell at the interface has no more six faces but nine, since one of the former six faces got split into four new faces. Each of the for new faces should then have four vertices. However, in the faces-file there are faces with five and six vertices. Is there a contradiction to your post Pablo, or did I understand something wrong?

We in deed need a perfectly hexaedral mesh, Paulo. We want to use adaptive Mesh refinement, and our in-house code uses isotropic mesh refinement based on a hexadrical mesh.

Best regards,

Thomas
smoerebroet is offline   Reply With Quote

Old   February 10, 2015, 17:08
Default
  #11
New Member
 
Join Date: Nov 2014
Posts: 10
Rep Power: 12
smoerebroet is on a distinguished road
Hey Marco,

thank you too!

I changed to local refinement, but the result is exactly the same. However, you are right of course I will keep the local coordinate setting, just in case.

Therefore, an update on my refineMeshDict:
Quote:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

set toBeRefined;

coordinateSystem patchLocal;
/*
globalCoeffs
{
tan1 ( 1 0 0 );
tan2 ( 0 1 0 );
tan3 ( 0 0 1 );
}
*/
patchLocalCoeffs
{
// Normal direction is face normal of zero'th face of patch
patch outside;
tan1 ( 1 0 0 );
tan2 ( 0 1 0 );
tan3 ( 0 0 1 );
}


directions (tan1 tan3 normal);

useHexTopology yes;

geometricCut no;

writeMesh no;

// ************************************************** *********************** //
Regards

Thomas
smoerebroet is offline   Reply With Quote

Old   February 10, 2015, 18:19
Default
  #12
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
I've been using refineMesh in 2.3.x, so the entries might be different. The most important entry is patch, which defines the normal direction, and the other direction tan1. The local coordinate system is such that tan1 X tan2 = normal.

If you wanted to refine a purely cylindrical mesh, the patch I would select the outer surface of the cylinder (to get the radial direction), and set tan1 as the axial direction, so that tan2 is the azimuthal direction.

Judging from your mesh, you won't be able to do this on all cells at once, so you should select subsets of the mesh using topoSet.

One last thing; when refineMesh is run without arguments, global refinement happens in all directions no matter what. At least it does in 2.3.x. You need to use -dict as an option to specify you want to use the dictionary.
amolrajan, H.R.D. and lukasf like this.
mturcios777 is offline   Reply With Quote

Old   February 11, 2015, 07:42
Default
  #13
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Quote:
Originally Posted by smoerebroet View Post
Thank you Pablo and Paulo for your replies. It fells like I am one step closer to the solution, if there is any.

Ok, so what you are saying, Pablo is that at the interface of refined to non refined cells the faces get split. Therefore, the unrefined cell at the interface has no more six faces but nine, since one of the former six faces got split into four new faces. Each of the for new faces should then have four vertices. However, in the faces-file there are faces with five and six vertices. Is there a contradiction to your post Pablo, or did I understand something wrong?

We in deed need a perfectly hexaedral mesh, Paulo. We want to use adaptive Mesh refinement, and our in-house code uses isotropic mesh refinement based on a hexadrical mesh.

Best regards,

Thomas
Hi Thomas,

this probably has to do with the issue that Marco pointed out and I had not noticed before: some of your cells are not aligned with the global XYZ axes. Since you have already tried the local directions, I don't know how to correct this issue.

Best,

Pablo
Phicau is offline   Reply With Quote

Old   February 11, 2015, 08:06
Default
  #14
New Member
 
Join Date: Nov 2014
Posts: 10
Rep Power: 12
smoerebroet is on a distinguished road
Sounds reasonable, thanks a lot guys!
smoerebroet is offline   Reply With Quote

Old   May 5, 2015, 12:14
Smile
  #15
Member
 
Howar
Join Date: Mar 2015
Posts: 53
Rep Power: 11
Howard is on a distinguished road
Quote:
Originally Posted by smoerebroet View Post
Hi Marco!

Thanks alot for your reply! I hope you had a nice weekend. Sorry for answering late. I didnt find the time to write earlier. Regarding your questions:



Yes, it is.



I am refining in all three directions. Unfortunately, the geometry is quite complicated. A refinement in less than one direction therefore is not adequate. As you can see in pics attached, I try to mesh a complex shaped room. For the visual exaples, I cut the geometry vertically in the first two pictures and horizontaly in the last two pictures. In the centre there is a circular area, where eight pipes are arranged in radial direction. Each of the pipes is intersecting a wall, where there is a gap between the wall and the pipe. Since this gap is quite small compared to our mesh size we would like to locally refine it. As I said the hexaedral mesh is essential for our solver. However, when refining in the intersection area between the refined cells and the non-refined cells polyhedrical cells are emerging.

My refineMeshDict:

Thanks very much for your reply. I am thankful for any thought you or someone else might have!

Thomas
Hi, friends could I ask how you do this hex mesh? because I also have a complex geometry to mesh which contains many small cylinders on surface.
Howard is offline   Reply With Quote

Old   May 5, 2015, 13:25
Default
  #16
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Either make the mesh in blockmesh and enforce hexahedral cells everywhere, or use snappyHexMesh and adjust the settings as best you can.
mturcios777 is offline   Reply With Quote

Old   October 31, 2018, 10:56
Default
  #17
Senior Member
 
Lukas Fischer
Join Date: May 2018
Location: Germany, Munich
Posts: 117
Rep Power: 8
lukasf is on a distinguished road
Quote:
Originally Posted by smoerebroet View Post
Hi Marco!

Thanks alot for your reply! I hope you had a nice weekend. Sorry for answering late. I didnt find the time to write earlier. Regarding your questions:



Yes, it is.



I am refining in all three directions. Unfortunately, the geometry is quite complicated. A refinement in less than one direction therefore is not adequate. As you can see in pics attached, I try to mesh a complex shaped room. For the visual exaples, I cut the geometry vertically in the first two pictures and horizontaly in the last two pictures. In the centre there is a circular area, where eight pipes are arranged in radial direction. Each of the pipes is intersecting a wall, where there is a gap between the wall and the pipe. Since this gap is quite small compared to our mesh size we would like to locally refine it. As I said the hexaedral mesh is essential for our solver. However, when refining in the intersection area between the refined cells and the non-refined cells polyhedrical cells are emerging.

My refineMeshDict:

Thanks very much for your reply. I am thankful for any thought you or someone else might have!

Thomas


Do not write:

Code:
directions      (tan1, tan2, normal);
instead write:

Code:
directions      (tan1 tan2 normal);
without the commas!


Using the commas can result in problems in my experience if several overlapping topoSets are used to be refined.


In my test cases ( see my post at refineMesh Problems: strange cells/cuts were added ) you would not be able to do the Allrun_wrong_command_order with the case "0_understandRefineMesh" and you could not run Allrun with the case "1_understandRefineMesh".


The error message would be something like

Code:
 could not find direction "tan1,";

As long as your topoSets do not overlap with already refined topoSets you can use the comma without issues.
lukasf is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pimpleDyMFoam - rho not found maasyraf3 OpenFOAM Running, Solving & CFD 10 June 5, 2017 14:05
This mesh contains patches of type empty but is not 1D or 2D oric OpenFOAM Running, Solving & CFD 36 November 28, 2016 08:12
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
[snappyHexMesh] Pure hex mesh with snappy alf23 OpenFOAM Meshing & Mesh Conversion 17 February 17, 2013 15:24
[Other] 2D hex mesh on multi element airfoil Verfblikje OpenFOAM Meshing & Mesh Conversion 0 January 19, 2012 11:55


All times are GMT -4. The time now is 18:47.