CFD中文网

    CFD中文网

    • 登录
    • 搜索
    • 最新

    OpenFOAM中LES输出最终残差问题

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

      LES模拟,调用了residuals函数输出残差,但发现输出的结果是每步计算的初始残差。根据函数的描述也是输出 initial residuals。请问大家有什么方法可以输出final residuals吗?

      /*--------------------------------*- C++ -*----------------------------------*\
        =========                 |
        \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
         \\    /   O peration     | Website:  https://openfoam.org
          \\  /    A nd           | Version:  8
           \\/     M anipulation  |
      -------------------------------------------------------------------------------
      Description
          For specified fields, writes out the initial residuals for the first
          solution of each time step; for non-scalar fields (e.g. vectors), writes
          the largest of the residuals for each component (e.g. x, y, z).
      
      \*---------------------------------------------------------------------------*/
      
      #includeEtc "caseDicts/postProcessing/numerical/residuals.cfg"
      
      fields (p U);
      
      // ************************************************************************* //
      
      1 条回复 最后回复 回复 引用
      • bestucan
        bestucan 版主 副教授 最后由 编辑

        https://www.cfd-online.com/Forums/openfoam-solving/181927-buoyantsimplefoam-not-plotting-residuals.html#post632303

        是因为没开预测么?

        滚来滚去……~(~o ̄▽ ̄)~o 滚来滚去都不能让大家看出来我不是老师么 O_o

        异步沟通方式(《posting style》from wiki)(下载后打开):
        https://www.jianguoyun.com/p/Dc52X2sQsLv2BRiqnKYD
        提问的智慧(github在gitee的镜像):
        https://gitee.com/bestucan/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md

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

          我更关注的是,为什么你不关注initial residual,而是关注final residual

          CFD高性能服务器 http://dyfluid.com/servers.html

          C 1 条回复 最后回复 回复 引用
          • C
            coolhhh @bestucan 最后由 编辑

            @bestucan

            1. 好像不是这个问题,下面是我输出的 log.pisoFoam 和 对应的 residuals.dat。 residuals.dat 输出的都是每步计算开始的 Initial residual,好像无法选择输出每步计算最后的 Final residual

            2. 计算的log.pisoFoam文件

            Time = 0.0015
            
            Courant Number mean: 0.18933236 max: 3.0134083
            smoothSolver:  Solving for Ux, Initial residual = 0.94279208, Final residual = 4.1036105e-07, No Iterations 4
            smoothSolver:  Solving for Uy, Initial residual = 0.24479151, Final residual = 9.6080469e-07, No Iterations 3
            smoothSolver:  Solving for Uz, Initial residual = 0.21776409, Final residual = 8.4350179e-07, No Iterations 3
            GAMG:  Solving for p, Initial residual = 0.0048258603, Final residual = 0.00021860641, No Iterations 18
            GAMG:  Solving for p, Initial residual = 0.17069422, Final residual = 0.0063724156, No Iterations 2
            time step continuity errors : sum local = 5.5286369e-05, global = 2.8590342e-06, cumulative = 2.6884486e-05
            GAMG:  Solving for p, Initial residual = 0.025078242, Final residual = 0.0012531841, No Iterations 16
            GAMG:  Solving for p, Initial residual = 0.058320856, Final residual = 0.0028998385, No Iterations 27
            time step continuity errors : sum local = 2.6808848e-06, global = -4.4628639e-09, cumulative = 2.6880023e-05
            GAMG:  Solving for p, Initial residual = 0.017046775, Final residual = 0.0008362502, No Iterations 36
            GAMG:  Solving for p, Initial residual = 0.0020386497, Final residual = 9.9487967e-07, No Iterations 305
            time step continuity errors : sum local = 8.7201563e-10, global = -1.7811338e-12, cumulative = 2.6880021e-05
            ExecutionTime = 16.02 s  ClockTime = 16 s
            
            1. 对应输出的 residuals.dat 文件
            # Residuals     
            # Time          	p               	Ux              	Uy              	Uz              
            0               	N/A	N/A
            0.0005          	1.00000000e+00	1.00000000e+00	1.00000000e+00	1.00000000e+00
            0.001           	3.79477181e-03	9.31777378e-01	3.20163786e-01	3.21921547e-01
            0.0015          	4.82586027e-03	9.42792079e-01	2.44791510e-01	2.17764088e-01
            
            1 条回复 最后回复 回复 引用
            • C
              coolhhh @李东岳 最后由 编辑

              @李东岳
              李老师,我本来是想输出最终残差后,画个最终残差曲线看下每步计算最后的收敛情况。我是加载入口脉动风计算,初始残差每步都是会比较大,所以比较关注每步计算的最终残差效果。

              bestucan 1 条回复 最后回复 回复 引用
              • bestucan
                bestucan 版主 副教授 @coolhhh 最后由 编辑

                @coolhhh
                终端切换到 log.pisoFoam 所在的文件夹,运行这句

                grep 'Final residual' log.pisoFoam | awk -F ',' '{print $3}' | cut -d "=" -f2 > finRes.log
                

                滚来滚去……~(~o ̄▽ ̄)~o 滚来滚去都不能让大家看出来我不是老师么 O_o

                异步沟通方式(《posting style》from wiki)(下载后打开):
                https://www.jianguoyun.com/p/Dc52X2sQsLv2BRiqnKYD
                提问的智慧(github在gitee的镜像):
                https://gitee.com/bestucan/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md

                C 1 条回复 最后回复 回复 引用
                • C
                  coolhhh @bestucan 最后由 编辑

                  @bestucan 完美解决,谢谢大佬:146:

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