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

[snappyHexMesh] conformal multi-region meshing and feature capturing

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By jurich

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 9, 2020, 10:20
Default conformal multi-region meshing and feature capturing
  #1
New Member
 
Henning
Join Date: Sep 2020
Posts: 8
Rep Power: 5
dasbrot is on a distinguished road
Hi there,

I have a multi-region case which consists of three regions, two solid and one fluid part. In the first picture attached, the top solid part is green, the fluid part red and the bottom part is grey.

The meshing process itself works fine, I pre-processed the surface files with Salome where they match exactly. I created the background mesh with salome, too.

As you can see in pictures 2, the top solid part has a fin, which is cooled by the fluid. Now I have multiple problems regarding SHM:

1. especially around the fin I would like to get a conformal mesh between the solid and the fluid. Both surface triangulations match exactly (as I can see in Salome), both refinement levels match and the background mesh is the same, so what could be the reason for this? Moreover, if you take a closer look at the mesh the surface looks really strange (red circles in picture 3). I guess it is just a display error by paraview (those lines are the edges of the cells of the other region, picture 4) but still I would like to have a conformal mesh or at least nearly-conformal.

2. The cells are sometimes quite 'wobbly'. By that I mean SHM sometimes doesn't use a perfect hex cell even though it could and should (you can see that e.g. in the second picture)

3. Last but not least I would like to use an even coarser grid to test grid convergence etc. And this fin is only one of 100, so the total domain is much bigger. But if I use a coarser background mesh at some points the feature edges aren't snapped to at all. Any help would be appreciated (picture 5)

Thank you all!

snappyHexMeshDict (only part of it)
Code:
geometry
{
	fluid.stl
	{
		type	triSurfaceMesh;
		name	fluid;
	
		regions
		{
			inlet	{ name inlet; }
			outlet	{ name outlet; }
            transferWall	{ name transferWall; }
            finWall			{ name finWall; }
		}
	}
	topSolid.stl
	{
		type	triSurfaceMesh;
		name	topSolid;
	
		regions
		{
			ambientWall	{ name ambientWall; }
			solidWall	{ name solidWall; }
			fluidWall 	{ name fluidWall; }
            heatsourceWall	{ name heatsourceWall; }
            finWall { name finWall; }
		}
	}	
	bottomSolid.stl
	{
		type	triSurfaceMesh;
		name 	bottomSolid;
	
		regions
		{
			ambientWall	{ name ambientWall; }
			solidWall	{ name solidWall; }
			fluidWall 	{ name fluidWall; }
		}
	}	

};


// Settings for the castellatedMesh generation.
castellatedMeshControls
{

    maxLocalCells 1000000;
    maxGlobalCells 20000000;
    minRefinementCells 0;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 2;

    features
    (	
        {
			file "fluid.eMesh";
			level 1;
		}			
		{
			file "topSolid.eMesh";
			level 1;
		}
		{
			file "bottomSolid.eMesh";
			level 1;
		}					
    );


    // Surface based refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~
    refinementSurfaces
    {
        fluid
		{
			// default level (first entry is minimum, second is maximum refinement, 
			// depending on resolveFeatureAngle
			level (0 0);
			
			// define cell set to be able to split afterwards
			cellZone fluid;
			faceZone fluid;
            cellZoneInside inside;
            // cellZoneInside insidePoint;
            // insidePoint (0.001 0.004 0.006);
            
			regions
			{
				inlet	{ level (0 0); patchInfo { type patch; }}
				outlet	{ level (0 0); patchInfo { type patch; }}
                transferWall	{ level (0 0); patchInfo { type wall; }}
                finWall	{ level (3 3); patchInfo { type wall; }}
			}
			
		}
		topSolid
		{
			// default level (first entry is minimum, second is maximum refinement, 
			// depending on resolveFeatureAngle
			level (0 0);
										
			// define cell set to be able to split afterwards
			cellZone topSolid;
			faceZone topSolid;
            cellZoneInside inside;
            // cellZoneInside insidePoint;
            // insidePoint (0.001 0.001 -0.001);
			
			regions
			{
				ambientWall	{ level (0 0); patchInfo { type wall; }}
				solidWall	{ level (0 0); patchInfo { type wall; }}
				fluidWall	{ level (0 0); patchInfo { type wall; }}
                heatsourceWall	{ level (0 0); patchInfo { type wall; }}
                finWall { level (3 3); patchInfo { type wall; }}
			}	
		}
		bottomSolid
		{
			// default level (first entry is minimum, second is maximum refinement, 
			// depending on resolveFeatureAngle
			level (0 0);
			
			// define cell set to be able to split afterwards
			cellZone bottomSolid;
			faceZone bottomSolid;
            cellZoneInside inside;
            // cellZoneInside insidePoint;
            // insidePoint (0.001 0.001 0.01);
			
			regions
			{
				ambientWall	{ level (0 0); patchInfo { type wall; }}
				solidWall	{ level (0 0); patchInfo { type wall; }}
				fluidWall	{ level (0 0); patchInfo { type wall; }}
			}
		}
    }

    resolveFeatureAngle 30;
    planarAngle 180;


    // Region-wise refinement
    // ~~~~~~~~~~~~~~~~~~~~~~

    refinementRegions
    {
    }

    
    limitRegions
    {
    }

    // Mesh selection
    // ~~~~~~~~~~~~~~

    
        // Ad 1. Specify a single location and how to treat faces inbetween
        //       cellZones
        locationInMesh (0.005 0.006 0.005);
        allowFreeStandingZoneFaces true;
        
}

