CFD中文网

    CFD中文网

    • 登录
    • 搜索
    • 最新

    LES-WALE中Ksgs如何求解

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

      有关openFoam中LES WALE模型求解Ksgs问题:
      1)openFoam计算WALE模型时,没有在各时刻输出k,通过图1的公式和WALE.C文件,知道Ksgs是求解了的。只是没有调用出来。
      2)用reactingFoam -postProcess -func turbulenceFields->k -time 0.0466命令得到的k是在总文件夹下的一个日志,打开查看如图2,并不是在某时刻文件夹中或后处理文件夹里。
      3)以前用dynamicKEqn模型k是直接输出的,对比了两个模型的.C文件,如图3,将WALE.C做了修改并重新编译,如图4,依旧没有k文件输出。

      请问大家怎么才能得到Ksgs呢?
      65410943-3f5d-4369-8251-a69f3895f978-图片.png d447f100-dc60-437b-a621-3d421839c27e-图片.png 5e915e14-a352-4185-91de-61e83890c35b-图片.png 121af1e6-6e3e-456f-b89b-56bfbf08e8ea-图片.png e7bf7083-f00b-4284-ac8d-4fd5cd197179-图片.png

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

        https://www.cfd-china.com/topic/4790/smagorinsky模型不输出k_sgs场 你看下这个?

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

        1 条回复 最后回复 回复 引用
        • 香柏树
          香柏树 最后由 编辑

          谢谢李老师,我参考您链接里的方法改了WALE.C和.H文件,编译过程都很顺利,但是还是没有输出的Ksgs。想请您帮我看一下,我改动的在图片中,也附上了全部的WALE.C和.H文件。fb6aa985-d914-4113-a866-b6466dea71ce-图片.png 0a7c6741-e37a-475f-99f8-4bef8b726e18-图片.png 4112bd23-202d-439a-8cc4-daf15f9d19af-图片.png ```
          WALE.C

            =========                 |
            \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
             \\    /   O peration     | Website:  https://openfoam.org
              \\  /    A nd           | Copyright (C) 2015-2018 OpenFOAM Foundation
               \\/     M anipulation  |
          -------------------------------------------------------------------------------
          License
              This file is part of OpenFOAM.
          
              OpenFOAM is free software: you can redistribute it and/or modify it
              under the terms of the GNU General Public License as published by
              the Free Software Foundation, either version 3 of the License, or
              (at your option) any later version.
          
              OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
              ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
              FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
              for more details.
          
              You should have received a copy of the GNU General Public License
              along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
          
          \*---------------------------------------------------------------------------*/
          
          #include "WALE.H"
          #include "fvOptions.H"
          
          // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
          
          namespace Foam
          {
          namespace LESModels
          {
          
          // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
          
          template<class BasicTurbulenceModel>
          tmp<volSymmTensorField> WALE<BasicTurbulenceModel>::Sd
          (
              const volTensorField& gradU
          ) const
          {
              return dev(symm(gradU & gradU));
          }
          
          
          template<class BasicTurbulenceModel>
          tmp<volScalarField> WALE<BasicTurbulenceModel>::k
          (
              const volTensorField& gradU
          ) const
          {
              volScalarField magSqrSd(magSqr(Sd(gradU)));
          
              return tmp<volScalarField>
              (
                  new volScalarField
                  (
                      IOobject
                      (
                          IOobject::groupName("k", this->alphaRhoPhi_.group()),
                          this->runTime_.timeName(),
                          this->mesh_
                      ),
                      sqr(sqr(Cw_)*this->delta()/Ck_)*
                      (
                          pow3(magSqrSd)
                         /(
                             sqr
                             (
                                 pow(magSqr(symm(gradU)), 5.0/2.0)
                               + pow(magSqrSd, 5.0/4.0)
                             )
                           + dimensionedScalar
                             (
                                 "small",
                                 dimensionSet(0, 0, -10, 0, 0),
                                 small
                             )
                         )
                      )
                  )
              );
          }
          
          
          template<class BasicTurbulenceModel>
          void WALE<BasicTurbulenceModel>::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_);
          
              BasicTurbulenceModel::correctNut();
          }
          
          
          // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
          
          template<class BasicTurbulenceModel>
          WALE<BasicTurbulenceModel>::WALE
          (
              const alphaField& alpha,
              const rhoField& rho,
              const volVectorField& U,
              const surfaceScalarField& alphaRhoPhi,
              const surfaceScalarField& phi,
              const transportModel& transport,
              const word& propertiesName,
              const word& type
          )
          :
              LESeddyViscosity<BasicTurbulenceModel>
              (
                  type,
                  alpha,
                  rho,
                  U,
                  alphaRhoPhi,
                  phi,
                  transport,
                  propertiesName
              ),
          
              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_
               ),
              Sd_
              (
                    IOobject
                    (
          
          
          
              Cw_
              (
                  dimensioned<scalar>::lookupOrAddToDict
                  (
                      "Cw",
                      this->coeffDict_,
                      0.325
                  )
              )
          {
              if (type == typeName)
              {
                  this->printCoeffs(type);
              }
          }
          
          
          // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
          
          template<class BasicTurbulenceModel>
          bool WALE<BasicTurbulenceModel>::read()
          {
              if (LESeddyViscosity<BasicTurbulenceModel>::read())
              {
                  Ck_.readIfPresent(this->coeffDict());
                  Cw_.readIfPresent(this->coeffDict());
          
                  return true;
              }
              else
              {
                  return false;
              }
          }
          
          
          template<class BasicTurbulenceModel>
          tmp<volScalarField> WALE<BasicTurbulenceModel>::epsilon() const
          {
              volScalarField k(this->k(fvc::grad(this->U_)));
          
              return tmp<volScalarField>
              (
                  new volScalarField
                  (
                      IOobject
                      (
                          IOobject::groupName("epsilon", this->alphaRhoPhi_.group()),
                          this->runTime_.timeName(),
                          this->mesh_,
                          IOobject::NO_READ,
                          IOobject::NO_WRITE
                      ),
                      this->Ce_*k*sqrt(k)/this->delta()
                  )
              );
          }
          
          
          template<class BasicTurbulenceModel>
          void WALE<BasicTurbulenceModel>::correct()
          {
              LESeddyViscosity<BasicTurbulenceModel>::correct();
              correctNut();
          }
          
          
          // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
          
          } // End namespace LESModels
          } // End namespace Foam
          
          // ************************************************************************* //
          
          

          WALE.H
          /---------------------------------------------------------------------------\

          \ / F ield OpenFOAM: The Open Source CFD Toolbox
          \ / O peration Website: https://openfoam.org
          \ / A nd Copyright (C) 2015-2018 OpenFOAM Foundation
          \/ M anipulation

          License
          This file is part of OpenFOAM.

          OpenFOAM is free software: you can redistribute it and/or modify it
          under the terms of the GNU General Public License as published by
          the Free Software Foundation, either version 3 of the License, or
          (at your option) any later version.
          
          OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
          ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
          FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
          for more details.
          
          You should have received a copy of the GNU General Public License
          along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
          

          Class
          Foam::LESModels::WALE

          Description
          The Wall-adapting local eddy-viscosity (WALE) SGS model.

          Reference:
          \verbatim
              Nicoud, F., & Ducros, F. (1999).
              Subgrid-scale stress modelling based on the square of the velocity
              gradient tensor.
              Flow, Turbulence and Combustion, 62(3), 183-200.
          \endverbatim
          
          The default model coefficients are
          \verbatim
              WALECoeffs
              {
                  Ck                  0.094;
                  Ce                  1.048;e
                  Cw                  0.325;
              }
          \endverbatim
          

          See also
          Foam::LESModels::Smagorinsky

          SourceFiles
          WALE.C

          *---------------------------------------------------------------------------*/

          #ifndef WALE_H
          #define WALE_H

          #include "LESModel.H"
          #include "LESeddyViscosity.H"

          // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

          namespace Foam
          {
          namespace LESModels
          {

          /---------------------------------------------------------------------------
          Class WALE Declaration
          *---------------------------------------------------------------------------*/

          template<class BasicTurbulenceModel>
          class WALE
          :
          public LESeddyViscosity<BasicTurbulenceModel>
          {
          // Private Member Functions

              // Disallow default bitwise copy construct and assignment
              WALE(const WALE&);
              void operator=(const WALE&);
          

          protected:

          // Protected data
          
              dimensionedScalar Ck_;
              dimensionedScalar Cw_;
              volScalarField k_;
          
          
          
          // Protected Member Functions
          
              //- Return the deviatoric symmetric part of the square of the given
              //  velocity gradient field
              tmp<volSymmTensorField> Sd(const volTensorField& gradU) const;
          
              //- Return SGS kinetic energy
              //  calculated from the given velocity gradient
              tmp<volScalarField> k(const volTensorField& gradU) const;
          
              //- Update the SGS eddy-viscosity
              virtual void correctNut();
          

          public:

          typedef typename BasicTurbulenceModel::alphaField alphaField;
          typedef typename BasicTurbulenceModel::rhoField rhoField;
          typedef typename BasicTurbulenceModel::transportModel transportModel;
          
          
          //- Runtime type information
          TypeName("WALE");
          
          
          // Constructors
          
              //- Construct from components
              WALE
              (
                  const alphaField& alpha,
                  const rhoField& rho,
                  const volVectorField& U,
                  const surfaceScalarField& alphaRhoPhi,
                  const surfaceScalarField& phi,
                  const transportModel& transport,
                  const word& propertiesName = turbulenceModel::propertiesName,
                  const word& type = typeName
              );
          
          
          //- Destructor
          virtual ~WALE()
          {}
          
          
          // Member Functions
          
              //- Read model coefficients if they have changed
              virtual bool read();
          
              //- Return SGS kinetic energy
              virtual tmp<volScalarField> k() const
              {
                  return k(fvc::grad(this->U_));
              }
          
              //- Return sub-grid disipation rate
              virtual tmp<volScalarField> epsilon() const;
          
              //- Correct Eddy-Viscosity and related properties
              virtual void correct();
          

          };

          // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

          } // End namespace LESModels
          } // End namespace Foam

          // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

          #ifdef NoRepository
          #include "WALE.C"
          #endif

          // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

          #endif

          // ************************************************************************* //

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