Skip to content

OpenFOAM

OpenFOAM交流区

5.2k 主题 31.0k 帖子
  • 并行计算出错?

    3
    3 帖子
    2k 浏览
    Y

    @我是河滩 请问您这个问题解决了吗?我最近也遇到了同样的问题

  • 往cellZone里面添加网格

    4
    4 帖子
    2k 浏览
    马乔

    或者你应该在intU[1]=...之前加个if(cellID > -1).

  • 绘制流线图

    1
    1 帖子
    886 浏览

    想问一下,在绘制二维截面的流线图时,在paraview中以列表形式导出了点的数据,存在以下疑问:
    ①列表中各列数据代表什么含义,比如normals,integrationtime,point ID?
    ②各点为什么会有block number之分?block number是什么含义?
    ③能否通过列表数据做出流线图?
    ④保存数据时,为什么每个时刻的列表文件会被保存成2个csv文件?
    以上问题求指教
    3e5026fe-ea05-4101-86ee-b5ad8e43bfad-1666618809(1).png

  • 1 帖子
    976 浏览
    C

    刚接触OpenFOAM,安装的是OpenFOAM-v2206,了解到需要用pisofoam或者pimpleFoam求解器,貌似在tutorials里面没有现成的NACA翼型低速绕流大涡模拟不可压并行算例。

  • 计算出现负相率和负湍动能

    13
    13 帖子
    9k 浏览
    C

    @cyberk 抱歉,这个问题我没有遇到过,但我看了你之前用ICEM画的网格,这个六叶Ruston桨的搅拌槽的网格不太复杂的呀,这个你可以试试只画1/6个区域,然后对称过去,画完整体之后再去openfoam中用topoSet划分搅拌的区域

  • 关于komegaSSTLM四方程模型

    5
    5 帖子
    3k 浏览
    C

    @李东岳
    谢谢老师,虽然只是一个小建议和思路,却给我节约了大量的时间,目前已经在OF7中调通了mutiphaseInterFoam求解器。:xiexie:

  • 颗粒碰撞聚合

    4
    4 帖子
    3k 浏览
    bestucanB

    @hotairballon1997

    在您回帖的链接中好像没有看到关于这个问题的解答,

    对呀,要分类讨论,就像你说的,是用 PBM,还是拉格朗日。
    我发的那个链接里 MPPIC 和 DPMFoam 中用到的粒子都是粒子包(particle parcel),这种用粒子包去代替粒子的方法我没了解过,但肯定已经不是物理粒子了。所以要看哪个层面,哪种模型的碰撞聚合了。

  • 场量的直接运算和forAll循环的区别

    3
    3 帖子
    2k 浏览
    vbcwlV

    @李东岳 感谢东岳前辈

  • cavity算例

    3
    3 帖子
    2k 浏览

    @李东岳 已经解决,多谢李老师

  • openfoam 安装失败

    27
    27 帖子
    16k 浏览
    W

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

  • 如何在src文件中创建标量物理filed并且调用

    27
    27 帖子
    16k 浏览
    chengan.wangC

    @李东岳 非常感谢李老师,终于搞定,能输出数据了,但还需要进一步验证是否正确。差点放弃想升级新版本of。

    volScalarField& summass = const_cast<volScalarField&>(p.mesh().objectRegistry::lookupObject<volScalarField>("summass")); const label cellIp = p.cell(); scalar& PPC = summass.internalField() [cellIp]; PPC += p.nParticle()*p.mass();

    希望对以后需要的朋友有点借鉴作用。特别感谢 @星星星星晴 不厌其烦的解答:146:

  • DPMFoam求解器加颗粒导致发散

    8
    8 帖子
    5k 浏览
    疏影横斜水清浅

    @杨英狄 好的,谢谢,我试一试

  • 计算时间

    7
    7 帖子
    5k 浏览

    @疏影横斜水清浅 嗯,好的,谢谢您的回复

  • Reynolds stress model植入到twoPhaseEulerFoam

    3
    3 帖子
    2k 浏览
    J

    @李东岳 感谢李老师回复!

  • 2 帖子
    2k 浏览

    速度出口边界条件有问题,改成防止回流的边界条件就可以。

  • 并行后分块分界面那里会导致异常

    3
    3 帖子
    2k 浏览
    vbcwlV

    @vbcwl 原因已经大概确定了,应该是因为求解过程中用到了求解梯度的命令,然后每一块单独计算了梯度,请问这样是否会出现这种可能呢?如果是又该怎么解决呢?

  • OpenFOAM中的pout与reduce

    1
    1 帖子
    1k 浏览
    李东岳
    /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 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 "fvCFD.H" int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" // For a case being run in parallel, the domain is decomposed into several // processor meshes. Each of them is run in a separate process and holds // instances of objects like mesh, U or p just as in a single-threaded (serial) // computation. These will have different sizes, of course, as they hold // fewer elements than the whole, undecomposed, mesh. // Pout is a stream to which each processor can write, unlike Info which only // gets used by the head process (processor0) Pout << "Hello from processor " << Pstream::myProcNo() << "! I am working on " << mesh.C().size() << " cells" << endl; // To exchange information between processes, special OpenMPI routines need // to be called. // This goes over each cell in the subdomain and integrates their volume. scalar meshVolume(0.); forAll(mesh.V(),cellI) meshVolume += mesh.V()[cellI]; // Add the values from all processes together Pout << "Mesh volume on this processor: " << meshVolume << endl; reduce(meshVolume, sumOp<scalar>()); Info << "Total mesh volume on all processors: " << meshVolume // Note how the reudction operation may be done in place without defning // a temporary variable, where appropriate. << " over " << returnReduce(mesh.C().size(), sumOp<label>()) << " cells" << endl; // During the reduction stage, different operations may be carried out, summation, // described by the sumOp template, being one of them. // Other very useful operations are minOp and maxOp. // Note how the type // of the variable must be added to make an instance of the template, here // this is done by adding <scalar> in front of the brackets. // Custom reduction operations are easy to implement but need fluency in // object-oriented programming in OpenFOAM, so we'll skip this for now. // Spreading a value across all processors is done using a scatter operation. Pstream::scatter(meshVolume); Pout << "Mesh volume on this processor is now " << meshVolume << endl; // It is often useful to check the distribution of something across all // processors. This may be done using a list, with each element of it // being written to by only one processor. List<label> nInternalFaces (Pstream::nProcs()), nBoundaries (Pstream::nProcs()); nInternalFaces[Pstream::myProcNo()] = mesh.Cf().size(); nBoundaries[Pstream::myProcNo()] = mesh.boundary().size(); // The list may then be gathered on the head node as Pstream::gatherList(nInternalFaces); Pstream::gatherList(nBoundaries); // Scattering a list is also possbile Pstream::scatterList(nInternalFaces); Pstream::scatterList(nBoundaries); // It can also be useful to do things on the head node only // (in this case this is meaningless since we are using Info, which already // checks this and executes on the head node). // Note how the gathered lists hold information for all processors now. if (Pstream::master()) { forAll(nInternalFaces,i) Info << "Processor " << i << " has " << nInternalFaces[i] << " internal faces and " << nBoundaries[i] << " boundary patches" << endl; } // As the mesh is decomposed, interfaces between processors are turned // into patches, meaning each subdomain sees a processor boundary as a // boundary condition. forAll(mesh.boundary(),patchI) Pout << "Patch " << patchI << " named " << mesh.boundary()[patchI].name() << endl; // When looking for processor patches, it is useful to check their type, // similarly to how one can check if a patch is of empty type forAll(mesh.boundary(),patchI) { const polyPatch& pp = mesh.boundaryMesh()[patchI]; if (isA<processorPolyPatch>(pp)) Pout << "Patch " << patchI << " named " << mesh.boundary()[patchI].name() << " is definitely a processor boundary!" << endl; } // --- // this is an example implementation of the code from tutoral 2 which // has been adjusted to run in parallel. Each difference is highlighted // as a NOTE. // It is conventional in OpenFOAM to move large parts of code to separate // .H files to make the code of the solver itself more readable. This is not // a standard C++ practice, as header files are normally associated with // declarations rather than definitions. // A very common include, apart from the setRootCase, createTime, and createMesh, // which are generic, is createFields, which is often unique for each solver. // Here we've moved all of the parts of the code dealing with setting up the fields // and transport constants into this include file. #include "createFields.H" // pre-calculate geometric information using field expressions rather than // cell-by-cell assignment. const dimensionedVector originVector("x0", dimLength, vector(0.05,0.05,0.005)); volScalarField r (mag(mesh.C()-originVector)); // NOTE: we need to get a global value; convert from dimensionedScalar to scalar const scalar rFarCell = returnReduce(max(r).value(), maxOp<scalar>()); scalar f (1.); Info<< "\nStarting time loop\n" << endl; while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; // assign values to the field; // sin function expects a dimensionless argument, hence need to convert // current time using .value(). // r has dimensions of length, hence the small value being added to it // needs to match that. // Finally, the result has to match dimensions of pressure, which are // m^2 / s^-2/ p = Foam::sin(2.*constant::mathematical::pi*f*runTime.time().value()) / (r/rFarCell + dimensionedScalar("small", dimLength, 1e-12)) * dimensionedScalar("tmp", dimensionSet(0, 3, -2, 0, 0), 1.); // NOTE: this is needed to update the values on the processor boundaries. // If this is not done, the gradient operator will get confused around the // processor patches. p.correctBoundaryConditions(); // calculate velocity from gradient of pressure U = fvc::grad(p)*dimensionedScalar("tmp", dimTime, 1.); runTime.write(); } Info<< "End\n" << endl; return 0; } // ************************************************************************* //
  • 13 帖子
    15k 浏览
    strive_DUTS

    关于OpenFOAM中在采用K-Omega SST模型时,使用/不使用壁面函数的Y+及边界设置问题,可以参考这个链接链接文本,解释的很详细。

  • 不规则波和潜堤

    4
    4 帖子
    3k 浏览
    T

    你好,请问方便加个联系方式交流问题吗?我的QQ账号是973234246

  • 1 帖子
    774 浏览
    vbcwlV

    请问一下做过槽道流传热的前辈,恒定热流密度加热时。壁面的温度rms是从0开始还是2?我看文献里很多都是从0开始的,但是我做出来的是从2开始,而且按照我的理解,近壁面的流体速度不均匀,条带分布的话,带走的热量也不一样,壁面温度肯定不可能均匀啊,那温度RMS也就不应该为0,请问有前辈了解么?