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

[snappyHexMesh] addLayers directly from blockMesh

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 17, 2025, 00:17
Default addLayers directly from blockMesh
  #1
New Member
 
Cristopher Medina Samanez
Join Date: Jul 2023
Posts: 6
Rep Power: 4
stopherkri is on a distinguished road
Hello guys,

I was wondering if it's possible to use only the addLayers part of snappyHexMesh to a mesh created with blockMesh (so I have no stls in the triSurface folder).

Appreciate your help.
stopherkri is offline   Reply With Quote

Old   November 17, 2025, 02:33
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 724
Rep Power: 13
AtoHM is on a distinguished road
Uh, not sure, never used it this way. Maybe someone else has?

I just want to add: you can use grading in blockMesh to generate clean perfect layers there even for very low y+ which would likely not be possible in sHM.
AtoHM is offline   Reply With Quote

Old   November 17, 2025, 04:29
Default
  #3
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 359
Rep Power: 29
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Should be possible, why don't you just try it?
GerhardHolzinger is offline   Reply With Quote

Old   November 17, 2025, 11:02
Default
  #4
New Member
 
Cristopher Medina Samanez
Join Date: Jul 2023
Posts: 6
Rep Power: 4
stopherkri is on a distinguished road
Quote:
Originally Posted by AtoHM View Post
Uh, not sure, never used it this way. Maybe someone else has?

I just want to add: you can use grading in blockMesh to generate clean perfect layers there even for very low y+ which would likely not be possible in sHM.

I did the grading with blockMesh previously, but I'm modelling steps so the corners are the problem I'm getting big values of y+ in the "riser" part of the step. Maybe I could divide each step in two blocks, but I have more than 10 steps so i'm looking for a workaround.
stopherkri is offline   Reply With Quote

Old   November 17, 2025, 11:05
Default
  #5
New Member
 
Cristopher Medina Samanez
Join Date: Jul 2023
Posts: 6
Rep Power: 4
stopherkri is on a distinguished road
Quote:
Originally Posted by GerhardHolzinger View Post
Should be possible, why don't you just try it?
Apparently it needs to run castellatedMesh first. So I use surfaceMeshExtract to create and stl of my patch but when running snappyHexMesh the surfaces don't seem to align perfectly, so I end up with two surfaces.
stopherkri is offline   Reply With Quote

Old   November 17, 2025, 11:30
Default
  #6
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,358
Rep Power: 32
Yann will become famous soon enoughYann will become famous soon enough
Quote:
Originally Posted by stopherkri View Post
Apparently it needs to run castellatedMesh first. So I use surfaceMeshExtract to create and stl of my patch but when running snappyHexMesh the surfaces don't seem to align perfectly, so I end up with two surfaces.
At the beginning of snappyHexMeshDict, you can deactivate the castellated and snap steps to only run the addLayers step:

Code:
// Which of the steps to run
castellatedMesh false;
snap            false;
addLayers       true;
This should allow you to add layers on your mesh created with blockMesh.
Yann is offline   Reply With Quote

Old   November 17, 2025, 21:24
Default
  #7
New Member
 
Cristopher Medina Samanez
Join Date: Jul 2023
Posts: 6
Rep Power: 4
stopherkri is on a distinguished road
Quote:
Originally Posted by Yann View Post
At the beginning of snappyHexMeshDict, you can deactivate the castellated and snap steps to only run the addLayers step:

Code:
// Which of the steps to run
castellatedMesh false;
snap            false;
addLayers       true;
This should allow you to add layers on your mesh created with blockMesh.
I've tried that, but It seems like it is requiered to run castellatedMesh previously which I've done by creating a stl surface from my blockMeshDict. However, I have not been succesful since my mesh doesn't intersect perfectly with this surface.
stopherkri is offline   Reply With Quote

Old   November 18, 2025, 03:30
Default
  #8
Senior Member
 
M
Join Date: Dec 2017
Posts: 724
Rep Power: 13
AtoHM is on a distinguished road
Technically I agree, it should work, but I was vague in my first comment, because I am not totally sure how. We can deactivate the other steps, but I am not sure how to adress the entities from blockMesh.
In the template sHMDict I am always using, we have a comment saying


Code:
// Per final patch (so not geometry!) the layer information

