Skip to content

OpenFOAM

OpenFOAM交流区

4.6k 主题 26.6k 帖子
  • 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 帖子
    735 浏览
    杨英狄

    @星星星星晴 非常感谢!

  • wedge几何体下setFields的用法

    7
    7 帖子
    3k 浏览
    thegameT

    @韬智tz 谢谢

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

    1
    1 帖子
    364 浏览
    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 帖子
    365 浏览
    G

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

  • 15 帖子
    3k 浏览
    J

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

  • 3 帖子
    848 浏览

    @一颗鸭蛋

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

  • 4 帖子
    982 浏览

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

  • 14 帖子
    6k 浏览
    L

    Openfoam extend 4.0可以使用DensityBasedTurbo吗?

  • AlphaCo问题

    3
    3 帖子
    830 浏览

    @tens 明白了,十分感谢!

  • 动态库的链接

    8
    8 帖子
    2k 浏览
    S

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

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

    1
    1 帖子
    356 浏览
    杨英狄

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

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

    3
    3 帖子
    721 浏览
    杨英狄

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

  • 如何调用粒子位置

    8
    8 帖子
    1k 浏览
    杨英狄

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

  • 5 帖子
    1k 浏览
    风大仙

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

  • 计算服务器的问题

    7
    7 帖子
    1k 浏览
    S

    @xpqiu

    PATH=/usr/lib64/openmpi/bin:/home/xry/OpenFOAM/xry-2112/platforms/linux64GccDPInt32Opt/bin:/usr/lib/openfoam/openfoam2112/site/2112/platforms/linux64GccDPInt32Opt/bin:/usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/bin:/usr/lib/openfoam/openfoam2112/bin:/usr/java/jre1.8.0_151/bin:/opt/tsce4/maui/sbin:/opt/tsce4/maui/bin:/opt/tsce4/torque6/bin:/opt/tsce4/torque6/sbin:/usr/local/bin:/opt/software/openmpi/bin:/usr/mpich/bin:/usr/bin:/usr/local/sbin:/usr/sbin:.:/home/xry/.local/bin:/home/xry/bin LD_LIBRARY_PATH=/home/xry/OpenFOAM/xry-2112/platforms/linux64GccDPInt32Opt/lib:/usr/lib/openfoam/openfoam2112/site/2112/platforms/linux64GccDPInt32Opt/lib:/usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/sys-openmpi:/usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib:/usr/lib/openfoam/openfoam2112/ThirdParty/platforms/linux64GccDPInt32/lib/sys-openmpi:/usr/lib/openfoam/openfoam2112/ThirdParty/platforms/linux64GccDPInt32/lib:/usr/lib64/openmpi/lib:/usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/dummy:/opt/software/openmpi/lib:/software/openmpi/lib:/usr/mpich/lib:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr-4.1.0/lib linux-vdso.so.1 => (0x00007ffce15f4000) libfiniteVolume.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so (0x00007faff29f9000) libfvOptions.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libfvOptions.so (0x00007faff2583000) libmeshTools.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so (0x00007faff1c79000) libsampling.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libsampling.so (0x00007faff1568000) libdynamicFvMesh.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libdynamicFvMesh.so (0x00007faff12ad000) libincompressibleTransportModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libincompressibleTransportModels.so (0x00007faff101a000) libinterfaceProperties.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libinterfaceProperties.so (0x00007faff0d9c000) libimmiscibleIncompressibleTwoPhaseMixture.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libimmiscibleIncompressibleTwoPhaseMixture.so (0x00007faff0b91000) libturbulenceModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libturbulenceModels.so (0x00007faff073a000) libincompressibleTurbulenceModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libincompressibleTurbulenceModels.so (0x00007faff02a7000) libwaveModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libwaveModels.so (0x00007fafeffd5000) libVoFphaseTurbulentTransportModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libVoFphaseTurbulentTransportModels.so (0x00007fafefc15000) libincompressibleInterPhaseTransportModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libincompressibleInterPhaseTransportModels.so (0x00007fafefa12000) libOpenFOAM.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so (0x00007fafeeca9000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fafeeaa5000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fafee79d000) libm.so.6 => /lib64/libm.so.6 (0x00007fafee49b000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fafee285000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fafee069000) libc.so.6 => /lib64/libc.so.6 (0x00007fafedc9c000) libPstream.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/sys-openmpi/libPstream.so (0x00007fafeda81000) libfileFormats.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libfileFormats.so (0x00007fafed6c5000) libsurfMesh.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libsurfMesh.so (0x00007fafed287000) libfluidThermophysicalModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libfluidThermophysicalModels.so (0x00007fafecac0000) libsolidThermo.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libsolidThermo.so (0x00007fafec7c2000) libcompressibleTurbulenceModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libcompressibleTurbulenceModels.so (0x00007fafec2eb000) libdynamicMesh.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libdynamicMesh.so (0x00007fafebbc5000) liblagrangian.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/liblagrangian.so (0x00007fafeb980000) libtwoPhaseMixture.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libtwoPhaseMixture.so (0x00007fafeb766000) libtwoPhaseProperties.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libtwoPhaseProperties.so (0x00007fafeb519000) libspecie.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libspecie.so (0x00007fafeaea1000) libz.so.1 => /lib64/libz.so.1 (0x00007fafeac8b000) /lib64/ld-linux-x86-64.so.2 (0x00007faff511c000) libmpi.so.12 => /usr/lib64/openmpi/lib/libmpi.so.12 (0x00007fafea9a7000) libcompressibleTransportModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libcompressibleTransportModels.so (0x00007fafea7a3000) libthermophysicalProperties.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libthermophysicalProperties.so (0x00007fafea466000) libsolidSpecie.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libsolidSpecie.so (0x00007fafea234000) libreactionThermophysicalModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libreactionThermophysicalModels.so (0x00007fafe940c000) libradiationModels.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libradiationModels.so (0x00007fafe9052000) libextrudeModel.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libextrudeModel.so (0x00007fafe8e22000) libopen-rte.so.12 => /usr/lib64/openmpi/lib/libopen-rte.so.12 (0x00007fafe8ba6000) libopen-pal.so.13 => /usr/lib64/openmpi/lib/libopen-pal.so.13 (0x00007fafe8902000) librt.so.1 => /lib64/librt.so.1 (0x00007fafe86fa000) libutil.so.1 => /lib64/libutil.so.1 (0x00007fafe84f7000) libhwloc.so.5 => /lib64/libhwloc.so.5 (0x00007fafe82ba000) libSLGThermo.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libSLGThermo.so (0x00007fafe80b2000) libdistributed.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libdistributed.so (0x00007fafe7e37000) libblockMesh.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libblockMesh.so (0x00007fafe7b93000) libnuma.so.1 => /lib64/libnuma.so.1 (0x00007fafe7987000) libltdl.so.7 => /lib64/libltdl.so.7 (0x00007fafe777d000) libdecompositionMethods.so => /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/lib/libdecompositionMethods.so (0x00007fafe74ec000)
  • 粒子求解器如何实现将粒子的性质加和

    6
    6 帖子
    1k 浏览
    杨英狄

    @星星星星晴 非常感谢!

  • 请问如何理解这一项?

    5
    5 帖子
    1k 浏览
    C

    @bestucan 在 请问如何理解这一项? 中说:

    我猜是任意方向的加速度。

    速度本身是矢量,做梯度就是个二阶张量了,前后乘以n和n的转置,应该是类似于对角化操作(基于某方向的对角化)。把各方向的加速度解耦出来,使之不在其他方向有分量。

    这个“任意方向”就是右边那项分母上n的方向,咦,n就是法向哈:chouchou:

    那应该就是了

    但是要注意右边那项分子,速度有下标的,应该是n方向上的速度。
    那这一项的意义应该是:“n方向上的速度,在n方向的加速度”

    这也和左边对角化操作印证,嗯,就这么猜:xiezuoye:

    理解了,这项应该是一个标量,即“沿自由表面法向的加速度”。

    我水平有限,还是需要多研究。

    非常感谢您的不吝赐教!

  • OpenFOAM被收购

    1
    1 帖子
    529 浏览
    C

    刚听说open foam被esi收购了?