Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    Smagorinsky模型不输出k_sgs场

    OpenFOAM
    2
    5
    612
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 李东岳
      李东岳 管理员 last edited by

      可以做如下改动进行输出,至少适用于OpenFOAM-8

      1. 打开Smagorinsky.H,添加k_:
          // Protected data
      
              dimensionedScalar Ck_;
              
              volScalarField k_;//这是添加的一行
      
      
          // Protected Member Functions
      
      1. 打开Smagorinsky.C,添加下面代码:
      :
          LESeddyViscosity<BasicMomentumTransportModel>
          (
              type,
              alpha,
              rho,
              U,
              alphaRhoPhi,
              phi,
              transport
          ),
      
          Ck_
          (
              dimensioned<scalar>::lookupOrAddToDict
              (
                  "Ck",
                  this->coeffDict_,
                  0.094
              )
          ),//这里加个逗号
          
          //下面是添加的
          k_
          (
              IOobject
              (
                  IOobject::groupName("k", this->alphaRhoPhi_.group()),
                  this->runTime_.timeName(),
                  this->mesh_,
                  IOobject::MUST_READ,
                  IOobject::AUTO_WRITE
              ),
              this->mesh_
          )
      {
          if (type == typeName)
          {
              this->printCoeffs(type);
          }
      }
      

      correctnut()函数通过下面代码替换:

      void Smagorinsky<BasicMomentumTransportModel>::correctNut()
      {
          k_ = (this->k(fvc::grad(this->U_)));
      
          this->nut_ = Ck_*this->delta()*sqrt(k_);
          this->nut_.correctBoundaryConditions();
          fv::options::New(this->mesh_).correct(this->nut_);
      }
      

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

      Z 1 Reply Last reply Reply Quote
      • Z
        ZZ给我趴下 @李东岳 last edited by

        @李东岳 李老师,请问为什么做了这些改变之后会编译错误呢?af952994b1515fcf635dcec15042a0a.png 974C0A2D7D0118B216E266CEC4F56C8C.png

        1 Reply Last reply Reply Quote
        • 李东岳
          李东岳 管理员 last edited by

          156-167行删掉,用下面的替换:

          void Smagorinsky<BasicMomentumTransportModel>::correctNut()
          {
              k_ = (this->k(fvc::grad(this->U_)));
          
              this->nut_ = Ck_*this->delta()*sqrt(k_);
              this->nut_.correctBoundaryConditions();
              fv::options::New(this->mesh_).correct(this->nut_);
          }

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

          Z 1 Reply Last reply Reply Quote
          • Z
            ZZ给我趴下 @李东岳 last edited by

            @李东岳这里提示重复定义,在59行有定义,而且和这个函数一样。 003f24ca251de51d6dbeaacef31c1ce.png

            1 Reply Last reply Reply Quote
            • Referenced by  李东岳 李东岳 
            • 李东岳
              李东岳 管理员 last edited by

              更简单的方法就是不用动求解器了,在算例文件下面的controlDict下面把这个放进去:

              cacheTemporaryObjects
              (
                  k
              );
              
              functions
              {
                  #includeFunc writeObjects("k")
              }
              

              然后直接跑就行

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

              1 Reply Last reply Reply Quote
              • Referenced by  李东岳 李东岳 
              • First post
                Last post

              CFD中文网 | 东岳流体 | 京ICP备15017992号-2
              论坛登录问题反馈可联系 li.dy@dyfluid.com