layers
{
 ...
}
I guess it comes from some annotated dict in an offical repo. Normally, when using STLs we add here the region names of the STL with the respective number of layers. What do we add for blockMesh? According to the comment, we need to create proper patches there and then we can adress them?
AtoHM is offline   Reply With Quote

Old   November 18, 2025, 04:20
Default
  #9
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,358
Rep Power: 32
Yann will become famous soon enoughYann will become famous soon enough
Quote:
Originally Posted by stopherkri View Post
I've tried that, but It seems like it is requiered to run castellatedMesh previously which I've done by creating a stl surface from my blockMeshDict.
Which version of OpenFOAM are you using ?

Can you give details of what you tried and why you say it requires to run castellatedMesh previously? (for instance, sharing your blockMeshDict, snappyHexMeshDict and logs, error message...)


Quote:
Originally Posted by AtoHM View Post
Technically I agree, it should work, but I was vague in my first comment, because I am not totally sure how. We can deactivate the other steps, but I am not sure how to adress the entities from blockMesh.
In the template sHMDict I am always using, we have a comment saying


Code:
// Per final patch (so not geometry!) the layer information

layers
{
 ...
}
I guess it comes from some annotated dict in an offical repo. Normally, when using STLs we add here the region names of the STL with the respective number of layers. What do we add for blockMesh? According to the comment, we need to create proper patches there and then we can adress them?

You can add layers on the blockMesh patches, you don't need STL for this.
Check the motorBike case for example, where layers are added on the lowerWall, which is a patch created in blockMesh and not from the STL/OBJ surface.
Actually you can easily check this by removing all mentions to the motorbike in the motorbile tutorial and only add layers on some of the blockMesh patches.
AtoHM likes this.
Yann is offline   Reply With Quote

Old   November 18, 2025, 12:32
Default
  #10
New Member
 
Cristopher Medina Samanez
Join Date: Jul 2023
Posts: 6
Rep Power: 4
stopherkri is on a distinguished road
Quote:
Originally Posted by Yann View Post
Which version of OpenFOAM are you using ?

Can you give details of what you tried and why you say it requires to run castellatedMesh previously? (for instance, sharing your blockMeshDict, snappyHexMeshDict and logs, error message...)





You can add layers on the blockMesh patches, you don't need STL for this.
Check the motorBike case for example, where layers are added on the lowerWall, which is a patch created in blockMesh and not from the STL/OBJ surface.
Actually you can easily check this by removing all mentions to the motorbike in the motorbile tutorial and only add layers on some of the blockMesh patches.
You were right sir. It only needs a stl (it doesn't even matter if its related to the mesh or not) to run which is not even use in the addLayers part of snappyHexMesh.

Thanks to everyone.
stopherkri is offline   Reply With Quote

Old   November 18, 2025, 12:38
Default
  #11
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,358
Rep Power: 32
Yann will become famous soon enoughYann will become famous soon enough
Glad to know it works!

Feel free to post your snappyHexMeshDict here, because you should not have to provide any STL file.
(just remove what you may have left defined in the geometry {}, features{}, refinementSurfaces{} and refinementRegions {} sections)
Yann is offline   Reply With Quote

Old   November 20, 2025, 02:08
Default
  #12
Senior Member
 
M
Join Date: Dec 2017
Posts: 724
Rep Power: 13
AtoHM is on a distinguished road
... and blockMeshDict too (or a reduced version showing how it works in principle) for other users coming here with the same question.
AtoHM is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[blockMesh] blockMesh coordinate system pardoa OpenFOAM Meshing & Mesh Conversion 5 October 23, 2023 14:29
[OpenFOAM.org] blockMesh issue on openfoam6 startup - ubuntu 16.04 bjdarrer OpenFOAM Installation 7 August 25, 2020 20:15
blockMesh wmake error for OpenFOAM5 on ubuntu on windows rclement OpenFOAM Programming & Development 2 March 5, 2018 17:57
[Discretizer] Discretizer "Run blockmesh" issue cfdone OpenFOAM Community Contributions 1 March 10, 2012 11:49
Installation/Tutorial - libraries not found (blockMesh) bernarde OpenFOAM 3 June 19, 2009 13:36


All times are GMT -4. The time now is 00:42.