CFD中文网

    CFD中文网

    • 登录
    • 搜索
    • 最新

    关于snappyHexMesh网格无法很好snap贴合的咨询

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

      各位大神,我目前使用snappyHexMesh划分一个流场网格,网格内的三角形是外部导入的stl文件。
      QQ截图20191121111621.jpg
      blochMeshDict字典为

      scale   1.0;
      
      vertices
      (
          (-500 -400 -200)
          (1500 -400 -200)
          (-500 1000 -200)
          (1500 1000 -200)
          (-500 -400 400)
          (1500 -400 400)
          (-500 1000 400)
          (1500 1000 400)
      );
      
      blocks
      (
          hex (0 1 3 2 4 5 7 6) (100 70 30) simpleGrading (1 1 1)
      );
      
      edges
      (
      );
      
      boundary
      (
          left
          {
              type patch;
              faces
              (
                  (0 4 6 2)
              );
          }
          right
          {
              type patch;
              faces
              (
                  (5 1 3 7)
              );
          }
          frontAndBack
          {
              type empty;
              faces
              (
                  (0 2 3 1)
                  (4 5 7 6)
              );
          }
      );
      
      mergePatchPairs
      (
      );
      
      // ************************************************************************* //
      

      surfaceFeatureExtractDict文件为

      wedge.stl
      {
          // How to obtain raw features (extractFromFile || extractFromSurface)
          extractionMethod    extractFromSurface;
      
          // Mark edges whose adjacent surface normals are at an angle less
          // than includedAngle as features
          // - 0  : selects no edges
          // - 180: selects all edges
          includedAngle       150;
      
          // Write options
      
          // Write features to obj format for postprocessing
          writeObj            yes;
      }
      

      snappyHexMeshDict文件为

      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
      {
          wedge.stl
          {
              type triSurfaceMesh;
              name wedge;
          }
      
          //- 
          box
          {
              type    searchableBox;
              min  (-200 -200 -100);
              max  (1200 800 200);
          }
      }
      
      
      // 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 100000;
      
          // 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 2000000;
      
          // 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 0;
      
          // Number of buffer layers between different levels.
          // 1 means normal 2:1 refinement restriction, larger means slower
          // refinement.
          nCellsBetweenLevels 1;
      
      
      
          // 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 "wedge.extendedFeatureEdgeMesh";
                  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
          {
              wedge
              {
                  // Surface-wise min and max refinement level
                  level (2 3);
              }
          }
      
          resolveFeatureAngle 30;
      
      
          // 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
          {
              box
              {
                  mode inside;
                  levels ((1E15 1));
              }
          }
      
      
          // 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
          // after refinement.
          // This is an outside point locationInMesh (-0.033 -0.033 0.0033);
          locationInMesh (-48 -38 -18); // Inside point
      
          // 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 true;
      }
      
      
      
      // 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 40;
      
          //- Number of mesh displacement relaxation iterations.
          nSolveIter 300;
      
          //- Maximum number of snapping relaxation iterations. Should stop
          //  before upon reaching a correct mesh.
          nRelaxIter 5;
      
          // Feature snapping
      
              //- Number of feature edge snapping iterations.
              //  Leave out altogether to disable.
              nFeatureSnapIter 30;
      
              //- Detect (geometric) features by sampling the surface
              implicitFeatureSnap false;
      
              //- Use castellatedMeshControls::features
              explicitFeatureSnap true;
      
              //- Detect features between multiple surfaces
              //  (only for explicitFeatureSnap, default = false)
              multiRegionFeatureSnap true;
      }
      
      
      
      // Settings for the layer addition.
      addLayersControls
      {
          // Are the thickness parameters below relative to the undistorted
          // size of the refined cell outside layer (true) or absolute sizes (false).
          relativeSizes true;
      
          // Per final patch (so not geometry!) the layer information
          layers
          {
              "wedge_.*"
              {
                  nSurfaceLayers 1;
              }
          }
      
          // Expansion factor for layer mesh
          expansionRatio 1.0;
      
          // Minimum thickness of cell layer. If for any reason layer
          // cannot be above minThickness do not add layer.
          // See relativeSizes parameter.
          minThickness 0.25;
      }
      
      
      
      // Generic mesh quality settings. At any undoable phase these determine
      // where to undo.
      meshQualityControls
      {
          #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;
          }
      
          // Advanced
      
          //- Number of error distribution iterations
          nSmoothScale 4;
          //- Amount to scale back displacement at error points
          errorReduction 0.75;
      }
      
      
      // Advanced
      
      // 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;
      
      
      // ************************************************************************* //
      

      但是在三角形固体边界处网格畸变很大,贴合总是不好,感觉就是没有贴合
      5.jpg

      7.jpg

      调试了很多次都是这样,搞不懂是什么原因,希望各位老师指点。感谢!

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

        我看你画的是二维的blockMesh,改成三维的就好了,snappyHexMesh做二维网格不能用你用的这种方法,会出现你这个问题。需要做成三维的,再投影成2伟的

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

        DY大世界 1 条回复 最后回复 回复 引用
        • DY大世界
          DY大世界 @李东岳 最后由 编辑

          @东岳 感谢李老师解答,我再试试

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