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

[snappyHexMesh] Bad mesh in small channel

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2023, 11:06
Default Bad mesh in small channel
  #1
Member
 
Vinzenz Götz
Join Date: Mar 2021
Location: Munich, Germany
Posts: 31
Rep Power: 5
Vinzmann is on a distinguished road
Hello everybody,

I have a small channel in my geometry which is a kind of nozzle. My problem is that my mesh in this channel always looks horrible.

I'd be very thankful if you could take a look at my snappyHexMeshDict and my meshQualityDict.

The small geometry is called duese and the inlet sits at the face of this channel.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  8                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     8;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       true;
keepPatches	yes;


geometry
{
   	rohr.stl
    	{
        	type triSurfaceMesh;
        	name rohr;
		inGroups (walls);
    	}

    	inlet.stl
    	{
        	type triSurfaceMesh;
        	name inlet;
    	}
	
    	cOut.stl
    	{
        	type triSurfaceMesh;
        	name cOutlet;
		inGroups (outlets);
    	}
	
	wOut.stl
    	{
        	type triSurfaceMesh;
        	name wOutlet;
    		inGroups (outlets);
	}
	
	drossel.stl
	{
        	type triSurfaceMesh;
		name drossel;
		inGroups (walls);
	}
	
	duese.stl
	{
		type triSurfaceMesh;
		name duese;
		inGroups (dueseGroup);
	}
	
	kammer.stl
    	{
        	type triSurfaceMesh;
        	name kammer;
		inGroups (walls);
    	}

	globalRefinement
	{
		type	searchableCylinder;
		point1	(0 0 0.1);
		point2	(0 0 0.2);
		radius	0.02;
	}

		
};




castellatedMeshControls
{


    maxLocalCells 10000000; 

    maxGlobalCells 200000000; 


    minRefinementCells 5; 

  


    nCellsBetweenLevels 5; 




    features
    (
        {
            	file "rohr.eMesh";
            	level 4; 
        }
		
	{
            	file "drossel.eMesh";
            	level 1; 
        }
		
	{
		file "duese.eMesh";
		level 3;
	}
		
        {
        	file "inlet.eMesh";
        	level 3; 
        }
		
	{
        	file "wOut.eMesh";
        	level 1; 
        }
		
        {
        	file "cOut.eMesh";
        	level 1; 
        }
		
	{
        	file "kammer.eMesh";
        	level 1; 
        }

    );





    refinementSurfaces
    {


	"(rohr)"
        {
            level (3 3); 
            patchInfo
            {
                type wall;
		inGroups (walls);
            }
        }
	
	"(kammer)"
        {
            	level (1 3); 
            	patchInfo
            {
                type wall;
		inGroups (walls);
            }
        }
		
	"(drossel)"
        {
            level (1 1); 
			gapLevelIncrement 2;
            patchInfo
            {
                type wall;
		inGroups (walls);
            }
        }
		
	"(duese)"
        {
            level (5 5); 
            patchInfo
            {
                type wall;
                inGroups (dueseGroup);
            }
        }

	"(inlet)"
        {
            level (5 5); 
            patchInfo
            {
                
		type mappedPatch;
        	offset          (0 0.1 0);
        	sampleRegion    region0;
        	sampleMode      nearestCell;
        	samplePatch     none;
            }
        }
		
	"(cOutlet)"
        {
            level (1 1); 
            patchInfo
            {
                type patch;
                inGroups (outlets);
            }
        }
		
	"(wOutlet)"
        {
            level (1 1); 
            patchInfo
            {
                type patch;
             	inGroups (outlets);
            }
        }
    }

    resolveFeatureAngle 30; 



    refinementRegions
    {

		globalRefinement
		{
			mode	inside;
			levels	((1e15 1));
			gapMode	mixed;
			gapLevel (4 0 4); 
		}
		
		rohr
		{
			mode distance;
			levels ((0.001 2));
		}
		
		inlet
		{
			mode distance;
			levels ((0.002 2));
		}
				
		kammer
		{
			mode distance;
			levels ((0.001 2));
		}
		
		drossel
		{
			mode distance;
			levels ((0.0004 4) (0.0008 3));
		}

    }


 
    locationInMesh (0.001 0.001 0.1);


 
    allowFreeStandingZoneFaces true;
	
	
	
}



snapControls
{
    nSmoothPatch 1; 

  
    nSmoothInternal 1; 

    tolerance 0.7; 

    nSolveIter 100; 

    nRelaxIter 8; 



        nFeatureSnapIter 80;

        implicitFeatureSnap false;

        explicitFeatureSnap true;

        multiRegionFeatureSnap false;
}



addLayersControls
{

    relativeSizes true; 
    	layers
    	{

		walls
		{
			nSurfaceLayers	7;
			
		}
		
		duese
		{
			nSurfaceLayers	10;
		}

		inlet
		{
			nSurfaceLayers	6;
			thickness	2;
			expansionRatio	1;
		}


	}

    expansionRatio 1.2;

    	//finalLayerThickness 2;
	thickness 2;

    minThickness 0.0001; 

 
    nGrow 0;


    featureAngle 230; 

    slipFeatureAngle 90; 

    nRelaxIter 1;

    nSmoothSurfaceNormals 2;

    nSmoothNormals 3; 

    nSmoothThickness 10; 

    maxFaceThicknessRatio 0.3;

    maxThicknessToMedialRatio 0.3;

    minMedialAxisAngle 90;

    nBufferCellsNoExtrude 0;

    nLayerIter 50; 

    nRelaxedIter 1;

	additionalReporting true;
}