// Settings for the snapping.
snapControls
{
    // Number of patch smoothing iterations before finding correspondence
    // to surface
    nSmoothPatch 3;  // 5

    // Optional: number of smoothing iterations for internal points on
    // refinement interfaces. This will reduce non-orthogonality on
    // refinement interfaces.
    nSmoothInternal $nSmoothPatch;

    // Maximum relative distance for points to be attracted by surface.
    // True distance is this factor times local maximum edge length.
    tolerance 5;  // 1.0

    // Number of mesh displacement relaxation iterations.
    nSolveIter 10;  // 300

    // Maximum number of snapping relaxation iterations. Should stop
    // before upon reaching a correct mesh.
    nRelaxIter 5;  // 10

    // Feature snapping

        // Number of feature edge snapping iterations.
        // Leave out altogether to disable.
        nFeatureSnapIter 10;  //5 

        // Detect (geometric only) features by sampling the surface
        // (default=false).
        implicitFeatureSnap false;

        // Use castellatedMeshControls::features (default = true)
        explicitFeatureSnap true;

        // Detect features between multiple surfaces
        // (only for explicitFeatureSnap, default = false)
        multiRegionFeatureSnap false;


        // When to run face splitting (never at first iteration, always
        // at last iteration). Is interval. Default -1 (disabled)
        // Recommendation: set to half the number of feature snap iterations
        // used to better capture 90°-edges
		// https://www.openfoam.com/releases/openfoam-v3.0+/meshing.php
        nFaceSplitInterval 5;

}

// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    // Specify mesh quality constraints in separate dictionary so can
    // be reused (e.g. checkMesh -meshQuality)
    #include "meshQualityDict"

    // Optional : some meshing phases allow usage of relaxed rules.
    // See e.g. addLayersControls::nRelaxedIter.
    
	relaxed
    {
        // Maximum non-orthogonality allowed. Set to 180 to disable.
        maxNonOrtho 85;
    }
    // Advanced

        // Number of error distribution iterations
        nSmoothScale 4;
        // amount to scale back displacement at error points
        errorReduction 0.75;
}

// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-6;

// ************************************************************************* //
Attached Images
File Type: png 1.PNG (19.1 KB, 102 views)
File Type: png 2.PNG (112.6 KB, 106 views)
File Type: jpg 3.jpg (136.0 KB, 96 views)
File Type: png 4.PNG (54.6 KB, 116 views)
File Type: png 5.PNG (104.2 KB, 98 views)
dasbrot is offline   Reply With Quote

Old   December 9, 2020, 11:23
Default
  #2
New Member
 
Henning
Join Date: Sep 2020
Posts: 8
Rep Power: 5
dasbrot is on a distinguished road
Just to add another picture .. In white are the feature edges
Attached Images
File Type: jpg featureEdges.jpg (74.5 KB, 94 views)
dasbrot is offline   Reply With Quote

