Skip to content

OpenFOAM

OpenFOAM交流区

5.3k 主题 31.3k 帖子
  • 如何提取张量的某一个值

    6
    6 帖子
    5k 浏览
    bestucanB

    @小考拉

    不忙不忙,就是不太懂:mihu:
    但是探索不懂的东西的方法都是相通的。你要解决的问题我没解决过,所以要解决花费的时间比较多。思路就是看代码。你也在看,但我们看的版本对不上,开源软件有个特点,太自由了,所以版本间的差距特别大。

    在你的代码中找相关定义的方法:

    grep -R 'volTensorField' ./

    先用 cd 命令 切换到源代码所在的目录 ~/OpenFOAM/OpenFOAM-version/
    然后运行上面的那条命令。-R 是递归查找,包括子文件夹,'volTensorField' 是查找的内容,区别大小写, ./代表当前路径。

    另外,在 ~/OpenFOAM/OpenFOAM-version/里查,查的太多。可以分别去这个文件夹下的src或者applications下面查。如果还是太多,就把输出重定向到一个文件再看。不过没颜色不太好看。

    grep -R 'volTensorField' ./ > grep.log
  • The influence of mesh on solution?

    3
    3 帖子
    2k 浏览
    K

    Thanks. I created two meshes with the same body size but different type of meshes,namely structured and unstructured, the results are different. Note that both of two cases are grid independent. Do you have any idea about that ? since I saw a thread you opened in cfd online.

  • reactingFoam, 如何计算每个基元反应的反应速率

    2
    2 帖子
    3k 浏览
    C

    您好,请问您最后解决了嘛,怎么样输出每个基元反应的速率呀

  • 10 帖子
    6k 浏览

    @King_RVM 没错的问题就在乱用了tmp指针,我已经解决了。关于tmp指针,我在网上搜索到过问题,祝好!

  • 关于调用 库函数的报错

    7
    7 帖子
    5k 浏览

    我当时是由于湍流模型虽然编译通过但其实还是有问题的,具体就是H文件申明的虚函数divDevRhoReff,在C文件中没有具体的实现。你可以根据H文档最后几个虚函数(virtual函数)再好好对照一下看看C文档中是否都有对应的具体实现。其次我是2.3.1版本。

  • 提取场内一个面的物理量 Function Obj 的方法

    1
    1 帖子
    1k 浏览
    L

    请教大家:
    提取场内一个面的物理量 Function Obj 的方法
    谢谢

    另外:
    本人原帖 “湍流模型问题请教” 得各位相助, @闻久STU 君 "回访",李博 @东岳 赐"西语句",为不在原贴用回谢灌水,在此一并谢过

  • CFL数如何计算?

    6
    6 帖子
    8k 浏览
    Y

    谢谢,学习到啦!

  • 关于传热边界条件的问题

    2
    2 帖子
    2k 浏览
    C

    这个求解器是不可压缩的求解器,他单独求解温度方程,没有用用到热物理模型库,所以就不支持这个边界条件,fluidThermo是热物理模型库的方法。
    你可以去看看buoyantPimpleFoam或buoyantSimpleFoam下面的算例,这些算例的constant文件夹下都有thermophysicalProperties这个字典,这些求解器也都用到了热物理模型库求解焓方程,并且支持这个边界条件。

  • 4 帖子
    3k 浏览
    C

    或许可以将代码改为用不可压缩求解器求解的边界上的温度和导热率来获得,边界上的传热量。例如:

    if(db().foundObject<volScalarField>("T")) { const volScalarField& T = db().lookupObject<volScalarField>("T"); const fvPatchScalarField& Tp = T.boundaryField()[patchi]; qDot = kappa*Tp.snGrad(); }

    其中kappa需要根据你的物性和边界上的温度场来计算获得

  • jet 的边界条件如何选择?

    13
    13 帖子
    8k 浏览

    @hotairballon1997 算吧 不过不是map,我个人觉得不要轻易用map这个人东西。。因为网格密度不同,map出来的场可能是有问题的

  • 记录一些自己用过的代码

    6
    6 帖子
    8k 浏览
    同学博

    亲测实用:140:

  • 单相可压缩流体湍流模型修改后的编译问题

    2
    2 帖子
    2k 浏览
    King_RVMK

    已经解决。我的makeTurbulenceModel.C文件中namespace Foam的
    typedef RASModel<EddyDiffusivity<turbulenceModel>> RASfluidThermoCompressibleTurbulenceModel;
    typedef LESModel<EddyDiffusivity<turbulenceModel>>
    LESfluidThermoCompressibleTurb
    应该改成
    typedef RASModel<EddyDiffusivity<fluidThermoCompressibleTurbulenceModel>> RASfluidThermoCompressibleTurbulenceModel;
    typedef LESModel<EddyDiffusivity<fluidThermoCompressibleTurbulenceModel>> LESfluidThermoCompressibleTurb

  • 如何给速度分量设置边界条件?

    7
    7 帖子
    5k 浏览
    V

    @Samuel-Tu 好的,多谢提醒~cfdonline有这两个边界条件差异的讨论。
    https://www.cfd-online.com/Forums/openfoam-programming-development/180412-slip-symmetry-boundary-conditions.html

  • 颗粒的全局ID输出问题?

    6
    6 帖子
    5k 浏览
    F

    @zhangxc0223 我不清楚你怎么做的,不过我刚发现可以在paraview中可以显示粒子ID,随着时间步推移,好像每个粒子的ID号是不变的,这样就可以通过后处理输出某个固定ID的各个时间步的信息了,可以交流下

  • 9 帖子
    7k 浏览
    上级

    @BlookCFD 谢谢您的指点,我有看了一眼程序,我理解错了,OF里面是通过计算barycentric displacement来获得barycentric coordinates的,我一直被src/lagrangian/basic/particle/particle.C里面的一句代码给误导了,现贴出来:

    particle.C 1062-1096 OpenFOAM6 void Foam::particle::correctAfterInteractionListReferral(const label celli) { // Get the position from the barycentric data const vector pos(coordinates_.b(), coordinates_.c(), coordinates_.d()); // Create some arbitrary topology for the supplied cell celli_ = celli; tetFacei_ = mesh_.cells()[celli_][0]; tetPti_ = 1; facei_ = -1; // Get the reverse transform and directly set the coordinates from the // position. This isn't likely to be correct; the particle is probably not // in this tet. It will, however, generate the correct vector when the // position method is called. A referred particle should never be tracked, // so this approximate topology is good enough. By using the nearby cell we // minimize the error associated with the incorrect topology. coordinates_ = barycentric(1, 0, 0, 0); if (mesh_.moving()) { Pair<vector> centre; FixedList<scalar, 4> detA; FixedList<barycentricTensor, 3> T; movingTetReverseTransform(0, centre, detA, T); coordinates_ += (pos - centre[0]) & T[0]/detA[0]; } else { vector centre; scalar detA; barycentricTensor T; stationaryTetReverseTransform(centre, detA, T); coordinates_ += (pos - centre) & T/detA; } }

    其中的这句代码

    coordinates_ += (pos - centre) & T/detA;

    其实前面已经先定义了

    coordinates_ = barycentric(1, 0, 0, 0);

    后面计算单点的barycentric coordinates其实还是用的barycentric displacement的概念来转换的。

    困扰了我两周的问题终于解决了,现在异常开心,在此对@东岳 和@BlookCFD 表示万分感谢。

  • time step continuity errors

    10
    10 帖子
    10k 浏览
    李东岳

    time step continuity error是正常的,表示连续性误差

  • 在质量守恒方程中添加源项对湍动能的影响

    12
    12 帖子
    8k 浏览
    C

    @cccrrryyy

    行我再考虑下,谢谢

  • CFDEM安装

    9
    9 帖子
    6k 浏览
    J

    @fubianhanshu My pleasure

  • 4 帖子
    3k 浏览
    S

    codeFixedValue

  • 如何导入*.dat文件的网格

    1
    1 帖子
    1k 浏览
    wuyukaiW

    请问一下,有哪位大佬用过datToFoam这个命令吗,*.dat文件需要写成什么格式呢?