Skip to content

OpenFOAM

OpenFOAM交流区

4.5k 主题 26.5k 帖子
  • 动态接触角的问题

    35
    35 帖子
    10k 浏览

    @peng
    能麻烦您分享一下fluent中动态接触角的udf吗,最近在研究凝结换热的问题,不知道怎么描述生成的液滴接触角,十分感谢!

    邮箱 1653666461@qq.com

  • 一个 scalar 等于多少个字节?

    3
    3 帖子
    813 浏览
    Y

    懂了。谢谢大佬

  • 请教各位大佬,有关chtMultiRegionFoam求解器

    1
    1 帖子
    307 浏览
    J

    在chtMultiRegionFoam求解器中,区域是依据polyMesh/set划分的区域还是依据polyMesh/cellzones划分的?怎么对不同区域进行物性参数的定义?

  • 如何监测边界与平面相交线的参数

    4
    4 帖子
    836 浏览
    F

    @李东岳 感谢老师的回答,抱歉才看到回信,最终解决办法是强制读取边界信息,检测距离边界最近的网格点数据并给出。黄色震荡部分是因为插值了内部网格点和边界值的结果。

  • LES-WALE中Ksgs如何求解

    3
    3 帖子
    1k 浏览
    香柏树

    谢谢李老师,我参考您链接里的方法改了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

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

  • particle erosion函数

    3
    3 帖子
    704 浏览

    @星星星星晴 非常感谢!

  • wedge几何体下setFields的用法

    7
    7 帖子
    3k 浏览
    thegameT

    @韬智tz 谢谢

  • 新湍流模型中如何使用温度和比热等

    1
    1 帖子
    351 浏览
    S

    在一个可压缩热喷流模拟中需要修改k-epsilon模型 引入温差和可压缩性的影响,需要用到温度、可压缩性等,请问怎么在原k-epsilon模型类里使用这些量微信图片_20220322153039.png
    原模型Cmu是个常数 修改后应该是一个场量
    具体一点的问题就是thermo.gamma()怎么接入湍流模型这个类里呢

  • 两类pEqn.H求解可压缩流动计算时稳定性问题

    已移动
    3
    3 帖子
    2k 浏览
    李东岳

    乍一看,三年过去了

    http://dyfluid.com/buoyantSimpleFoam.html

    在真正开始pimple循环后,EEqn.H末尾有一个thermo.correct()。这一步根据计算后的能量场,更新了温度、粘度、可压缩比(psi)等等物性,所以在pEqn.H的开头,出现了一步rho = thermo.rho(),实际上进行了更新密度的操作(rho = psi * p,注意这个时候psi已经变了),之后再进行压力的求解。

    最近更新了这个,尤其是关于两个密度更新的问题的讨论。不可压缩流速度修正与压力变量直接相关。但是附加浮力之后,速度修正与压力变量以及密度变量(浮力)直接相关。我赞同上面的理解。同时,能量方程之后的密度更新可有可无,只不过是收敛性的问题。

  • snappyHexMesh

    1
    1 帖子
    350 浏览
    G

    使用snappyHexMesh画网格,利用检查网格显示一个地方错误,有扭曲的曲面微信图片_20220321211715.jpg
    但是打开paraview没有看到明显的错误,这应该从什么方面去检查模型?

  • 15 帖子
    2k 浏览
    J

    @thegame 我看之前老师回答我的是要用splitMeshRegions命令将网格分开,请问你知道toposet命令的具体操作吗?我才接触这个openfoam,不是很熟练。

  • 3 帖子
    731 浏览

    @一颗鸭蛋

    尝试过docker 没弄明白 当时M1还没适配docker 后来也懒得弄了
    我是用parallel 装的ubuntu arm 自己编译的,跑的起来完全没问题。
    跑分里面的M1 就是我的mini

  • 4 帖子
    859 浏览

    @tens 哦哦,这就说得过去了,看起来这个应该是用来定义辐射换热计算边界条件的一个引入参数,看输入像是隐式计算辐射换热量和显式计算辐射换热量的区别

  • 14 帖子
    6k 浏览
    L

    Openfoam extend 4.0可以使用DensityBasedTurbo吗?

  • AlphaCo问题

    3
    3 帖子
    739 浏览

    @tens 明白了,十分感谢!

  • 动态库的链接

    8
    8 帖子
    1k 浏览
    S

    @疏影横斜水清浅
    谢谢回复,是的,预计和你问题一样的,我正在重新检查代码,编译器不报错的话,只能一行行自己排查吗?

  • 如何将cloud中添加的新变量在结果文件中输出

    1
    1 帖子
    347 浏览

    各位好
    仿照kinematiccloud中的函数Dij,写了一个新的函数Sum,用来计算当前时间步流场中所有粒子的某个属性之和(如直径之和)。
    那么如果我想用DPMFoam求解器,并且想在最终的结果文件中将新添加的函数Sum的计算结果输出出来,应该怎么做呢?
    这个函数输出的值应该算作粒子属性还是场的属性呢?
    谢谢各位!

  • 拉格朗日库中添加新变量失败

    3
    3 帖子
    689 浏览

    @星星星星晴 老师我最近开始做本科毕设了,非常感谢您的帮助和耐心讲解。后面可能还有知识要请教您,万分感谢!

  • 如何调用粒子位置

    8
    8 帖子
    1k 浏览

    @星星星星晴 谢谢老师的耐心讲解!:xinxin:

  • 5 帖子
    909 浏览
    风大仙

    @星星星星晴 好的,感谢您的指点!