Old   December 18, 2020, 00:14
Default
  #3
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 6
Ship Designer is on a distinguished road
Hello Henning,

For the feature snapping problem, I suggest you try a tolerance set to 1. What you have circled in red in picture 3 could very well still be a hexahedron but with a point moved in such a way that two edges are collinear. That's what snappyHexMesh does, it moves points of cells to be on the snapping surface and changes cells into wedges, polyhedra etc. if needed.

I'm not quite sure what you need snappyHexMesh for, if the input geometry is already the way you want. If you just need to refine the fin (diamond shaped object?) and add the patches, you could do the same with refineMesh and createPatch but with less mesh distortion I believe. The way I see it, the geometry is so simple that it could be created with blockMesh alone, without need for snapping. With cell grading you could refine the mesh where needed or even add very precise boundary layers.

Cheers, Claudio
Ship Designer is offline   Reply With Quote

Old   December 18, 2020, 07:00
Default
  #4
New Member
 
Henning
Join Date: Sep 2020
Posts: 8
Rep Power: 5
dasbrot is on a distinguished road
Hey Claudio,

thank you for replying! In the meantime I played a little bit with snappyHexMesh parameter and I came with a mediocre solution, but better than before.

The most important parameter I changed were
- tolerance to 1.0 (as you also suggested, thanks!)
- raised nSolveIter back to 300
- set nSmoothPatch to 0 because there is nothing to smooth in this example
- raised featureSnapIterations to 20, though a larger number made things worse again

With these settings the geometry was captured okay, but the mesh looks a little strange in the corners (picture 1). That's what I don't understand about snappyHexMesh.. Why doesn't it leave the background mesh 'as is' where there either isn't anything to snap to or where it should just keep the straight line to capture things accurately?

With implicit feature edge capturing the mesh looks a lot worse (picture 2).

What helped was the parameter stringFeatures set to false. With that the mesh looks actually quite good, except for those "edges" at the diamond shape. It's really starting to get on my nerves.

The problem is, that the geometry is actually larger and more complex, especially at the in- and outlet. This was just a testcase to figure out the best settings and use them to mesh the overall geometry later. So blockMesh is not a suitable way. But since I set nSmoothPatch to zero, I don't know whether those shapes will be captured okay. With smoothing iterations set to 5 the feature edges aren't fully captured and mesh looks strange (picture 4, same settings as in picture 1 otherwise). Why?


By the way, I have to use snappyHexMesh
Attached Images
File Type: png 1.PNG (94.9 KB, 83 views)
File Type: png 2.PNG (95.5 KB, 67 views)
File Type: png 3.PNG (95.0 KB, 63 views)
File Type: png 4.PNG (101.8 KB, 62 views)
dasbrot is offline   Reply With Quote

Old   December 18, 2020, 14:37
Default
  #5
New Member
 
Joseph Urich
Join Date: Mar 2009
Location: Pittsburgh, PA
Posts: 21
Rep Power: 17
jurich is on a distinguished road
Hello Henning,

I had a similar issue once and, if I remember correctly, the solution was to set implicitFeatureSnap to true. That setting is used in the shellAndTubeHeatExchanger and pimpleFoam/propeller tutorials.

I hope that helps.
hogsonik likes this.
jurich 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
[snappyHexMesh] Multi Region Mesh of a car filter Zephiro88 OpenFOAM Meshing & Mesh Conversion 3 September 11, 2019 19:34
[snappyHexMesh] Error snappyhexmesh - Multiple outside loops avinashjagdale OpenFOAM Meshing & Mesh Conversion 53 March 8, 2019 09:42
[ANSYS Meshing] Symmetry feature in ANSYS Meshing RobBanks ANSYS Meshing & Geometry 0 February 22, 2017 11:03
[ICEM] Mirror meshing feature in ICEM 15.0 Crank-Shaft ANSYS Meshing & Geometry 2 January 5, 2015 14:36
[ANSYS Meshing] Trouble meshing revolved feature evoeng ANSYS Meshing & Geometry 1 August 27, 2012 03:54


All times are GMT -4. The time now is 17:56.