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

[snappyHexMesh] Problem with layer generation for CHT SHM mesh - coupled boundary issue?

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

Like Tree4Likes
  • 1 Post By Yann
  • 1 Post By Tobermory
  • 1 Post By Tobermory
  • 1 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 4, 2025, 07:58
Default Problem with layer generation for CHT SHM mesh - coupled boundary issue?
  #1
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 860
Rep Power: 19
Tobermory will become famous soon enough
I am going mad trying to generate a layered mesh at the interface between CHT solid/gas regions using the OF13 ... I have a simple rectangular block of metal surrounded by gas, with a basic hex mesh, (see pic 1, where the metal is the red block) and I just want to add layers at the interface to resolve the gradients in the gas and metal at the surface.

When I try run this in OF13, SHM tells me "No layers to generate ..." (it generates them fine if I only mesh the gas, or only mesh the metal, ie mesh as a single region). The same dictionary (attached) works fine in OF2506 - see picture 2. Note that it's not the naming of the layers (i.e. changing gas_to_metal to Ibeam has no effect - SHM still concludes that there are no layers to generate).

Following advice from earlier posts, I can wangjangle it by: meshing without layers; splitting the regions; meshing the layers in each region by moving the constant/{region}/polyMesh to constant/polyMesh, running SHM, and moving the resulting constant/polyMesh back to constant/{region}. So there's a work-around, but the basic point is that the Foundation version of SHM seems broken. EDIT: actually, thinking about this more, I am not certain that this is a guaranteed workaround ... does it preserve the correct face coupling between the gas and metal regions? I'll need to check
Indeed - it worked on a trivial test case, but failed on a more complex geometry.


Looking at the coding below from snappyLayerDriver.C, I am guessing that the Foundation version views the metal/gas interface as a coupled patch, and therefore assumes no layers are required ... whereas the COM version (which has the same coding below) does not make that assumption and correctly lines up the surface for layer generation. I don't understand why the two make different assumptions about the interface though ...

