Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. 相同snappyHexMeshDict和地形stl条件下,blockMeshDict增大导致网格划分失败

相同snappyHexMeshDict和地形stl条件下,blockMeshDict增大导致网格划分失败

已定时 已固定 已锁定 已移动 OpenFOAM
8 帖子 2 发布者 4.9k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • W 离线
    W 离线
    wsy11
    写于 最后由 编辑
    #1

    如题,我使用相同snappyhexmesh文件来对blocckmesh网格和地形stl文件进行划分,当范围选择为2000m*2000m*630m时(case1),可以进行正常的网格划分和运算; 当范围增大到3000m*3000m*630m时(case2),无法进行正常运算,case2会发散。
    (具体算例文件:wcase.zip ,stl文件文件过大无法上传)
    (只修改了xmin,xmax,ymin,ymax,并且网格大小也一致,而且两个case划分好网格以后checkMesh都没问题)。

    运行结果如下:
    case1正常运行
    case2发散:

    Time = 178s
    
    smoothSolver:  Solving for Ux, Initial residual = 0.446597, Final residual = 0.0256856, No Iterations 3
    smoothSolver:  Solving for Uy, Initial residual = 0.422256, Final residual = 0.0231428, No Iterations 3
    smoothSolver:  Solving for Uz, Initial residual = 0.497265, Final residual = 0.0275248, No Iterations 3
    GAMG:  Solving for p, Initial residual = 0.0065485, Final residual = 0.000418695, No Iterations 4
    time step continuity errors : sum local = 1.68504e+18, global = 1.42803e+16, cumulative = 9.69486e+16
    ExecutionTime = 15.72 s  ClockTime = 18 s
    
    Time = 179s
    
    [38] #0  Foam::error::printStack(Foam::Ostream&) at ??:?
    [38] #1  Foam::sigFpe::sigHandler(int) at ??:?
    [38] #2  ? in "/lib64/libc.so.6"
    [38] #3  Foam::pow3(Foam::Field<double>&, Foam::UList<double> const&) at ??:?
    [38] #4  void Foam::pow3<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
    [38] #5  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::pow3<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
    [38] #6  Foam::LESModels::WALE<Foam::incompressibleMomentumTransportModel>::k(Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> const&) const at ??:?
    [38] #7  Foam::LESModels::WALE<Foam::incompressibleMomentumTransportModel>::correctNut() at ??:?
    [38] #8  ? at ??:?
    [38] #9  __libc_start_main in "/lib64/libc.so.6"
    [38] #10  ? at ??:?
    [m3cn2707:519656:0:519656] Caught signal 8 (Floating point exception: tkill(2) or tgkill(2))
    ==== backtrace ====
        0  /usr/lib64/libucs.so.0(+0x17970) [0x2b9da57c4970]
        1  /usr/lib64/libucs.so.0(+0x17c23) [0x2b9da57c4c23]
        2  /lib64/libc.so.6(gsignal+0x37) [0x2b9c34fa7387]
        3  /public1/home/sch10341/soft/openfoam10/OpenFOAM-10/platforms/linux64IcxDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam4pow3ERNS_5FieldIdEERKNS_5UListIdEE+0xae) [0x2b9c340b32ee]
        4  /public1/home/sch10341/soft/openfoam10/OpenFOAM-10/platforms/linux64IcxDPInt32Opt/lib/libincompressibleMomentumTransportModels.so(_ZN4Foam4pow3INS_12fvPatchFieldENS_7volMeshEEEvRNS_14GeometricFieldIdT_T0_EERKS6_+0x31) [0x2b9c30c1c421]
        5  /public1/home/sch10341/soft/openfoam10/OpenFOAM-10/platforms/linux64IcxDPInt32Opt/lib/libincompressibleMomentumTransportModels.so(_ZN4Foam4pow3INS_12fvPatchFieldENS_7volMeshEEENS_3tmpINS_14GeometricFieldIdT_T0_EEEERKS7_+0x188) [0x2b9c30c1bad8]
        6  /public1/home/sch10341/soft/openfoam10/OpenFOAM-10/platforms/linux64IcxDPInt32Opt/lib/libincompressibleMomentumTransportModels.so(_ZNK4Foam9LESModels4WALEINS_36incompressibleMomentumTransportModelEE1kERKNS_14GeometricFieldINS_6TensorIdEENS_12fvPatchFieldENS_7volMeshEEE+0x758) [0x2b9c30cb6da8]
        7  /public1/home/sch10341/soft/openfoam10/OpenFOAM-10/platforms/linux64IcxDPInt32Opt/lib/libincompressibleMomentumTransportModels.so(_ZN4Foam9LESModels4WALEINS_36incompressibleMomentumTransportModelEE10correctNutEv+0x12d) [0x2b9c30cb637d]
        8  simpleFoam() [0x43326c]
        9  /lib64/libc.so.6(__libc_start_main+0xf5) [0x2b9c34f93555]
       10  simpleFoam() [0x41c588]
    ===================
    

    1、checkMesh结果如图所示:
    case1:
    a49ee909-7a9c-4cc4-a8d7-204f2d4cd15f-image.png

    case2:
    21ac89b4-ae56-46d8-a3e0-a19af1f04095-image.png

    2、blcokMeshDict文件如下所示:
    case1:

    backgroundMesh
    {
        xMin   4000; 
        xMax   6100;
        yMin   4400; 
        yMax   6500;
        zMin     -60;
        zMax   600;
        xCells  70;
        yCells  70;
        zCells  22;
    }
    
    convertToMeters 1;
    
    vertices
    (
        ($!backgroundMesh/xMin $!backgroundMesh/yMin $!backgroundMesh/zMin)
        ($!backgroundMesh/xMax $!backgroundMesh/yMin $!backgroundMesh/zMin)
        ($!backgroundMesh/xMax $!backgroundMesh/yMax $!backgroundMesh/zMin)
        ($!backgroundMesh/xMin $!backgroundMesh/yMax $!backgroundMesh/zMin)
    
        ($!backgroundMesh/xMin $!backgroundMesh/yMin $!backgroundMesh/zMax)
        ($!backgroundMesh/xMax $!backgroundMesh/yMin $!backgroundMesh/zMax)
        ($!backgroundMesh/xMax $!backgroundMesh/yMax $!backgroundMesh/zMax)
        ($!backgroundMesh/xMin $!backgroundMesh/yMax $!backgroundMesh/zMax)
    );
    
    blocks
    (
        hex (0 1 2 3 4 5 6 7)
        (
            $!backgroundMesh/xCells
            $!backgroundMesh/yCells
            $!backgroundMesh/zCells
        )
        simpleGrading (1 1 1)
    );
    
    boundary
    (
        west
        {
            type patch;
            faces
            (
                (0 3 7 4)
            );
        }
    
        east
        {
            type patch;
            faces
            (
                (1 5 6 2)
            );
        }
    
    
        south
        {
            type patch;
            faces
            (
                (0 4 5 1)
            );
        }
        north
        {
            type patch;
            faces
            (
                (3 2 6 7)
            );
        }
    
        ground
        {
            type wall;
            faces
            (
                (0 1 2 3)
            );
        }
    
        top
        {
            type patch;
            faces
            (
                (4 7 6 5)
            );
        }
    
    );
    
    

    case2:(只修改了xmin,xmax,ymin,ymax)

    backgroundMesh
    {
    backgroundMesh
        {
            xMin   3500; 
            xMax   6500;
            yMin   4000; 
            yMax   7000;
            zMin     -60;
            zMax   600;
            xCells  100;
            yCells  100;
            zCells  22;
        }
        
        convertToMeters 1;
        
        vertices
        (
            ($!backgroundMesh/xMin $!backgroundMesh/yMin $!backgroundMesh/zMin)
            ($!backgroundMesh/xMax $!backgroundMesh/yMin $!backgroundMesh/zMin)
            ($!backgroundMesh/xMax $!backgroundMesh/yMax $!backgroundMesh/zMin)
            ($!backgroundMesh/xMin $!backgroundMesh/yMax $!backgroundMesh/zMin)
        
            ($!backgroundMesh/xMin $!backgroundMesh/yMin $!backgroundMesh/zMax)
            ($!backgroundMesh/xMax $!backgroundMesh/yMin $!backgroundMesh/zMax)
            ($!backgroundMesh/xMax $!backgroundMesh/yMax $!backgroundMesh/zMax)
            ($!backgroundMesh/xMin $!backgroundMesh/yMax $!backgroundMesh/zMax)
        );
        
        blocks
        (
            hex (0 1 2 3 4 5 6 7)
            (
                $!backgroundMesh/xCells
                $!backgroundMesh/yCells
                $!backgroundMesh/zCells
            )
            simpleGrading (1 1 1)
        );
        
        boundary
        (
            west
            {
                type patch;
                faces
                (
                    (0 3 7 4)
                );
            }
        
            east
            {
                type patch;
                faces
                (
                    (1 5 6 2)
                );
            }
        
        
            south
            {
                type patch;
                faces
                (
                    (0 4 5 1)
                );
            }
            north
            {
                type patch;
                faces
                (
                    (3 2 6 7)
                );
            }
        
            ground
            {
                type wall;
                faces
                (
                    (0 1 2 3)
                );
            }
        
            top
            {
                type patch;
                faces
                (
                    (4 7 6 5)
                );
            }
        
        );
    }
    
    

    3、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
    {
        terrain
        {
            type triSurfaceMesh;
            file "km8LS.stl";
        }
    };
    
    
    
    // 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;
    
        // Allow a certain level of imbalance during refining
        // (since balancing is quite expensive)
        // Expressed as fraction of perfect balance (= overall number of cells /
        // nProcs). 0=balance always.
        maxLoadUnbalance 0.10;
    
    
        // 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/geometry for now.
        features
        (
            //{
            //    file "someLine.eMesh";
            //    level 2;
            //}
        );
    
    
    
        // 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
        {
            terrain
            {
                // Surface-wise min and max refinement level
                level (2 2);
    
                // Optional region-wise level specification
    /*
                regions
                {
                    windTurbine
                    {
                        level (3 3);
                    }
                }
    */
                //- Optional angle to detect small-large cell situation
                //  perpendicular to the surface. Is the angle of face w.r.t.
                //  the local surface normal. Use on flat(ish) surfaces only.
                //  Otherwise leave out or set to negative number.
                // perpendicularAngle 10;
    
    
                //- Optional faceZone and (for closed surface) cellZone with
                //  how to select the cells that are in the cellZone
                //  (inside / outside / specified insidePoint)
                // faceZone sphere;
                // cellZone sphere;
                // mode        inside;  // outside/insidePoint
            }
        }
    
        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
        {
    
    
    
            // sphere.stl
            //{
            //    mode distance;
            //    levels ((1.0 5) (2.0 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 insidePoint is kept.
        // NOTE: This point should never be on a face, always inside a cell, even
        // after refinement.
        insidePoint (5000 5500 300);
    
    
        // 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 4.0;
    
        //- Number of mesh displacement relaxation iterations.
        nSolveIter 30;
    
        //- Maximum number of snapping relaxation iterations. Should stop
        //  before upon reaching a correct mesh.
        nRelaxIter 5;
    }
    
    
    
    // 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
        {
        }
    
        // Expansion factor for layer mesh
        expansionRatio 1.0;
    
    
        // Wanted thickness of final added cell layer. If multiple layers
        // is the thickness of the layer furthest away from the wall.
        // Relative to undistorted size of cell outside layer.
        // See relativeSizes parameter.
        finalLayerThickness 0.3;
    
        // Minimum thickness of cell layer. If for any reason layer
        // cannot be above minThickness do not add layer.
        // See relativeSizes parameter.
        minThickness 0.25;
    
        // 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;
    
    
        // Advanced settings
    
        // When not to extrude surface. 0 is flat surface, 90 is when two faces
        // are perpendicular
        featureAngle 60;
    
        // 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 16x! 90 degrees corresponds to 130 in 16x.
        minMedianAxisAngle 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;
    
        // Max number of iterations after which relaxed meshQuality controls
        // get used. Up to nRelaxIter it uses the settings in meshQualityControls,
        // after nRelaxIter it uses the values in meshQualityControls::relaxed.
        nRelaxedIter 20;
    }
    
    
    
    // Generic mesh quality settings. At any undoable phase these determine
    // where to undo.
    meshQualityControls
    {
        //- Maximum non-orthogonality allowed. Set to 180 to disable.
        maxNonOrtho 65;
    
        //- Max skewness allowed. Set to <0 to disable.
        maxBoundarySkewness 20;
        maxInternalSkewness 4;
    
        //- Max concaveness allowed. Is angle (in degrees) below which concavity
        //  is allowed. 0 is straight face, <0 would be convex face.
        //  Set to 180 to disable.
        maxConcave 80;
    
        //- Minimum cell pyramid volume relative to min bounding box length^3
        //  Set to a fraction of the smallest cell volume expected.
        //  Set to very negative number (e.g. -1e30) to disable.
        minVol -1e30;
    
        //- Minimum quality of the tet formed by the face-centre
        //  and variable base point minimum decomposition triangles and
        //  the cell centre.  Set to very negative number (e.g. -1e30) to
        //  disable.
        //     <0 = inside out tet,
        //      0 = flat tet
        //      1 = regular tet
        minTetQuality 1e-30;
    
        //- Minimum face twist. Set to <-1 to disable. dot product of face normal
        //  and face centre triangles normal
        minTwist 0.05;
    
        //- Minimum normalised cell determinant
        //  1 = hex, <= 0 = folded or flattened illegal cell
        minDeterminant 0.001;
    
        //- minFaceWeight (0 -> 0.5)
        minFaceWeight 0.05;
    
        //- minVolRatio (0 -> 1)
        minVolRatio 0.01;
    
        //- Number of error distribution iterations
        nSmoothScale 4;
    
        //- Amount to scale back displacement at error points
        errorReduction 0.75;
    
        relaxed
        {
            //- Maximum non-orthogonality allowed. Set to 180 to disable.
            maxNonOrtho 75;
        }
    }
    
    mergeTolerance 1e-6;
    
    
    1 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    写于 最后由 编辑
    #2

    找到问题所在了:是划分网格时出现的问题,但是仍然解决不了
    如图:blockMeshDict设置相同范围(3000m3000m600m时),但是网格大小不同时(网格大小图一:100m,图二:60m),网格变小会导致划分失败(如图,地面仍然为平面,而不是stl文件)
    图一:
    image.png

    图二:底面变成真实地形

    image.png

    刚 1 条回复 最后回复
  • 刚 离线
    刚 离线
    刚开始学流体力学
    在 中回复了 wsy11 最后由 编辑
    #3

    @wsy11 你好,我做的和你一样的基于真实地形的风场模拟,我也是遇到了运行一段时间发散的问题,现在打算把网格弄得稀疏一些

    W 1 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    在 中回复了 刚开始学流体力学 最后由 编辑
    #4

    @刚开始学流体力学
    我也是把网格量减少了,可以成功运行一段时间,但是运行一段时间后还是发散,请问您是多大的地形,以及运行多长的模拟?

    刚 1 条回复 最后回复
  • 刚 离线
    刚 离线
    刚开始学流体力学
    在 中回复了 wsy11 最后由 编辑
    #5

    @wsy11 我的是6000 * 2000 * 600,现在能运行到160s左右,你使用的是哪个求解器,方便的话可以加个联系方式交流嘛

    W 2 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    在 中回复了 刚开始学流体力学 最后由 wsy11 编辑
    #6

    @刚开始学流体力学
    我看了您之前的帖子,咱们是一个方向的,我也是在处理wrf+CFD的问题

    1 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    在 中回复了 刚开始学流体力学 最后由 编辑
    #7
    此回复已被删除!
    刚 1 条回复 最后回复
  • 刚 离线
    刚 离线
    刚开始学流体力学
    在 中回复了 wsy11 最后由 编辑
    #8

    @wsy11 好的,稍等,我提交了

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]