Skip to content

OpenFOAM

OpenFOAM交流区

5.3k 主题 31.5k 帖子
  • 如何在docker上同时运行python和open foam

    4
    4 帖子
    3k 浏览
    bestucanB

    这里有介绍:link text

    类似的需求:

    How do I add some other package to the container?

    The easiest way is to modify your Dockerfile and rebuild. Particularly easy if the software you want to add has an Ubuntu deb package.

    里面也有 docker file 的示例。看起来这个比较可行

    没有经验,一直在 linux 上跑

  • 迎风格式在interface上是否是间断的?

    3
    3 帖子
    2k 浏览
    M

    @李东岳 懂了,谢谢李老师

  • 关于压力松弛因子的疑问

    8
    8 帖子
    8k 浏览
    李东岳

    应该研究下为什么transonic需要提升对角占优

    @李东岳 回答一下自己的问题。transonic下的压力方程存在对流项,对流项不利于对角占优矩阵的产生,因此transonic的压力方程要增加方程松弛。

    http://dyfluid.com/rhoSimpleFoam.html

  • 4 帖子
    3k 浏览
    C

    @ruibin_tongji
    Green-Gauss Cell Based
    9f30b62e-ad51-4bd3-ad87-c12ce78f2194-image.png
    Least Squares Cell Based
    8e14d4c0-98f9-4866-b57a-05a79fe25109-image.png
    Green-Gauss Cell Based是最粗暴最直接的,但也许恰好适用于结构网格?我看这个Theory Guide里面是这么说的
    38584698-16af-4fa1-8327-194895b34791-image.png

    有没有测试过对流项的格式?

  • 在Openfoam中新加入weno格式

    14
    14 帖子
    11k 浏览
    S

    @李东岳 几万还是可以算的 几百万的网格我40核的服务器就算不动了

  • OF后处理中forceCoeffs的几个概念求教

    1
    1 帖子
    1k 浏览
    A

    想请教各位,我对OF后处理中力系数forceCoeffs中的几个概念不太能理解,想请教一下各位。

    forceCoeffs { type forceCoeffs; libs ( "libforces.so" ); writeControl timeStep; writeInterval 1; patches ( "floatingObject" ); rho rhoInf; log true; rhoInf 1000; liftDir (0 0 1); //升力方向 dragDir (0 0 1); //拖曳力方向 CofR (5 5 2); //用于计算力矩的点 pitchAxis (0 0 1); //pitch方向,围绕转动的轴 magUInf 0; //无限远处来流处的速度 lRef 2; //参考长度 Aref 8; //参考面积 }

    首先这里对liftDir升力和dragDir拖曳力的定义是怎样的 ?举个例子,如果模拟的是一个物体在水中匀速运动,升力可否理解为浮力?那这里的拖曳力又是指什么呢?
    还是这个例子,pitchAxis解释为围绕转动的轴,这又是指什么?另外如果在静水中运动,那magUInf可以设置为0吗?lRef和Aref是相对谁的参考呢,计算域吗?

  • codedFixedValue边界条件编译成功,但没计算结果

    6
    6 帖子
    4k 浏览
    D

    @李东岳 是个稳态计算过程,不随时间变化,但是公式中r值更新会影响边界的U的值

  • 输出时间步不对

    8
    8 帖子
    5k 浏览
    李东岳

    @yu_tian 你这个看起来怎么没有读取controlDict呢,设置的跟读写的不一样

  • 拉格朗日粒子追踪死循环

    14
    14 帖子
    9k 浏览

    @jqbu minParcelMass 在你这个1e-20的话 大概算出来是3.91486764×10−7 不知道你有没有什么地方设置过vsmall 还有rootvsmall,作为filter,可能有问题吧 不好说。

    另外如果parcel太小,有可能也被trap到某个涡里。看看调整一下你的Euler time step 还有maxco试试
    impinging的流场比较复杂 jet?你先调整试试看one-way 限制尺寸大一点。

  • wallShearStress函数量纲问题咨询

    7
    7 帖子
    5k 浏览

    @李东岳 好的,我明白啦,感谢李老师~::xinxin:

  • 6 帖子
    2k 浏览
    L

    1cbfc0cf-4f43-4883-ade9-90274c8b99fb-image.png 14da2f9f-5109-439a-b87e-2d737b126936-image.png
    已安装openfoam-extend4.0编译成功,使用Allmake再编译密度基src文件时报错如下图
    2df90e72-839b-4602-98b6-23a706449938-image.png

    051583eb-9b9a-49b3-8dd2-aaa6ba1076ce-image.png 红圈部分文件在所有文件中未找到。请大神指点一下

  • icoFoam运算出错

    8
    8 帖子
    3k 浏览
    Z

    @李东岳 好的,谢谢李老师

  • particle erosion函数

    2
    2 帖子
    1k 浏览
    bestucanB

    在这个地方右上角搜你想要知道的函数
    https://www.openfoam.com/documentation/guides/v2112/doc/

  • 动网格库中如何增加使用运行时间runtime的功能

    6
    6 帖子
    3k 浏览
    A

    @tens 感谢您的回复,我试着把这个头文件加入到.C文件中,但是对编译结果貌似并没有作用,报错是一样的。已经把我觉得可能能用到的头文件都放进去了:135:

    #include "mylinearSpring.H" #include "addToRunTimeSelectionTable.H" #include "sixDoFRigidBodyMotion.H" // Foam classes #include "OFstream.H" #include "IFstream.H" #include "Vector.H" // std classes #include <stdio.h> #include <fstream> #include <iostream> #include <string.h> #include <stdlib.h> #include "pointPatchFields.H" #include "addToRunTimeSelectionTable.H" #include "Time.H" #include "polyMesh.H" #include "fixedValuePointPatchField.H" #include "fvCFD.H" #include "fvMesh.H" #include "volFields.H"
  • 关于相邻cell

    8
    8 帖子
    6k 浏览

    @星星星星晴 本来没想到这么慢,结果发现假如我有1M parcel,1M cell 就要搞1M x 1M次, 实在有点笨。然后现在改为之前那个方法了。。 可能是当时不知道怎么回事有点脑残吧,搞错了,相邻cell一层一层搞出来快很多。。 下面是code, 编程能力有限,想搞成个function,总觉得麻烦。。不过改成function的话应该可以弄n层了吧。。

    还是python好写。。。

    if (neighbor_) { //Info << "cellI = " <<cellI<<nl; //- first layer List<int> first = this->owner().mesh().cellCells()[cellI]; first.append(cellI); sort(first); all_neighbor.append(first); int first_size = first.size(); //Info << "cellI = " << first <<nl; //- second layer List<int> second_all; for (int i1 = 0; i1<first_size; i1++){ List<int> second = this->owner().mesh().cellCells()[first[i1]]; //Info << "cellI second = " << second <<nl; second_all.append(second); } List<int> order,second_unique; uniqueOrder(second_all, order); forAll(order,kk) { second_unique.append(second_all[order[kk]]); } sort(second_unique); all_neighbor.append(second_unique); //- third layer List<int> third_all; for (int i1 = 0; i1<second_unique.size(); i1++){ List<int> third = this->owner().mesh().cellCells()[second_unique[i1]]; //Info << "cellI third = " << third <<nl; third_all.append(third); } List<int> order3,third_unique; uniqueOrder(third_all, order3); forAll(order3,kk) { third_unique.append(third_all[order3[kk]]); } sort(third_unique); all_neighbor.append(third_unique); //- Fourth layer List<int> fourth_all; for (int i1 = 0; i1<third_unique.size(); i1++){ List<int> fourth = this->owner().mesh().cellCells()[third_unique[i1]]; fourth_all.append(fourth); } List<int> order4,fourth_unique; uniqueOrder(fourth_all, order4); forAll(order4,kk) { fourth_unique.append(fourth_all[order4[kk]]); } sort(fourth_unique); all_neighbor.append(fourth_unique); //- collect all List<int> order_all; uniqueOrder(all_neighbor, order_all); forAll(order_all,kk) { all_neighbor_unique.append(all_neighbor[order_all[kk]]); } sort(all_neighbor_unique);
  • 3 帖子
    3k 浏览

    @李东岳 多谢李老师回复。上传的结果是关闭Decompose polyhedra选项后的结果,Tecplot里面也是这种情况。用的是2D的问题,采用的是选择x、y方向加密的方式。

    在源码里看到refineMesh调用了cutDirToEdge,其中加密方向是根据单元边选择方向的关系判断加密的方向(下图的cosAngle,maxEdgeI)。O型网格按照这样处理的方式,处于圆柱上方的网格和后方的网格加密的方向是不一致的(第二张图片是只加密x方向的结果,网格的加密方式不一样了)。不知道是否可以通过设置参数进行控制?

    845840da-6fb4-4df4-8d1d-59871760b046-image.png

    3a078fc9-11f2-4e2c-bc86-9baa876c65fd-image.png

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

    3
    3 帖子
    2k 浏览
    Y

    懂了。谢谢大佬

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

    1
    1 帖子
    940 浏览
    J

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

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

    4
    4 帖子
    3k 浏览
    F

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

  • LES-WALE中Ksgs如何求解

    3
    3 帖子
    3k 浏览
    香柏树

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

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