Code:
     label nFacesWithLayers = 0;
     forAll(numLayers, patchi)
     {
         if (numLayers[patchi] > 0)
         {
             const polyPatch& pp = mesh.boundaryMesh()[patchi];
  
             if (!pp.coupled())
             {
                 patchIDs.append(patchi);
                 nFacesWithLayers += mesh.boundaryMesh()[patchi].size();
             }
             else
             {
                 WarningInFunction
                     << "Ignoring layers on coupled patch " << pp.name()
                     << endl;
             }
         }
     }
     patchIDs.shrink();
  
     if (returnReduce(nFacesWithLayers, sumOp<label>()) == 0)
     {
         Info<< nl << "No layers to generate ..." << endl;
     }
     else
     {
Does anyone have any insights before I try logging as a bug?
Attached Images
File Type: jpg meshNoLayers.jpg (88.4 KB, 8 views)
File Type: jpg OF2506.jpg (83.1 KB, 9 views)
Attached Files
File Type: zip snappyHexMeshDict.zip (1.2 KB, 1 views)

Last edited by Tobermory; October 7, 2025 at 12:08.
Tobermory is offline   Reply With Quote

Old   October 6, 2025, 05:56
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,347
Rep Power: 32
Yann will become famous soon enoughYann will become famous soon enough
Hello Tobermory,

I don't really have experience with multiregion meshing in the foundation branch but for what it's worth I remember this commit dating back to OpenFOAM-7 and mentioning layers on coupled interfaces:
https://github.com/OpenFOAM/OpenFOAM...c2d75980212a63

No idea how it evolved in the latest version but I'm dropping it here just in case it could be of any help.
Yann is offline   Reply With Quote

Old   October 6, 2025, 06:59
Default
  #3
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 860
Rep Power: 19
Tobermory will become famous soon enough
Thanks Yann for the reply, but unfortunately that's not it. The output from the Foundation and COM versions is identical (in the layer addition phase) until it gets to the "Checking mesh manifoldness ..." part, at which point the COM version seems to convert the faceZoned faces on the CHT interface to temporary baffles and then continues to generate layers on either side of the baffles, before converting the baffles back to internal faces. The foundation version just says "Nah - there are no layers to add" and skips the layer addition.

I've tried changing the interface to a baffle, but that didn't work. Seems like the foundation version has broken the logic for CHT/internal faces?

I'll drop a bug report, but I usually get a pretty terse reply and so am not hopeful.
Tobermory is offline   Reply With Quote

Old   October 6, 2025, 10:05
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,347
Rep Power: 32
Yann will become famous soon enoughYann will become famous soon enough
Yeah, the .com mechanism is pretty handy for layer addition.

I'd be interested to know if you find a solution, it could be useful to know how to handle it in .org.
Tobermory likes this.
Yann is offline   Reply With Quote

Old   October 7, 2025, 12:07
Default
  #5
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 860
Rep Power: 19
Tobermory will become famous soon enough
I have given up for the moment and have just switched to the .com fork for this case ... I tried the following:

1. my suggested work-around above, i.e. mesh without layers, split the regions and then try add layers to each region individually; this worked on a simple test case, but failed in the real (more complex) case. Rats.

2. meshing with blockMesh and SHM in .com (v2506) and then passing that over to .org (v13) for splitting etc., and ofc the two forks are now so wide apart that they disagree on the file format of some of the mesh fundamentals, so that failed too.

I have logged a bug report, so let's see if that gets any attention, but in the meantime my suggestion is to use the .com fork for CHT, since otherwise you cannot add a layered mesh next to your surface (which is rather too restrictive). I'll update if there's any news.
Yann likes this.
Tobermory is offline   Reply With Quote

Old   October 14, 2025, 07:08
Default
  #6
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 860
Rep Power: 19
Tobermory will become famous soon enough
Okay - a quick update (thanks to Will at openfoam.org, who gave me a very helpful response to my bug report). The TLDR is that "Putting layers into a face-zone is not supported by Foundation snappyHexMesh" (Will's words) ... in other words you cannot create the SHM mesh including layers all in one step, in the foundation version (unless you want a non-conformal mesh at the interface, which I will assume you don't).

However, Will did give me the correct 3 step approach, which is as follows (see also the multiRegion/CHT/shellAndTubeHeatExchanger tutorial):
1. Run SHM without layer addition, marking the cell zones for the different regions, and the face zones between them. Set the faceZone types to internal.
2. Disconnect the mesh at the faceZones by converting the faceZones to baffles using createBaffles and then running splitBaffles. This generates pairs of mappedWall boundary patches at each faceZone.
3. Run SHM again, with just layer addition this time, to add the layers on the above patches on either side of the faceZone. Ensure you add "mergeFaces false" to the layer definition.

This seems to work very nicely on my test case.
Attached Images
File Type: jpg mesh.jpg (140.1 KB, 10 views)
Yann likes this.

Last edited by Tobermory; October 14, 2025 at 10:02.
Tobermory is offline   Reply With Quote

Old   October 14, 2025, 12:01
Default
  #7
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,347
Rep Power: 32
Yann will become famous soon enoughYann will become famous soon enough
Thanks for your feedback Tobermory!

The workflow is slightly more complex than in the .com branch but it's good to know there is a way to add layers on the whole mesh while preserving a conformal mesh at the interfaces!

Will's answer is great to know how to add layers on both conformal and non conformal interfaces.
If you don't mind I'll leave the link to your bug report here: https://bugs.openfoam.org/view.php?id=4278#c13683
Tobermory likes this.
Yann 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
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 06:38
SU2-7.0.1 on ubuntu 18.04 hyunko SU2 Installation 7 March 16, 2020 05:37
[snappyHexMesh] layer not added Rasmusiwersen OpenFOAM Meshing & Mesh Conversion 1 January 2, 2020 10:43
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
Low Mixing time Problem Mavier CFX 5 April 29, 2013 01:00


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