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

[snappyHexMesh] Interface issue multiregion snappyhexmesh

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2022, 14:52
Default Interface issue multiregion snappyhexmesh
  #1
New Member
 
Aditya
Join Date: Jun 2021
Posts: 2
Rep Power: 0
Adibantwal is on a distinguished road
Hello! I have been trying to run a multiregion mesh using snappyHexMesh. I am able to get a reasonable mesh with two separated regions - AIR and SOLID.

The problem is, at my AIR inlets, some cells from the AIR inlets and surrounding SOLID gets mixed up, and the quality is bad. Please suggest some methods to avoid this.

I am attaching my snappyHexMeshDict file. I will provide the full case setup on request, since the file size is too large.

Thanks in advance.

PS. I am using OpenFOAM v2012

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

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

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


// Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{
    air.stl
    {
        type triSurfaceMesh;
        name air;
    }
 /*    airwall.stl
    {
        type triSurfaceMesh;
        name airwall;
    } */

    inlet.stl
    {
        type triSurfaceMesh;
        name inlet;
    }
    outlet.stl
    {
        type triSurfaceMesh;
        name outlet;
    }
    solid.stl
    {
        type triSurfaceMesh;
        name solid;
    }
    solid_in.stl
    {
        type triSurfaceMesh;
        name solid_in;
    }
    solid_out.stl
    {
        type triSurfaceMesh;
        name solid_out;
    }
    solid_outside.stl
    {
        type triSurfaceMesh;
        name solid_outside;
    }

/* 	box
	{
		type searchableBox;
		min (-0.302491 0.705 -0.125);
		max (-0.052491 0.955 0.125 );

	} */

	
}


// Settings for the castellatedMesh generation.
castellatedMeshControls
{

    // Refinement parameters
    // ~~~~~~~~~~~~~~~~~~~~~

    // If local number of cells is >= maxLocalCells on any processor
    // switches from from refinement followed by balancing
    // (current method) to (weighted) balancing before refinement.
    maxLocalCells 4000000;

    // Overall cell limit (approximately). Refinement will stop immediately
    // upon reaching this number so a refinement level might not complete.
    // Note that this is the number of cells before removing the part which
    // is not 'visible' from the keepPoint. The final number of cells might
    // actually be a lot less.
    maxGlobalCells 8000000;

    // The surface refinement loop might spend lots of iterations
    // refining just a few cells. This setting will cause refinement
    // to stop if <= minimumRefine are selected for refinement. Note:
    // it will at least do one iteration (unless the number of cells
    // to refine is 0)
    minRefinementCells 10;

    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 2;



    // Explicit feature edge refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    // Specifies a level for any cell intersected by its edges.
    // This is a featureEdgeMesh, read from constant/triSurface for now.
    features
    (
        {
            file "air.extendedFeatureEdgeMesh";    //"geom.eMesh";
            level 1;
        }
/*         {
            file "airwall.extendedFeatureEdgeMesh";    //"geom.eMesh";
            level 1;
        } */

        {
            file "inlet.extendedFeatureEdgeMesh";    //"geom.eMesh";
            level 1;
        }
        {
            file "outlet.extendedFeatureEdgeMesh";    //"geom.eMesh";
            level 1;
        }
        {
            file "solid.extendedFeatureEdgeMesh";    //"geom.eMesh";
            level 1;
        }
        {
            file "solid_in.extendedFeatureEdgeMesh";    //"geom.eMesh";
            level 1;
        }
        {
            file "solid_out.extendedFeatureEdgeMesh";    //"geom.eMesh";
            level 1;
        }
        {
            file "solid_outside.extendedFeatureEdgeMesh";    //"geom.eMesh";
            level 1;
        }
		
    );



    // Surface based refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~

    // Specifies two levels for every surface. The first is the minimum level,
    // every cell intersecting a surface gets refined up to the minimum level.
    // The second level is the maximum level. Cells that 'see' multiple
    // intersections where the intersections make an
    // angle > resolveFeatureAngle get refined up to the maximum level.

    refinementSurfaces
    {
        air
        {
            // Surface-wise min and max refinement level
            level (4 4);
			cellZone air;
            faceZone air;
            
            cellZoneInside inside;
			//insidePoint ( 0.2 0.5 0.5);
        }
		inlet
		{
			level (4 4);
			patchInfo
			{
				type patch;
			}
		}
		outlet
		{
			level (4 4);
			patchInfo
			{
				type patch;
			}
		}
/* 		airwall
		{
			level (2 2);
			patchInfo
			{
				type wall;
			}
		} */
       solid
        {
            // Surface-wise min and max refinement level
            level (4 4);
			 cellZone solid;
            faceZone solid;
           
            cellZoneInside inside;
			//insidePoint ( 0.135 0.5 0);
			//zoneInside true;
        }
		solid_in
		{
			level (4 4);
			patchInfo
			{
				type patch;
			}
		}
		solid_out
		{
			level (4 4);
			patchInfo
			{
				type patch;
			}
		}
		solid_outside
		{
			level (4 4);
			patchInfo
			{
				type patch;
			}
		}
/* 		sphere
		{
			level (4 4);
		//	faceZone face_inner;
		//	cellZone cell_inner;
			//cellZoneInside inside;
			//faceType internal;
		} */

		
    }

    // Resolve sharp angles
    resolveFeatureAngle 0.001; //


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

    // Specifies refinement level for cells in relation to a surface. One of
    // three modes
    // - distance. 'levels' specifies per distance to the surface the
    //   wanted refinement level. The distances need to be specified in
    //   descending order.
    // - inside. 'levels' is only one entry and only the level is used. All
    //   cells inside the surface get refined up to the level. The surface
    //   needs to be closed for this to be possible.
    // - outside. Same but cells outside.

    refinementRegions
    {
         air
        {
            mode inside;
            levels ((0.5 3));
        } 
		solid
		{
	    mode inside;
            levels ((0.5 3));
    	}
	}


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

    // After refinement patches get added for all refinementSurfaces and
    // all cells intersecting the surfaces get put into these patches. The
    // section reachable from the locationInMesh is kept.
    // NOTE: This point should never be on a face, always inside a cell, even
 locationInMesh ( 0.2 0.5 0);
 // after refinement.
/*     locationsInMesh 
    (
        (( 0.2 0.5 0))
/* 		(( 0.2 0.5 0.5) air)
		(( 0.2 0.5 -0.5) air)
		(( -0.165 0.7 0) solid)
		(( 0.135 0.5 0) solid)
		(( 0.22 0.012 0.35) solid) */
		
 //   ); */


    // Whether any faceZones (as specified in the refinementSurfaces)
    // are only on the boundary of corresponding cellZones or also allow
    // free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces false;
}



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

    //- Relative distance for points to be attracted by surface feature point
    //  or edge. True distance is this factor times local
    //  maximum edge length.
    tolerance 2.0;

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

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

    //- Highly experimental and wip: number of feature edge snapping
    //  iterations. Leave out altogether to disable.
    //  Of limited use in this case since faceZone faces not handled.
    nFeatureSnapIter 20;
	
	multiRegionFeatureSnap true;
}



