Skip to content

OpenFOAM

OpenFOAM交流区

5.4k 主题 32.0k 帖子
  • 合集:OpenFOAM安装准备工作贴

    已固定
    28
    28 帖子
    45k 浏览
    N

    请问那个含有很多版本的离线的虚拟机,怎么设置共享文件夹啊,VMtools设置了出错呢?

  • OpenFOAM教程 初级入门建议

    已固定
    55
    55 帖子
    207k 浏览
    李东岳

    新版的transportProperties改成了physicalProperties,你改个名

  • 1 帖子
    27 浏览
    R

    各位老师们好,目前我在OpenFOAM-v1912中尝试把一个压力基的拉格朗日两相反应求解器(基于coalChemstryFoam)耦合进detonationFoam(密度基)中。目前编译没有问题,可以顺利通过,但是在测试算例时运行会报错(使用的是NS_Sutherland模型):

    === Start Sensible Enthalpy Transport ==== --> FOAM FATAL ERROR: incompatible fields for operation [rhoE] - [h] From function void Foam::checkMethod(const Foam::fvMatrix<Type>&, const Foam::fvMatrix<Type>&, const char*) [with Type = double] in file /share/home/zhoufan/OpenFOAM/OpenFOAM-v1912/src/finiteVolume/lnInclude/fvMatrix.C at line 1337. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 void Foam::checkMethod<double>(Foam::fvMatrix<double> const&, Foam::fvMatrix<double> const&, char const*) at ??:? #3 Foam::tmp<Foam::fvMatrix<double> > Foam::operator-<double>(Foam::tmp<Foam::fvMatrix<double> > const&, Foam::tmp<Foam::fvMatrix<double> > const&) at ??:? #4 ? at ??:? #5 __libc_start_main in /lib64/libc.so.6 #6 ? at ??:? Aborted (core dumped)

    这里显示动量方程和组分方程求解都没有问题,在求解能量方程时遇到了赋值不统一的问题。
    这是原本detonationFoam中rhoEEqn的代码:

    surfaceScalarField sigmaDotU ( "sigmaDotU", ( fvc::interpolate(muEff)*mesh.magSf()*fvc::snGrad(U) + fvc::dotInterpolate(mesh.Sf(), tauMC) ) & fvc::interpolate(U) ); solve ( fvm::ddt(rhoE) + fvc::div(rhoEPhi) - fvc::div(sigmaDotU) == reaction->Qdot() ); e = rhoE/rho - 0.5*magSqr(U); e.correctBoundaryConditions(); thermo.correct(); rhoE.boundaryFieldRef() == rho.boundaryField()*(e.boundaryField()+0.5*magSqr(U.boundaryField())); solve ( fvm::ddt(rho, e) - fvc::ddt(rho, e) + thermophysicalTransport->divq(e) ); thermo.correct(); rhoE = rho*(e + 0.5*magSqr(U)); p.ref() = rho()/psi(); p.correctBoundaryConditions(); rho.boundaryFieldRef() == psi.boundaryField()*p.boundaryField(); Info<< "min/max(p) = "<< min(p).value() << ", " << max(p).value() << endl; Info<< "min/max(T) = "<< min(T).value() << ", " << max(T).value() << endl;

    这是我修改添加颗粒源项之后的代码:

    clock_t t_begin_h = std::clock(); Info << "=== Start Sensible Enthalpy Transport ====" << endl; auto dt = runTime.deltaT(); surfaceScalarField sigmaDotU ( "sigmaDotU", ( fvc::interpolate(muEff)*mesh.magSf()*fvc::snGrad(U) + fvc::dotInterpolate(mesh.Sf(), tauMC) ) & fvc::interpolate(U) ); solve ( fvm::ddt(rhoE) + fvc::div(rhoEPhi) - fvc::div(sigmaDotU) - fvm::laplacian(turbulence->mut()/Prt + turbulence->alpha(), e) == combustion->Qdot() + AlParcels.Sh(e) + radiation->Sh(thermo, e) ); e = rhoE/rho - 0.5*magSqr(U); e.correctBoundaryConditions(); thermo.correct(); rhoE.boundaryFieldRef() == rho.boundaryField()*(e.boundaryField()+0.5*magSqr(U.boundaryField())); solve ( fvm::ddt(rho, e) - fvc::ddt(rho, e) ); thermo.correct(); radiation->correct(); //add by vv rhoE = rho*(e + 0.5*magSqr(U)); p.ref() = rho()/psi(); p.correctBoundaryConditions(); rho.boundaryFieldRef() == psi.boundaryField()*p.boundaryField(); Info<< "min/max(p) = "<< min(p).value() << ", " << max(p).value() << endl; Info<< "min/max(T) = "<< min(T).value() << ", " << max(T).value() << endl; clock_t t_end_h = std::clock(); double elapsed_secs_h = double(t_end_h - t_begin_h) / CLOCKS_PER_SEC; Info << "=== Sensible Enthalpy Transport [Done]: " << elapsed_secs_h << " s ====\n" << endl;

    想请教一下大家有没有什么更改的建议。

  • 请教贴:k-epsilon湍流模型问题

    2
    2 帖子
    93 浏览
    李东岳

    its really hard to debug according to these information.

  • 9 帖子
    5k 浏览
    A

    @lwjetmann 在 极低雷诺数下,PIMPLE迭代初始残差保持为1,降不下来 中说:

    @李东岳 感觉这个问题挺有意义的,肯定可以从原理上说清楚为啥发散。给的是一个极大的单块网格平动(入口速度零,零法向压力梯度;出口压力零,零速度梯度),一直调不出来就放弃了,可能雷诺数低到某个程度,就不能靠放大计算域来使边界条件匹配了。

    祝李老师上课愉快!

    老哥,这个问题最后解决了吗

  • 4 帖子
    181 浏览
    李东岳

    我推了一下,好像是这个$\nabla\cdot(\nabla\cdot(\bfU\bfU'))$,你验证下?

  • 一个大的stl文件包含小的stl文件画网格问题

    3
    3 帖子
    92 浏览
    N

    @李东岳 在 一个大的stl文件包含小的stl文件画网格问题 中说:

    你最好把外面的大的stl弄个洞出来。shm画网格的时候,如果你的外面的stl是封闭的。就识别不到里面小的stl

    也就是搞一个patch?是嘛?谢谢

  • 请教贴:喷管模拟压力与实验压力值相差较大

    4
    4 帖子
    139 浏览
    李东岳

    https://cfd-china.com/topic/8018/免费帮助debug算例 你看看

  • SnappyHexMesh能否只在xy两个方向上加密网格

    7
    7 帖子
    215 浏览
    C

    如果只是对背景网格进行加密,可以采用topoSet和refinmesh进行加密,也不难

  • 200万网格并行算力测试(OpenFOAM版本)

    235
    235 帖子
    1m 浏览
    2

    @2019201300 又测试了个9950X,双通道6000
    系统:Win虚拟机
    OpenFOAM版本:OpenFOAM-v2212
    16 226.64
    12 171.33
    8 181.91
    4 224.62
    2 286.78
    1 490.17

  • DES涡耗散不足

    7
    7 帖子
    299 浏览
    A

    @李东岳 好,谢谢东岳老师。我问了下,主要原因可能是网格太粗和二维

  • 14 帖子
    5k 浏览
    J

    @lizhisongsjtu 大佬nb 成功解决问题!不然不知道要被卡多久

  • 相变时的界面受力

    1
    1 帖子
    53 浏览
    X

    我想请问一下老师们,我做的是一个自由气液界面的受力分析,如果界面存在蒸发冷凝的相变会不会引起界面受力的变化?

  • 分享CFDEM+OpenFOAM+LIGGGHTS初次编译安装过程

    32
    32 帖子
    32k 浏览
    李东岳
    # output particle properties dump dmp all custom/vtk 5000 post/liggghts_init_*.vtk id type x y z vx vy vz fx fy fz omegax omegay omegaz radius ERROR: Invalid dump style (/home/dyfluid/CFDEM/LIGGGHTS/src/output.cpp:589)

    这个看起来是后处理输出什么变量导致的
    # output particle properties

  • 9 帖子
    5k 浏览
    K

    @qihumeng 可以试试瞬态模拟 主流场稳态后 设置瞬态模拟 并将U、k等稳态量的迭代残差设置为1,即在后续瞬态模拟中不迭代,然后用瞬态的方式模拟颗粒物 直到场内的颗粒物数量稳定?
    我也在尝试稳态模拟dpm 但是发现总是进来多少出去多少 场内留存粒子数为0 ,并且因此没有颗粒物的位置文件夹及函数结果文件,如果采用瞬态则可以正常使用paraView中会出现对应的拉格朗日场

    image.png

  • OpenFOAM libtorch tutorial step by step

    84
    84 帖子
    100k 浏览
    李东岳

    是的,一个整体平均值约束。

    增加神经元看看能不能把GPU拉上100%

  • buoyantBoussinesqSimpleFoam求解器

    3
    3 帖子
    276 浏览
    李东岳

    https://cfd-china.com/topic/8018 可以上传看看

  • 3 帖子
    1k 浏览
    李东岳

    coalChemisryFoam变密度的求解器无法计算常密度的情况吗?

    我确定这个可以。http://dyfluid.com/class.html#id4 我在这个算例里面做的就是一个基本常密度的,附加密度的求解器,压力方程跟coalChemistryFoam压力方程类似,。

    具体coalChemisryFoam这个我不太清楚了。这求解器没玩过。

  • 1 帖子
    129 浏览
    余正东
    模型背景

    我正在使用 OpenFOAM 的 COxidationKineticDiffusionLimitedRate 模型:

    配置如下:(Sb, C1, C2, E),温度约在 1250 K; 从源码可知 dmC 的计算包含 Ap·rhoc、RR·Tc·YO₂/WO₂、D₀·Rₖ/(D₀+Rₖ),其组合单位似乎为 J/m,但源码最终把输出 dmC 当作 碳质量消耗 kg 来处理;
    #include "COxidationKineticDiffusionLimitedRate.H" #include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class CloudType> Foam::COxidationKineticDiffusionLimitedRate<CloudType>:: COxidationKineticDiffusionLimitedRate ( const dictionary& dict, CloudType& owner ) : SurfaceReactionModel<CloudType>(dict, owner, typeName), Sb_(this->coeffDict().getScalar("Sb")), C1_(this->coeffDict().getScalar("C1")), C2_(this->coeffDict().getScalar("C2")), E_(this->coeffDict().getScalar("E")), CsLocalId_(-1), O2GlobalId_(owner.composition().carrierId("O2")), CO2GlobalId_(owner.composition().carrierId("CO2")), WC_(0.0), WO2_(0.0), HcCO2_(0.0) { // Determine Cs ids label idSolid = owner.composition().idSolid(); CsLocalId_ = owner.composition().localId(idSolid, "C"); // Set local copies of thermo properties WO2_ = owner.thermo().carrier().W(O2GlobalId_); const scalar WCO2 = owner.thermo().carrier().W(CO2GlobalId_); WC_ = WCO2 - WO2_; HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_); const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_]; const scalar YSolidTot = owner.composition().YMixture0()[idSolid]; Info<< " C(s): particle mass fraction = " << YCloc*YSolidTot << endl; } template<class CloudType> Foam::COxidationKineticDiffusionLimitedRate<CloudType>:: COxidationKineticDiffusionLimitedRate ( const COxidationKineticDiffusionLimitedRate<CloudType>& srm ) : SurfaceReactionModel<CloudType>(srm), Sb_(srm.Sb_), C1_(srm.C1_), C2_(srm.C2_), E_(srm.E_), CsLocalId_(srm.CsLocalId_), O2GlobalId_(srm.O2GlobalId_), CO2GlobalId_(srm.CO2GlobalId_), WC_(srm.WC_), WO2_(srm.WO2_), HcCO2_(srm.HcCO2_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate ( const scalar dt, const scalar Re, const scalar nu, const label celli, const scalar d, const scalar T, const scalar Tc, const scalar pc, const scalar rhoc, const scalar mass, const scalarField& YGas, const scalarField& YLiquid, const scalarField& YSolid, const scalarField& YMixture, const scalar N, scalarField& dMassGas, scalarField& dMassLiquid, scalarField& dMassSolid, scalarField& dMassSRCarrier ) const { // Fraction of remaining combustible material const label idSolid = CloudType::parcelType::SLD; const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_]; // Surface combustion active combustible fraction is consumed if (fComb < SMALL) { return 0.0; } const SLGThermo& thermo = this->owner().thermo(); // Local mass fraction of O2 in the carrier phase const scalar YO2 = thermo.carrier().Y(O2GlobalId_)[celli]; // Diffusion rate coefficient const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75); // Kinetic rate const scalar Rk = C2_*exp(-E_/(RR*Tc)); // Particle surface area const scalar Ap = constant::mathematical::pi*sqr(d); // Change in C mass [kg] scalar dmC = Ap*rhoc*RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk)*dt; // Limit mass transfer by availability of C dmC = min(mass*fComb, dmC); // Molar consumption const scalar dOmega = dmC/WC_; // Change in O2 mass [kg] const scalar dmO2 = dOmega*Sb_*WO2_; // Mass of newly created CO2 [kg] const scalar dmCO2 = dOmega*(WC_ + Sb_*WO2_); // Update local particle C mass dMassSolid[CsLocalId_] += dOmega*WC_; // Update carrier O2 and CO2 mass dMassSRCarrier[O2GlobalId_] -= dmO2; dMassSRCarrier[CO2GlobalId_] += dmCO2; const scalar HsC = thermo.solids().properties()[CsLocalId_].Hs(T); // carrier sensible enthalpy exchange handled via change in mass // Heat of reaction [J] return dmC*HsC - dmCO2*HcCO2_; }

    COxidationKineticDiffusionLimitedRate 是 OpenFOAM 中用于描述 焦炭表面碳 (C(s)) 与氧气 (O₂) 反应生成 CO₂ 的动力学–扩散受限表面反应模型。

    该模型只支持单一路径:C(s) + Sb·O₂ → CO₂;无法处理生成 CO 或 H₂ 的气化反应(如 char + CO₂ 或 char + H₂O)。(OpenFOAM)

    社区用户曾指出,若使用 tutorial 中默认参数(Sb=1、C1=5e‑12、C2=0.002、E=7.9e7),在合理温度(如 Tc = 1250 K)下计算 Rk → 0,从而导致 dmC/dt → 0,看似模型不起作用。(CFD Online)

    核心关注点 1. dmC 的单位与物理意义:

    公式如下(简化版本):

    dmC = Ap * rhoc * RR * Tc * YO2 / WO2_ * (D0 * Rk / (D0 + Rk)) * dt;

    各项单位:

    Ap * rhoc → kg/m RR*Tc*YO2/WO2_ → J/kg 或 J·kmol/kg² D0 * Rk / (D0 + Rk) → 1/s dt → s

    组合后似乎是 J/m(能量密度单位),而非质量单位(kg),令人难以直接信服 dmC 实为 kg 碳质量损耗

    社区质疑这一点,但也指出源码后续使用 dmC/WC 计算摩尔变化,再映射为气相 O₂ 与 CO₂ 质量,最终模型确实是按质量守恒执行。(CFD Online)

    2. 模型常参数来源与适用性

    默认参数值(tutorial 案例中提供)在合理温度下几乎不启动:

    当 Tc = 1250 K,Rk ≈ 0,导致 dmC/dt = 0,即不发生碳消耗; 需要极高温度(如 Tc → 50000 K)才会有所反应,这显然不现实。(CFD Online)

    参数来源据称为 Baum & Street (1971) 研究,但社区提问第二点是:

    确切常数来源不明; 模型中使用 Tc(载体温度)而非 Tp(碳颗粒表面温度),与文献描述不一致。(CFD Online) 总结

    我对以下三点非常困惑,想向大家询问:

    单位体系是否正确?
    虽然中间结果为 J/m,但 dmC 最终确实代表 kg 碳损耗?有哪些地方负责单位换算以确保质量守恒?

    为何采用载体温度 Tc 而非颗粒表面温度 Tp?
    文献模型多数以 Tp(carbon particle temperature)为基础,但代码却用 Tc,是否存在误用或简化?

    默认参数值是否合理
    常数如 C2=0.002, E=7.9e7 是否适用?

  • 如何用extrudeMesh生成360度的axisymmetric 3D网格

    2
    2 帖子
    2k 浏览
    Prometheus10P

    博主您好,我用v1812版本得wedge网格旋转一周生成360°的3D网格似乎很顺利,没有遇到博主您说的问题,可能差别在于axis这里:

    nLayers 36; expansionRatio 1.0; sectorCoeffs { axisPt (0 0 0.0); axis (0 0 -1); angle 360; // For nLayers=1 assume symmetry so angle/2 on each side }

    但是仿真的时候就有点问题了。请教一下博主,我后续的计算是用wedge网格生成的3D圆管状网格进行两相流动计算,在对称轴位置处,界面波动非常剧烈,(举例来说就像包子的褶皱),请问博主您是否有解决类似问题的经验?

    2c3fb71d-127a-479f-b43f-1a41360f7552-image.png
    9d8b3854-1345-4cb7-bf4c-5159ab3e4ea2-image.png

    感谢。