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. 请教一个openfoam边界问题:fixedprofile的使用

请教一个openfoam边界问题:fixedprofile的使用

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

    我的模拟区域是一个类似于长方体的区域,目前已知各个面的多个点的边界条件(包括速度和气压);
    现在想要把边界条件导入,目前采用的是fixedprofile边界条件(按照物理量随高度变化生成txt文档),只导入速度条件时,可以正常运行,导入气压时会报错,请问这个什么原因?
    (我在运行中加入了地形,但下方未给出)

    blcokMeshDict如下:

    /*--------------------------------*- C++ -*----------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     | Website:  https://openfoam.org
        \\  /    A nd           | Version:  9
         \\/     M anipulation  |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        format      ascii;
        class       dictionary;
        object      blockMeshDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    backgroundMesh
    {
        xMin   -27; // L = 350
        xMax   6153;
        yMin   -4; // L = 280
        yMax   3716;
        zMin     0;
        zMax   600;
        xCells  206;
        yCells  124;
        zCells  20;
    }
    
    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
    (
        inlet1
        {
            type patch;
            faces
            (
                (1 5 6 2)
            );
        }
    
        outlet1
        {
            type patch;
            faces
            (
                (0 3 7 4)
            );
        }
    
        inlet2
        {
            type patch;
            faces
            (
                (3 2 6 7)
            );
        }
    
        outlet2
        {
            type patch;
            faces
            (
                (0 4 5 1)
            );
        }
    
        ground
        {
            type wall;
            faces
            (
                (0 1 2 3)
            );
        }
    
        frontAndBack
        {
            type symmetry;
            faces
            (
                (4 7 6 5)
            );
        }
    
    );
    
    // ************************************************************************* //
    
    

    (2)p文件如下:

    /*--------------------------------*- C++ -*----------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     | Website:  https://openfoam.org
        \\  /    A nd           | Version:  9
         \\/     M anipulation  |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        format      ascii;
        class       volScalarField;
        object      p;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    dimensions      [0 2 -2 0 0 0 0];
    
    internalField   uniform 0;
    
    boundaryField
    {
        inlet1
        {
            type            fixedProfile;
            profile         tableFile;
            profileCoeffs   
            {
                file        "east_p.txt";
            }
            direction       (0 0 1);
            origin          0;
        }
    
        outlet1
        {
            type            fixedProfile;
            profile         tableFile;
            profileCoeffs   
            {
                file        "west_p.txt";
            }
            direction       (0 0 1);
            origin          0;
        }
        inlet2
        {
            type            fixedProfile;
            profile         tableFile;
            profileCoeffs   
            {
                file        "north_p.txt";
            }
            direction       (0 0 1);
            origin          0;
        }
    
        outlet2
        {
            type            fixedProfile;
            profile         tableFile;
            profileCoeffs   
            {
                file        "south_p.txt";
            }
            direction       (0 0 1);
            origin          0;
        }
    
        wall
        {
            type            zeroGradient;
        }
    
        #includeEtc "caseDicts/setConstraintTypes"
    }
    
    // ************************************************************************* //
    
    

    (3)u文件如下:

    /*--------------------------------*- C++ -*----------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     | Website:  https://openfoam.org
        \\  /    A nd           | Version:  9
         \\/     M anipulation  |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        format      ascii;
        class       volVectorField;
        object      U;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    Uinlet          (10 0 0);
    
    dimensions      [0 1 -1 0 0 0 0];
    
    internalField   uniform (0 0 0);
    
    boundaryField
    {
        inlet1
        {
            type            fixedProfile;
            profile         tableFile;
            profileCoeffs   
            {
                file        "east_u2.txt";
            }
            direction       (0 0 1);
            origin          0;
        }
    
        outlet1
        {
            type            fixedProfile;
            profile         tableFile;
            profileCoeffs   
            {
                file        "west_u2.txt";
            }
            direction       (0 0 1);
            origin          0;
        }
    
        inlet2
        {
            type            fixedProfile;
            profile         tableFile;
            profileCoeffs   
            {
                file        "north_u2.txt";
            }
            direction       (0 0 1);
            origin          0;
        }
    
        outlet2
        {
            type            fixedProfile;
            profile         tableFile;
            profileCoeffs   
            {
                file        "south_u2.txt";
            }
            direction       (0 0 1);
            origin          0;
        }
    
        wall
        {
            type            noSlip;
        }
    
        #includeEtc "caseDicts/setConstraintTypes"
    }
    
    // ************************************************************************* //
    
    

    (4)txt文档示例

    east_p:
    (
    (0 810.9839477279503)
    (30 808.0891987157489)
    (60 805.1645322988701)
    (90 802.22015)
    (120 799.29156)
    (150 796.36633)
    (180 793.4472)
    (210 790.5453)
    (240 787.6469)
    (270 784.7538)
    (300 781.8721)
    (330 778.99316)
    (360 776.1151)
    (390 773.2555)
    (420 770.4064)
    (450 767.5576)
    (480 764.70886)
    (510 761.87537)
    (540 759.061)
    (570 756.24927)
    (600 753.4375)
    )
    
    east_u2:
    (
    (0 (-1.660778921702502 0 0))
    (30 (-2.975759076034416 0 0))
    (60 (-3.839839556192187 0 0))
    (90 (-4.2877254 0 0))
    (120 (-4.671794 0 0))
    (150 (-4.900312 0 0))
    (180 (-5.0548387 0 0))
    (210 (-5.13091 0 0))
    (240 (-5.184279 0 0))
    (270 (-5.2090316 0 0))
    (300 (-5.188982 0 0))
    (330 (-5.168712 0 0))
    (360 (-5.14608 0 0))
    (390 (-5.0816574 0 0))
    (420 (-5.0173383 0 0))
    (450 (-4.9538355 0 0))
    (480 (-4.890333 0 0))
    (510 (-4.7623835 0 0))
    (540 (-4.588725 0 0))
    (570 (-4.4132843 0 0))
    (600 (-4.237844 0 0))
    )
    
    1 条回复 最后回复
  • 学流体的小明学 离线
    学流体的小明学 离线
    学流体的小明 神
    写于 最后由 编辑
    #2

    一个边界上不能既给速度fixedValue边界条件,又给压力fixedValue边界条件。
    应该是这样,吧?

    W 1 条回复 最后回复
  • 李东岳李 在线
    李东岳李 在线
    李东岳 管理员
    写于 最后由 编辑
    #3

    不知道你说的是怎么报错,是不能算还是运行报错发散。
    像楼上大佬说的,你的边界条件确实设置的不符合常理,运行是要报错发散

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    W 1 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    在 中回复了 学流体的小明 最后由 编辑
    #4

    @学流体的小明 大佬,我这个是为了模拟研究区域内部的风速和气压的,初始边界面的速度个气压都是已知的,所以就想着加进去来模拟内部的风速和气压。

    1 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    在 中回复了 李东岳 最后由 编辑
    #5

    @李东岳 李老师您好,是这样的,我现在的研究区域是一个5000m长5000m宽600m高的区域,已知东西南北四个面的边界条件,包括风速和气压,现在想要模拟处研究区域内部的风速和气压,如果不设置风速和气压的fixedvalue条件的话,请问有没有适合的边界条件能同时把四个面的气压和风速边界条件加进去?

    1 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    写于 最后由 编辑
    #6

    屏幕截图 2023-11-03 211426.jpg报错情况补发一下,同时加入风速和气压后运行几步就会这样报错

    学流体的小明学 1 条回复 最后回复
  • 学流体的小明学 离线
    学流体的小明学 离线
    学流体的小明 神
    在 中回复了 wsy11 最后由 编辑
    #7

    @wsy11
    看起来是速度场和压力场都没收敛呀,残差感觉很大
    然后你下面的epsilon就更大了,10的12次方……
    你放一下fvSolution的设置,感觉是设置的不对
    我不是大佬,李老师是大佬

    W 1 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    在 中回复了 学流体的小明 最后由 编辑
    #8

    @学流体的小明 fvsolution等等都是用的windaroundbuildings这个算例自带的,感觉我的研究问题和这个算例差不多,现在也刚接触openfoam学的不太深入,就没有修改

    /*--------------------------------*- C++ -*----------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     | Website:  https://openfoam.org
        \\  /    A nd           | Version:  9
         \\/     M anipulation  |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        format      ascii;
        class       dictionary;
        object      fvSolution;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    solvers
    {
        p
        {
            solver          GAMG;
            smoother        GaussSeidel;
            tolerance       1e-6;
            relTol          0.1;
        }
    
        "(U|k|omega|epsilon)"
        {
            solver          smoothSolver;
            smoother        symGaussSeidel;
            tolerance       1e-6;
            relTol          0.1;
        }
    }
    
    SIMPLE
    {
        residualControl
        {
            p               1e-4;
            U               1e-4;
            "(k|omega|epsilon)" 1e-4;
        }
        nNonOrthogonalCorrectors 0;
        pRefCell        0;
        pRefValue       0;
    
    }
    
    potentialFlow
    {
        nNonOrthogonalCorrectors 10;
    }
    
    relaxationFactors
    {
        fields
        {
            p               0.3;
        }
        equations
        {
            U               0.7;
            "(k|omega|epsilon).*" 0.7;
        }
    }
    
    // ************************************************************************* //
    
    学流体的小明学 1 条回复 最后回复
  • 学流体的小明学 离线
    学流体的小明学 离线
    学流体的小明 神
    在 中回复了 wsy11 最后由 编辑
    #9

    @wsy11 在 请教一个openfoam边界问题:fixedprofile的使用 中说:

    relTol 0.1;

    这个是残差相对量,也就是当前迭代步的残差是上次迭代步残差的0.1倍时,停止迭代。
    所以你一直没算收敛。
    把这个改成0试试。

    W 1 条回复 最后回复
  • W 离线
    W 离线
    wsy11
    在 中回复了 学流体的小明 最后由 编辑
    #10

    @学流体的小明 改成0确实不发散了,但是会提前收敛,我设置的是400步迭代,但是改了后18步就会收敛然后自动结束运行了

    学流体的小明学 1 条回复 最后回复
  • 学流体的小明学 离线
    学流体的小明学 离线
    学流体的小明 神
    在 中回复了 wsy11 最后由 编辑
    #11

    @wsy11

    simpleFoam为OpenFOAM中一个基于有限体积法的,用于求解稳态不可压缩牛顿流体N-S方程的求解器。
    http://dyfluid.com/simpleFoam.html

    那就是提前算到稳态了呗,所以结束了。

    1 条回复 最后回复

  • 登录

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