CFD中文网

    CFD中文网

    • 登录
    • 搜索
    • 最新

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

    OpenFOAM
    multiregion
    3
    10
    1397
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 李子橙
      李子橙 最后由 编辑

      最终需要的区域为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

      李子橙 1 条回复 最后回复 回复 引用
      • 李子橙
        李子橙 @李子橙 最后由 编辑

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

        1 条回复 最后回复 回复 引用
        • 李东岳
          李东岳 管理员 最后由 编辑

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

          CFD高性能服务器 http://dyfluid.com/servers.html
          2023年,线下CFD课,预热一下 http://dyfluid.com/class.html

          李子橙 2 条回复 最后回复 回复 引用
          • 李子橙
            李子橙 @李东岳 最后由 编辑

            @东岳 找到问题所在了,因为球体无特征边缘,所以将球体的特征边缘删除即可。
            这是我修改后的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;
            
            // ************************************************************************* //
            
            
            J 1 条回复 最后回复 回复 引用
            • 李子橙
              李子橙 @李东岳 最后由 编辑

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

              1 条回复 最后回复 回复 引用
              • 李东岳
                李东岳 管理员 最后由 编辑

                感谢分享 :146:

                CFD高性能服务器 http://dyfluid.com/servers.html
                2023年,线下CFD课,预热一下 http://dyfluid.com/class.html

                1 条回复 最后回复 回复 引用
                • J
                  jpzhao @李子橙 最后由 编辑

                  @李子橙 你好,我想请教一下snoppyHexMesh就可以分切多域网格吗?那么topoSet的功能也跟snappyHexMesh一样吗?

                  李子橙 1 条回复 最后回复 回复 引用
                  • 李子橙
                    李子橙 @jpzhao 最后由 编辑

                    @jpzhao 是的,但是交界面网格质量不是很好,建议使用 mergeMeshes,但是tposet好像无法做出光滑的曲面。

                    J 1 条回复 最后回复 回复 引用
                    • J
                      jpzhao @李子橙 最后由 编辑

                      @李子橙 所以你的意思是如果是多个域计算传热,就每个域单独画网格,然后再将这几个网格合并?

                      李子橙 1 条回复 最后回复 回复 引用
                      • 李子橙
                        李子橙 @jpzhao 最后由 编辑

                        @jpzhao 我没有试过cht用这样网格,应该是没有问题的。

                        1 条回复 最后回复 回复 引用
                        • First post
                          Last post