meshQualityControls
{
    #include "meshQualityDict"
    relaxed
    {
        maxNonOrtho 35;
    }

	maxNonOrtho 35;
    nSmoothScale 8;
    errorReduction 1.5;
}



writeFlags
(
    scalarLevels
    layerSets
    layerFields     
);



mergeTolerance 1e-6;


// ************************************************************************* //
My meshQualityDict looks like this:

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

minFaceWeight 0.02;
maxBoundarySkewness     3;//20
maxInternalSkewness     2;//4
maxConcave              30;//40
minVol                  1e-13;
minTetQuality           1e-3;//1e-15
minArea                 -1;
minTwist                0.02;
minDeterminant          0.01;//0.001
minFaceWeight           0.05;//0.05
minFaceFlatness         -1;
minVolRatio             0.01;//0.01
minTriangleTwist        -1;
nSmoothScale            8;//8
errorReduction          1.5;//.75


// ************************************************************************* //

I've attached a picture of the mesh.

Best regards,
Vinz
Attached Images
File Type: jpg 2023-05-19 16_57_12-Clipboard.jpg (86.4 KB, 25 views)
Vinzmann is offline   Reply With Quote

Old   May 21, 2023, 03:45
Default
  #2
New Member
 
Elia Kazemi
Join Date: Sep 2022
Posts: 14
Rep Power: 3
Elia38 is on a distinguished road
Hi, i comment based on my experience. do you use surfaceFeatureExtract? if so, you have to check its result before doing snappyHexMesh. sometimes, your .stl file does not have enough points to capture all curves correctly.
if you don't use surfaceFeatueExtract, i recommend you to rise "level" of duese.eMesh in features section.
Elia38 is offline   Reply With Quote

Old   May 22, 2023, 01:29
Default
  #3
Member
 
Vinzenz Götz
Join Date: Mar 2021
Location: Munich, Germany
Posts: 31
Rep Power: 5
Vinzmann is on a distinguished road
Dear Elia,

thank you for your reply.

I will try your suggestion, thank you very much.

Best regards,
Vinz
Vinzmann is offline   Reply With Quote

Old   May 22, 2023, 01:40
Default
  #4
New Member
 
Elia Kazemi
Join Date: Sep 2022
Posts: 14
Rep Power: 3
Elia38 is on a distinguished road
Quote:
Originally Posted by Vinzmann View Post
Dear Elia,

thank you for your reply.

I will try your suggestion, thank you very much.

Best regards,
Vinz
You're welcome Vinz
Elia38 is offline   Reply With Quote

Old   May 22, 2023, 01:55
Default
  #5
Member
 
Vinzenz Götz
Join Date: Mar 2021
Location: Munich, Germany
Posts: 31
Rep Power: 5
Vinzmann is on a distinguished road
Hi Elia,

the edges do indeed look better, thank you very much for that.

Still some cells in the sharp corners are bad still.

Best regards,
Vinz
Vinzmann is offline   Reply With Quote

Old   May 22, 2023, 05:21
Default
  #6
New Member
 
Elia Kazemi
Join Date: Sep 2022
Posts: 14
Rep Power: 3
Elia38 is on a distinguished road
Hi Vinz,
try 180 degrees in resolveFeatureAngle in castellatedMeshControls section.
Elia38 is offline   Reply With Quote

Old   May 22, 2023, 07:06
Default
  #7
Member
 
Vinzenz Götz
Join Date: Mar 2021
Location: Munich, Germany
Posts: 31
Rep Power: 5
Vinzmann is on a distinguished road
Hello Elia,

this made the edges look worse sadly.

I am currently trying to tweak the resolveFeatureAngle to a point where the edges are sharp but the angle is not too high.

Attached you will find a picture.

Thank you again for your help.

Best regards,
Vinz
Attached Images
File Type: png badEdges.png (114.1 KB, 12 views)
Vinzmann is offline   Reply With Quote

Old   May 22, 2023, 07:36
Default
  #8
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
Can you run without the layer generation step and show how that part looks? I assume this happens when introducing the layers, it can happen with high featureAngles.
In the ESI OpenFOAM distribution you can use
Code:
mergePatchFacesAngle 45;
to improve, please check yourself if this is available in the foundation version you seem to be working with (judging from your file header).


Furthermore, it might help to run with default mesh quality settings, not sure if you changed things there.
AtoHM is offline   Reply With Quote

Old   May 22, 2023, 09:58
Default
  #9
New Member
 
Elia Kazemi
Join Date: Sep 2022
Posts: 14
Rep Power: 3
Elia38 is on a distinguished road
Quote:
Originally Posted by Vinzmann View Post
Hello Elia,

this made the edges look worse sadly.

I am currently trying to tweak the resolveFeatureAngle to a point where the edges are sharp but the angle is not too high.

Attached you will find a picture.

Thank you again for your help.

Best regards,
Vinz
Hi Vinz,
Ok, reduce the resolveFeatureAngle to about 15 degrees. And use explicitFeatureSnap. So turn this feature on and turn off the implicitFeatureSnap. And increase the nFeatureSnapIter and nSolverIter.
Hope this help.
Elia
Elia38 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
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 05:38
[ICEM] Bad Quality **Anny** ANSYS Meshing & Geometry 7 May 28, 2015 05:03
[ICEM] Unstructured Mesh / cyclic channel Metternich ANSYS Meshing & Geometry 0 October 9, 2014 10:38
Mesh motion with Translation & Rotation Doginal CFX 2 January 12, 2014 06:21
[ICEM] Generating Mesh for STL Car in Windtunnel Simulation tommymoose ANSYS Meshing & Geometry 48 April 15, 2013 04:24


All times are GMT -4. The time now is 08:55.