snappyHexMesh定义了多域网格(MultiRegion)失败。



  • 最终需要的区域为fluid和solid两个网格域
    d42f73b8-fcdb-410f-b53e-9c9305323752-image.png
    fluid.stl网格
    82f8d92d-2a47-491a-96b4-719f55a35fa1-image.png
    solid.stl网格
    e435eec1-a16f-4f69-bf6c-1f462c17280e-image.png
    snappyHexMesh文件

    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        object      snappyHexMeshDict;
    }
    castellatedMesh on;
    snap            on;
    addLayers       off;
    geometry
    {
        fluid.stl
        {
            type triSurfaceMesh;
    		name fluid;
        }
    
    	solid.stl
    	{
    	    type triSurfaceMesh;
    		name solid;
    	}
    	inlet.stl
    	{
    	    type triSurfaceMesh;
    		name inlet;
    	}
    	outlet.stl
    	{
    	    type triSurfaceMesh;
    		name outlet;
    	}
    };
    castellatedMeshControls
    {
        maxLocalCells 1000000;
        maxGlobalCells 20000000;
        minRefinementCells 0;
        maxLoadUnbalance 0;
        nCellsBetweenLevels 1;
        features
        (
            {
                file "fluid.eMesh";
                level 2;
            }
    		{
                file "solid.eMesh";
                level 3;
            }
    	    {
                file "inlet.eMesh";
                level 2;
            }
    	    {
                file "outlet.eMesh";
                level 2;
            }
        );
        refinementSurfaces
        {
            fluid
            {
                level (1 2);
    			faceZone fluid;
                cellZone fluid;
                cellZoneInside inside;
    			insidePoint (30 25 0);
            }
    		solid
    		{
    			level (2 3);
    		    faceZone solid;
                cellZone solid;
                cellZoneInside inside;
    			insidePoint (120 25 0);
    		}
    		 inlet
    		{
    
    			level (1 2);
    			patchInfo
    				{
    					type patch;
    				}
    		}
    		outlet
    		{
    			level (1 2);
    				patchInfo
    				{
    					type patch;
    				}
    		}
        }
        resolveFeatureAngle 30;
        refinementRegions
        {
        }
        locationInMesh (0 0 0);
        allowFreeStandingZoneFaces true;
    }
    snapControls
    {
        nSmoothPatch 5;
        tolerance 1.0;
        nSolveIter 300;
        nRelaxIter 10;
        nFeatureSnapIter 5;
        explicitFeatureSnap false;
        multiRegionFeatureSnap false;
        implicitFeatureSnap true;
    }
    addLayersControls
    {
        relativeSizes true;
        layers
        {
            "STL"
            {
                nSurfaceLayers 1;
            }
        }
        expansionRatio 1.0;
        finalLayerThickness 0.3;
        minThickness 0.1;
        nGrow 0;
        featureAngle 30;
        slipFeatureAngle 30;
        nRelaxedIter 3;
        nRelaxIter 3;
        nSmoothSurfaceNormals 1;
        nSmoothNormals 3;
        nSmoothThickness 10;
        maxFaceThicknessRatio 0.5;
        maxThicknessToMedialRatio 0.3;
        minMedialAxisAngle 90;
        nMedialAxisIter 10;
        nBufferCellsNoExtrude 0;
        nLayerIter 50;
        additionalReporting false;
    }
    meshQualityControls
    {
        maxNonOrtho 65;
        maxBoundarySkewness 20;
        maxInternalSkewness 4;
        maxConcave 80;
        minVol 1e-13;
        minTetQuality 1e-30;
        minArea -1;
        minTwist 0.02;
        minDeterminant 0.001;
        minFaceWeight 0.02;
        minVolRatio 0.01;
        minTriangleTwist -1;
        nSmoothScale 4;
        errorReduction 0.75;
        relaxed
        {
            maxNonOrtho 75;
        }
    }
    debug 0;
    mergeTolerance 1e-6;
    
    

    triSurface目录下的文件
    bb8c9d5e-f8e9-4ff7-96a6-089840a05248-image.png
    cellZones文件下并未看到单元定义到solid里面
    1e28bff7-ac74-497f-a792-46143d2b2190-image.png
    文件百度链接
    链接:https://pan.baidu.com/s/1e86s9shDgtXgaSHis_OYSQ
    提取码:oyov



  • 另外,执行完splitMeshRegions -cellZones后,还会生成一个不知怎么切出来的的网格区域(蓝色部分),我很疑惑:135:
    {F5F38563-31BA-415D-A317-4CD70A421538}_20200622144954.jpg



  • 你这个不是正好分为了固体域和流体域了么



  • @东岳 找到问题所在了,因为球体无特征边缘,所以将球体的特征边缘删除即可。
    这是我修改后的SnappyHexMeshDict文件

    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  6                                     |
    |   \\  /    A nd           | Web:      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;
    
    // Optional
    singleRegionName false;
    
    // Geometry. Definition of all surfaces. 
    geometry
    {
    	
        solid.stl
        {
            type triSurfaceMesh;
            
            regions
            {
                solid {name solid_to_fluid;}
            }
            
        }
        
        fluid.stl
        {
            type triSurfaceMesh;
    
            
            regions
            {
                inlet {name inlet;}
                outlet {name outlet;}
                top {name top;}
                bottom {name bottom;}
                front {name front;}
                back {name back;}
            } 
        }
    };
    
    // Settings for the castellatedMesh generation.
    castellatedMeshControls
    {
    
        // Refinement parameters
        // ~~~~~~~~~~~~~~~~~~~~~
        maxLocalCells 10000000;
        maxGlobalCells 20000000;
        minRefinementCells 0;
        maxLoadUnbalance 0;
        nCellsBetweenLevels 1;
    
        // Explicit feature edge refinement
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        features
        (
            {
                file "fluid.eMesh";
                level 1;
            }
        );
    
        // Surface based refinement
        // ~~~~~~~~~~~~~~~~~~~~~~~~ 
    	refinementSurfaces
        {
            solid.stl
            {
                // Surface-wise min and max refinement level
                level (0 0);
    
                regions
                {
                    solid {level (3 3);}
                }
                faceZone solid;
                cellZone solid;
                cellZoneInside inside;
            }
           
            fluid.stl
            {
                // Surface-wise min and max refinement level
                level (0 0);
    
                regions
                {
                    inlet {level (0 0);}
                    outlet {level (0 0);}
                    top {level (0 0);}
                    bottom {level (0 0);}
                    front {level (0 0);}
                    back {level (0 0);}
                }
                faceZone fluid;
                cellZone fluid;
                cellZoneInside inside;
            }
      
        }
    
        // Feature angle:
        resolveFeatureAngle 20;	
        
        // Region-wise refinement
        // ~~~~~~~~~~~~~~~~~~~~~~
    
        refinementRegions
        {
            solid.stl
            {
               mode inside;
               levels ((0 3));
            }
            fluid.stl
            {
               mode inside;
               levels ((0 1));
            }    
        }
    
        // Mesh selection
        // ~~~~~~~~~~~~~~
        locationInMesh (31.76 17.64 31.56);
    
        // free-standing zone faces. Not used if there are no faceZones.
        allowFreeStandingZoneFaces true;
    }
    
    snapControls
    {
        nSmoothPatch 3;
        tolerance 3;
        nSolveIter 30;
        nRelaxIter 10;
        nFeatureSnapIter 10;
    }
    
    // Settings for the layer addition.
    addLayersControls
    {
        
        relativeSizes true;
    
        expansionRatio 1.2;
    
           
        finalLayerThickness 0.5;  
        minThickness 0.1;
    
        // Per final patch (so not geometry!) the layer information
        // Note: This behaviour changed after 21x. Any non-mentioned patches
        //       now slide unless:
        //          - nSurfaceLayers is explicitly mentioned to be 0.
        //          - angle to nearest surface < slipFeatureAngle (see below)
        layers
        {
    		
        }
    
        // 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 17x! (didn't do anything in 17x)
        nGrow 0;
    
    
            featureAngle 130;		//default
            //featureAngle 180;
            //featureAngle 270;
    
            // Stop layer growth on highly warped cells
            maxFaceThicknessRatio 0.5;
    
    
            nSmoothSurfaceNormals 1;
    
            // Smooth layer thickness over surface patches
            nSmoothThickness 10;
    
        // Medial axis analysis
    
            // Angle used to pick up medial axis points
            // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130
            // in 17x.
            minMedialAxisAngle 90;
            minMedianAxisAngle 90;
    
            // Reduce layer growth where ratio thickness to medial
            // distance is large
            maxThicknessToMedialRatio 0.3;
    
            // Number of smoothing iterations of interior mesh movement direction
            nSmoothNormals 3;
    
            // Optional: limit the number of steps walking away from the surface.
            // Default is unlimited.
            //nMedialAxisIter 10;
    
            // Optional: smooth displacement after medial axis determination.
            // default is 0.
            //nSmoothDisplacement 90;
    
            // (wip)Optional: do not extrude a point if none of the surrounding points is
            // not extruded. Default is false.
            //detectExtrusionIsland true;
    
        // Mesh shrinking
    
            // Optional: at non-patched sides allow mesh to slip if extrusion
            // direction makes angle larger than slipFeatureAngle. Default is
            // 0.5*featureAngle.
            slipFeatureAngle 30;
    
            // Maximum number of snapping relaxation iterations. Should stop
            // before upon reaching a correct mesh.
            nRelaxIter 5;
    
            // 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;
    
            // Max number of iterations after which relaxed meshQuality controls
            // get used. Up to nRelaxedIter it uses the settings in
            // meshQualityControls,
            // after nRelaxedIter it uses the values in
            // meshQualityControls::relaxed.
            nRelaxedIter 20;
    
            // Additional reporting: if there are just a few faces where there
            // are mesh errors (after adding the layers) print their face centres.
            // This helps in tracking down problematic mesh areas.
            additionalReporting true;
    }
    
    // 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 75;
        }
    
        //minFlatness 0.5;
    
        // Advanced
    
            // Number of error distribution iterations
            nSmoothScale 4;
            // amount to scale back displacement at error points
            errorReduction 0.75;
    }
    
    // Advanced
    
    //debug 0;
    //debug 3;
    
    //// Debug flags
    /*
    debugFlags
    (
        mesh            // write intermediate meshes
        intersections   // write current mesh intersections as .obj files
        featureSeeds    // write information about explicit feature edge
                        // refinement
        attraction      // write attraction as .obj files
        layerInfo       // write information about layers
    );
    */
    
    //
    //// Write flags
    
    writeFlags
    (
        scalarLevels    // write volScalarField with cellLevel for postprocessing
        layerSets       // write cellSets, faceSets of faces in layer
        layerFields     // write volScalarField for layer coverage
    );
    
    // Merge tolerance. Is fraction of overall bounding box of initial mesh.
    // Note: the write tolerance needs to be higher than this.
    mergeTolerance 1e-6;
    
    // ************************************************************************* //
    
    


  • @东岳 此外,谢谢东岳老师的回复。



  • 感谢分享 :146:


Log in to reply
 

CFD中文网 2016 - 2020 | 京ICP备15017992号-2