Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新
    1. Home
    2. Samuel-Tu
    S
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups

    Samuel-Tu

    @Samuel-Tu

    397
    Posts
    221
    Profile views
    5
    Followers
    1
    Following
    Joined Last Online

    Samuel-Tu Follow

    Best posts made by Samuel-Tu

    • 层流RTS调用机制简析(以simpleFoam为例)

      注意到simpleFoam源码的createField.H中含有一行代码:

      singlePhaseTransportModel laminarTransport(U, phi);
      

      将类singlePhaseTransportModel实例化为laminarTransport,并且传给构造函数两个参数U和phi。
      在simpleFoam.C中找到了#include "singlePhaseTransportModel.H"。类singlePhaseTransportModel很有可能在里面定义,因此进入singlePhaseTransportModel.H。
      其路径为$FOAM_SRC/transportModels/incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H,发现类singlePhaseTransportModel,及其构造函数的声明。因此进入singlePhaseTransportModel.C中查看其定义。

      Foam::singlePhaseTransportModel::singlePhaseTransportModel
      (
          const volVectorField& U,
          const surfaceScalarField& phi
      )
      :
          IOdictionary
          (
              IOobject
              (
                  "transportProperties",
                  U.time().constant(),
                  U.db(),
                  IOobject::MUST_READ_IF_MODIFIED,
                  IOobject::NO_WRITE
              )
          ),
          viscosityModelPtr_(viscosityModel::New("nu", *this, U, phi))
      {}
      

      在类singlePhaseTransportModel构造前,先建立了读取constant/transportProperties的字典,并用
      viscosityModel::New返回了一个叫viscosityModelPtr_的指针。
      因此需要查看viscosityModel::New的定义。路径为$FOAM_SRC/transportModels/incompressible/viscosityModels/viscosityModel/viscosityModelNew.C。相关代码如下:

      Foam::autoPtr<Foam::viscosityModel> Foam::viscosityModel::New
      (
          const word& name,
          const dictionary& viscosityProperties,
          const volVectorField& U,
          const surfaceScalarField& phi
      )
      {
          const word modelType(viscosityProperties.lookup("transportModel"));
      
          Info<< "Selecting incompressible transport model " << modelType << endl;
      
          auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
      
          if (!cstrIter.found())
          {
              FatalErrorInFunction
                  << "Unknown viscosityModel type "
                  << modelType << nl << nl
                  << "Valid viscosityModels :" << endl
                  << dictionaryConstructorTablePtr_->sortedToc()
                  << exit(FatalError);
          }
      
          return autoPtr<viscosityModel>
              (cstrIter()(name, viscosityProperties, U, phi));
      }
      

      此函数本质是在contant/transportProperties文件中查询关键字transportModel对应的值(以Newtonian为例),并在哈希表中查看是否存在这个Newtonian。返回Newtonian在哈希表中对应的值。以我目前的学习经验来看,这个对应值应该是类Newtonian的一个临时对象,并用cstrIter()(name, viscosityProperties, U, phi)括号里的参数进行了初始化。因此需要找到类Newtonian的构造函数。路径为:$FOAM_SRC/transportModels/incompressible/viscosityModels/Newtonian/Newtonian.C

      Foam::viscosityModels::Newtonian::Newtonian
      (
          const word& name,
          const dictionary& viscosityProperties,
          const volVectorField& U,
          const surfaceScalarField& phi
      )
      :
          viscosityModel(name, viscosityProperties, U, phi),
          nu0_("nu", dimViscosity, viscosityProperties_),
          nu_
          (
              IOobject
              (
                  name,
                  U_.time().timeName(),
                  U_.db(),
                  IOobject::NO_READ,
                  IOobject::NO_WRITE
              ),
              U_.mesh(),
              nu0_
          )
      {}
      

      在构造类Newtonian时先构造了类viscosityModel。注意到类viscosityModel是类Newtonian的一个父类。因此需要找到类viscosityModel的构造函数。路径为:$FOAM_SRC/transportModels/incompressible/viscosityModels/viscosityModel/viscosityModel.C

      Foam::viscosityModel::viscosityModel
      (
          const word& name,
          const dictionary& viscosityProperties,
          const volVectorField& U,
          const surfaceScalarField& phi
      )
      :
          name_(name),
          viscosityProperties_(viscosityProperties),
          U_(U),
          phi_(phi)
      {}
      

      类viscosityModel的构造函数实际是将形参用于name_,viscosityProperties_,U_和phi_初始化了。这里的viscosityProperties_由于被类Newtonian继承,在类Newtonian的构造函数中可以看见nu0_使用了viscosityProperties_进行初始化。而viscosityProperties_的本质实际就是

       IOdictionary
          (
              IOobject
              (
                  "transportProperties",
                  U.time().constant(),
                  U.db(),
                  IOobject::MUST_READ_IF_MODIFIED,
                  IOobject::NO_WRITE
              )
          ),
      

      返回看nu0_的初始化:

      nu0_("nu", dimViscosity, viscosityProperties_)
      

      实际是读取constant/transportProperties文件里的nu关键字对应的dimensionedScalar。
      而nu_

          nu_
          (
              IOobject
              (
                  name,
                  U_.time().timeName(),
                  U_.db(),
                  IOobject::NO_READ,
                  IOobject::NO_WRITE
              ),
              U_.mesh(),
              nu0_
          )
      

      nu_则是以nu0_这个dimensionedScalar构建了一个volScalarField。

      posted in OpenFOAM
      S
      Samuel-Tu
    • RE: nearestPoint的问题

      此贴基本完结,按着源代码琢磨了一下午,基本弄清楚了是如何计算的。nearestPoint()主要使用了实时碰撞检测算法,可以计算出网格中心点到一个面的最短距离。这个最短距离是通过寻找面上离网格中心点的最近点来计算的。等我过段时间总结好了,到时候再补充到这个贴子下面。

      posted in OpenFOAM
      S
      Samuel-Tu
    • RE: of1806中的epsilonWallFunction是否合并了LowRe的模型?

      在头文件找到了描述:The low-Re correction is activated by setting the entry lowReCorrection to 'on'; in this mode the model switches between laminar and turbulent functions based on the laminar-to-turbulent y+ value derived from kappa and E. When the lowReCorrection is inactive, the wall function operates in high-Re mode.可能是在constant文件里使用这epsilonWallFunction的时候能够选择打不打开LowRe

      posted in OpenFOAM
      S
      Samuel-Tu

    Latest posts made by Samuel-Tu

    • RE: functionObject里面可以加自定义的程序吗

      @cresendo https://mp.weixin.qq.com/s/5aoUmeQGCqULXuBe73AtdA
      今天出了,一个简单教程

      posted in OpenFOAM
      S
      Samuel-Tu
    • RE: 缩尺模型发散

      感觉是不是fluent有什么黑科技,在fluent里能算,在of里发散了。。

      posted in OpenFOAM
      S
      Samuel-Tu
    • RE: 缩尺模型发散

      似乎是网格尺寸的原因,我把速度缩小10倍,能算了,说明以前的Y+可能有问题

      posted in OpenFOAM
      S
      Samuel-Tu
    • 缩尺模型发散

      遇到一个奇怪的事情,在做模拟的时候,用足尺模型计算可以正常算,做缩尺模型的时候就会发散
      我做的二维模拟,厚度方向只有一层网格,边界条件按论文设置的,论文用fluent算的缩尺模型,我放大到足尺模型算没有问题,但是按论文的尺寸算,第一步Uz就是solution singularity,算着算着epsilon就发散了,很奇怪。我用的simpleFoam,大家有啥建议吗,按理说应该能算啊。。。

      RAS
      {
          RASModel        realizableKE;
          turbulence      on;
          printCoeffs     on;
          A0              4;
          C2              1.9;
          sigmak          1;
          sigmaEps        1.2;
      }
      
      No MRF models present
      
      No finite volume options present
      
      Starting time loop
      
      wallShearStress wallShearStress:
          processing all wall patches
      
      Time = 0.01
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 1, Final residual = 9.02931e-11, No Iterations 5
      DILUPBiCGStab:  Solving for Uz:  solution singularity
      GAMG:  Solving for p, Initial residual = 1, Final residual = 0.0511143, No Iterations 14
      GAMG:  Solving for p, Initial residual = 9.35553e-05, Final residual = 7.3953e-06, No Iterations 2
      time step continuity errors : sum local = 5.93648e-05, global = -2.24242e-05, cumulative = -2.24242e-05
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.141893, Final residual = 1.91784e-12, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 1, Final residual = 2.77584e-10, No Iterations 5
      ExecutionTime = 1.25 s  ClockTime = 2 s
      
      Time = 0.02
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.527912, Final residual = 5.42646e-12, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.587444, Final residual = 1.93572e-11, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.0040408, Final residual = 0.000253175, No Iterations 4
      GAMG:  Solving for p, Initial residual = 0.00119141, Final residual = 0.000118566, No Iterations 6
      time step continuity errors : sum local = 0.000903519, global = 0.000115926, cumulative = 9.35023e-05
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00632051, Final residual = 4.41338e-13, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.93484, Final residual = 9.44193e-11, No Iterations 5
      ExecutionTime = 1.75 s  ClockTime = 2 s
      
      Time = 0.03
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.296853, Final residual = 3.58872e-10, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.358972, Final residual = 3.93449e-10, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.0399261, Final residual = 0.00208552, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00341154, Final residual = 0.000273619, No Iterations 7
      time step continuity errors : sum local = 0.00196847, global = 0.0002969, cumulative = 0.000390402
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.0295801, Final residual = 9.2042e-13, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.171095, Final residual = 5.49745e-10, No Iterations 5
      ExecutionTime = 2.22 s  ClockTime = 3 s
      
      Time = 0.04
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.136215, Final residual = 5.49597e-11, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.31202, Final residual = 1.31588e-10, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.130254, Final residual = 0.00470188, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00639474, Final residual = 0.000576745, No Iterations 8
      time step continuity errors : sum local = 0.00159515, global = 0.000184109, cumulative = 0.000574511
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.0325781, Final residual = 7.34046e-12, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.150909, Final residual = 1.5092e-10, No Iterations 5
      ExecutionTime = 2.72 s  ClockTime = 3 s
      
      Time = 0.05
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.309871, Final residual = 7.73697e-11, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.461963, Final residual = 1.28081e-10, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.167412, Final residual = 0.00510895, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00610619, Final residual = 0.000483956, No Iterations 7
      time step continuity errors : sum local = 0.00101936, global = 5.21071e-05, cumulative = 0.000626618
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00882784, Final residual = 7.51562e-13, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.236641, Final residual = 6.08151e-11, No Iterations 5
      ExecutionTime = 3.2 s  ClockTime = 3 s
      
      Time = 0.06
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.341882, Final residual = 1.0659e-10, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.454444, Final residual = 1.41636e-10, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.132903, Final residual = 0.00323376, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00381782, Final residual = 0.000236562, No Iterations 6
      time step continuity errors : sum local = 0.000731669, global = -0.000105249, cumulative = 0.000521369
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.0075595, Final residual = 4.3385e-12, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.192427, Final residual = 3.91865e-10, No Iterations 5
      ExecutionTime = 3.68 s  ClockTime = 4 s
      
      Time = 0.07
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.282586, Final residual = 2.67545e-10, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.35265, Final residual = 2.45834e-10, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.151323, Final residual = 0.00331011, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00398265, Final residual = 0.000390266, No Iterations 5
      time step continuity errors : sum local = 0.00105724, global = -8.7694e-05, cumulative = 0.000433675
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00759443, Final residual = 1.21657e-12, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.18612, Final residual = 3.54752e-11, No Iterations 5
      ExecutionTime = 4.13 s  ClockTime = 4 s
      
      Time = 0.08
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.213044, Final residual = 6.05622e-11, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.28304, Final residual = 9.67631e-11, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.189574, Final residual = 0.00373539, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00463947, Final residual = 0.000336507, No Iterations 7
      time step continuity errors : sum local = 0.000557299, global = -5.79127e-05, cumulative = 0.000375763
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00781571, Final residual = 1.93204e-12, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.138057, Final residual = 3.95958e-11, No Iterations 5
      ExecutionTime = 4.62 s  ClockTime = 5 s
      
      Time = 0.09
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.237589, Final residual = 2.96319e-11, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.243097, Final residual = 1.46831e-10, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.180488, Final residual = 0.00312019, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00383925, Final residual = 0.00026896, No Iterations 7
      time step continuity errors : sum local = 0.00035406, global = -2.62236e-05, cumulative = 0.000349539
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.006831, Final residual = 3.72725e-13, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.126435, Final residual = 2.17405e-11, No Iterations 5
      ExecutionTime = 5.09 s  ClockTime = 5 s
      
      Time = 0.1
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.35012, Final residual = 3.04751e-11, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.30704, Final residual = 8.67602e-11, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.149198, Final residual = 0.00253316, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00305357, Final residual = 0.000284755, No Iterations 5
      time step continuity errors : sum local = 0.000375062, global = 2.83423e-05, cumulative = 0.000377881
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00611188, Final residual = 1.87536e-13, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.289974, Final residual = 2.50168e-11, No Iterations 5
      ExecutionTime = 5.88 s  ClockTime = 6 s
      
      wallShearStress wallShearStress write:
          writing field wallShearStress
          min/max(down) = (-2.87883 -3.63059e-22 -0.0927051), (0.461882 3.65848e-22 0.0998493)
          min/max(roof) = (-17.9474 -1.26777e-18 -3.09904), (-0.42612 1.16826e-18 6.57279)
          min/max(buildingWall) = (-6.27984 -1.34705e-19 -2.37151), (0.222287 1.01572e-19 6.15707)
      Time = 0.11
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.531763, Final residual = 2.03224e-12, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.56992, Final residual = 2.11653e-12, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.153026, Final residual = 0.00256444, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00310925, Final residual = 0.000212052, No Iterations 7
      time step continuity errors : sum local = 0.00026462, global = 1.89049e-05, cumulative = 0.000396786
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.0049126, Final residual = 9.09796e-14, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.282556, Final residual = 9.72273e-13, No Iterations 5
      ExecutionTime = 6.4 s  ClockTime = 7 s
      
      Time = 0.12
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.23185, Final residual = 1.68742e-11, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.377097, Final residual = 1.61394e-11, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.175782, Final residual = 0.0040422, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00486161, Final residual = 0.000340632, No Iterations 5
      time step continuity errors : sum local = 0.000478204, global = 5.30041e-05, cumulative = 0.00044979
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00552237, Final residual = 1.23137e-13, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.394754, Final residual = 2.5363e-11, No Iterations 5
      ExecutionTime = 6.84 s  ClockTime = 7 s
      
      Time = 0.13
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.379743, Final residual = 1.63324e-11, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.230827, Final residual = 4.62169e-12, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.207157, Final residual = 0.00627811, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00764946, Final residual = 0.000568072, No Iterations 7
      time step continuity errors : sum local = 0.000345064, global = 3.01655e-05, cumulative = 0.000479956
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00351726, Final residual = 8.00546e-14, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.386289, Final residual = 1.57371e-13, No Iterations 5
      ExecutionTime = 7.33 s  ClockTime = 8 s
      
      Time = 0.14
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.649438, Final residual = 4.46392e-16, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.506957, Final residual = 1.07223e-16, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.156169, Final residual = 0.00375195, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00165985, Final residual = 0.000160854, No Iterations 3
      time step continuity errors : sum local = 0.00058144, global = 7.92418e-06, cumulative = 0.00048788
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00170993, Final residual = 2.94273e-17, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.329833, Final residual = 1.51244e-18, No Iterations 5
      ExecutionTime = 7.77 s  ClockTime = 8 s
      
      Time = 0.15
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.571959, Final residual = 3.32197e-16, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.458761, Final residual = 1.52795e-17, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.0452743, Final residual = 0.00151925, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.00267839, Final residual = 0.000230421, No Iterations 1
      time step continuity errors : sum local = 0.00342145, global = -1.32423e-05, cumulative = 0.000474638
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.000546564, Final residual = 2.02553e-17, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.130893, Final residual = 2.82138e-19, No Iterations 5
      ExecutionTime = 8.17 s  ClockTime = 8 s
      
      Time = 0.16
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.463509, Final residual = 1.57563e-17, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.509736, Final residual = 4.59172e-18, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.134174, Final residual = 0.00768087, No Iterations 2
      GAMG:  Solving for p, Initial residual = 0.00363852, Final residual = 0.000201176, No Iterations 4
      time step continuity errors : sum local = 0.0210048, global = -0.000201257, cumulative = 0.000273381
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00400355, Final residual = 8.29593e-18, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.366453, Final residual = 1.20683e-18, No Iterations 5
      ExecutionTime = 8.63 s  ClockTime = 9 s
      
      Time = 0.17
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.267952, Final residual = 4.29013e-23, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.540221, Final residual = 5.71911e-22, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.123787, Final residual = 0.00286107, No Iterations 1
      GAMG:  Solving for p, Initial residual = 6.716e-05, Final residual = 3.30864e-06, No Iterations 6
      time step continuity errors : sum local = 1172.79, global = -133.626, cumulative = -133.626
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 0.00118844, Final residual = 9.31074e-18, No Iterations 5
      DILUPBiCGStab:  Solving for k, Initial residual = 0.43358, Final residual = 1.23182e-16, No Iterations 5
      ExecutionTime = 9.1 s  ClockTime = 9 s
      
      Time = 0.18
      
      DILUPBiCGStab:  Solving for Ux, Initial residual = 0.699964, Final residual = 2.85242e-22, No Iterations 5
      DILUPBiCGStab:  Solving for Uz, Initial residual = 0.654102, Final residual = 3.34865e-22, No Iterations 5
      GAMG:  Solving for p, Initial residual = 0.1765, Final residual = 8.0125e-05, No Iterations 1
      GAMG:  Solving for p, Initial residual = 0.332435, Final residual = 0.0152816, No Iterations 1
      time step continuity errors : sum local = 7.41639e+18, global = 2.63517e+13, cumulative = 2.63517e+13
      DILUPBiCGStab:  Solving for epsilon, Initial residual = 2.32053e-07, Final residual = 1.76158e-19, No Iterations 5
      bounding epsilon, min: -70.8119 max: 8.51758e+10 average: 6.33029e+06
      DILUPBiCGStab:  Solving for k, Initial residual = 1, Final residual = 4.21351e-16, No Iterations 5
      ExecutionTime = 9.51 s  ClockTime = 10 s
      
      
      posted in OpenFOAM
      S
      Samuel-Tu
    • RE: shm生成边界层没有完全覆盖

      修改后边角处边界层也加上了:
      111.png
      但是在加密交界面网格很畸形:
      222.png
      这是什么导致的呢?有没有改进办法

      posted in Meshy
      S
      Samuel-Tu
    • RE: shm生成边界层没有完全覆盖

      找到解决办法了,在addLayersControls里把featureAngle从60改成90就行

      posted in Meshy
      S
      Samuel-Tu
    • shm生成边界层没有完全覆盖

      我感觉的我模型其实不复杂,但是边界层生成的时候缺有点问题,请大家帮忙看一下如何改进比较好
      下图是shm第二步snap后的图:
      111.png
      感觉吻合的还可以的。
      然后加边界层后发现夹角处的边界层出了问题:
      222.png
      我shm中对边界层的控制如下:

      /*--------------------------------*- C++ -*----------------------------------*\
      | =========                 |                                                 |
      | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
      |  \\    /   O peration     | Version:  v1806                                 |
      |   \\  /    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       true;
      
      // 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
      {
          flatRoof.stl
          {
              type triSurfaceMesh;
              name roof;
          }
      
          refinementBox
          {
              type searchableBox;
              min (20 0 0);
              max (80   1.0 8);
          }
      };
      
      
      
      // 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 10;
      
          // 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 3;
      
      
      
          // 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
          (
          );
      
      
      
          // 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
          {
              roof
              {
                  // Surface-wise min and max refinement level
                  level (1 1);
      
                  // Optional specification of patch type (default is wall). No
                  // constraint types (cyclic, symmetry) etc. are allowed.
                  patchInfo
                  {
                      type wall;
                      inGroups (roof);
                  }
              }
          }
      
          // Resolve sharp angles
          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
          {
              refinementBox
              {
                  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.
          locationInMesh (0.5 0.5 0.5);
      
      
          // 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 2.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;
      
          // Feature snapping
      
              //- Number of feature edge snapping iterations.
              //  Leave out altogether to disable.
              nFeatureSnapIter 10;
      
              //- Detect (geometric only) features by sampling the surface
              //  (default=false).
              implicitFeatureSnap false;
      
              //- Use castellatedMeshControls::features (default = true)
              explicitFeatureSnap true;
      
              //- Detect points on multiple surfaces (only for explicitFeatureSnap)
              multiRegionFeatureSnap false;
      }
      
      
      
      // 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
          {
              "roof"
              {
                  nSurfaceLayers 2;
              }
          }
      
          // Expansion factor for layer mesh
          expansionRatio 1.2;
      
          // 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 1.0;
          firstLayerThickness 0.5;
          // Minimum thickness of cell layer. If for any reason layer
          // cannot be above minThickness do not add layer.
          // Relative to undistorted size of cell outside layer.
          minThickness 0.3;
      
          // 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 1.7.x! (didn't do anything in 1.7.x)
          nGrow 0;
      
          // Advanced settings
      
          // When not to extrude surface. 0 is flat surface, 90 is when two faces
          // are perpendicular
          featureAngle 60;
      
          // At non-patched sides allow mesh to slip if extrusion direction makes
          // angle larger than slipFeatureAngle.
          slipFeatureAngle 30;
      
          // Maximum number of snapping relaxation iterations. Should stop
          // before upon reaching a correct mesh.
          nRelaxIter 3;
      
          // 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 1.7.x! 90 degrees corresponds to 130
          // in 1.7.x.
          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;
      }
      
      
      
      // Generic mesh quality settings. At any undoable phase these determine
      // where to undo.
      meshQualityControls
      {
          #include "meshQualityDict"
      
      
          // Advanced
      
          //- Number of error distribution iterations
          nSmoothScale 4;
          //- Amount to scale back displacement at error points
          errorReduction 0.75;
      }
      
      
      // Advanced
      
      // Write flags
      writeFlags
      (
          scalarLevels
          layerSets
          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;
      
      
      // ************************************************************************* //
      
      

      大家有什么建议么?提高一下边界层的质量

      posted in Meshy
      S
      Samuel-Tu
    • RE: functionObject里面可以加自定义的程序吗

      @cresendo 就叫OpenFOAM。。七个人在做,我的是周二发

      posted in OpenFOAM
      S
      Samuel-Tu
    • RE: gauss upwind和gauss linearUpwind grad(U)结果差异大

      @cccrrryyy fluent里面壁面函数只用设置一下,而OF里所有湍流变量都要设置。。我都搞不明白什么时候该搭配什么。只是知道根据y+简单判断一下该用哪种。。

      posted in OpenFOAM
      S
      Samuel-Tu
    • RE: functionObject里面可以加自定义的程序吗

      @cresendo 是的。主要是编译麻烦,我已经搞清楚codedFunctionObject了。用codedFunctionObject好处是不用去改源代码,可以方便得给别人用,嘿嘿。相当于加了一个外载程序,嘿嘿。下周二会在公众号里分享一下使用方法,到时候也到cfd中文网来。

      posted in OpenFOAM
      S
      Samuel-Tu