// Settings for the layer addition.
addLayersControls
{
    relativeSizes false;
   
    
    
    layers
    {
		air_to_solid
         	{nSurfaceLayers 6;} // was 3

    }

    expansionRatio 1.2;
    //finalLayerThickness 0.0165; //was 0.00016
	firstLayerThickness 0.00025;
    minThickness 0.0001; //was 0.00008

    // If points get not extruded do nGrow layers of connected faces that are
    // also not grown. This helps convergence of the layer addition process
    // close to features.
    // Note: changed(corrected) w.r.t 1.7.x! (didn't do anything in 1.7.x)
    nGrow 0;

    // Advanced settings

    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 130;

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

    // Number of smoothing iterations of surface normals
    nSmoothSurfaceNormals 1;

    // Number of smoothing iterations of interior mesh movement direction
    nSmoothNormals 3;

    // Smooth layer thickness over surface patches
    nSmoothThickness 10;

    // Stop layer growth on highly warped cells
    maxFaceThicknessRatio 0.5;

    // Reduce layer growth where ratio thickness to medial
    // distance is large
    maxThicknessToMedialRatio 0.3;

    // Angle used to pick up medial axis points
    // Note: changed(corrected) w.r.t 1.7.x! 90 degrees corresponds to 130
    // in 1.7.x.
    minMedialAxisAngle 90;

    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;

    // Overall max number of layer addition iterations. The mesher will exit
    // if it reaches this number of iterations; possibly with an illegal
    // mesh.
    nLayerIter 50;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    #include "meshQualityDict"

    // Advanced

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


// Advanced

// 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 Screenshot 2022-03-22 000337.png (132.7 KB, 11 views)
Adibantwal is offline   Reply With Quote

Reply

Tags
openfoam 2012, snappyhexmesh

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
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 08:30
Question about adaptive timestepping Guille1811 CFX 25 November 12, 2017 18:38
snappyHexMesh axisymmetric multiRegion Henning86 OpenFOAM Running, Solving & CFD 0 October 23, 2014 13:05
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 16:55


All times are GMT -4. The time now is 06:58.