Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. rhoCentralFoam是如何计算温度的?

rhoCentralFoam是如何计算温度的?

已定时 已固定 已锁定 已移动 OpenFOAM
5 帖子 2 发布者 5.6k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • S 离线
    S 离线
    sibo
    写于2018年1月19日 05:31 最后由 李东岳 编辑 2018年1月21日 07:59
    #1

    在rhoCentralFoam中,能量方程解了之后求的是e--internal energy, 那么温度是在哪里计算的呢?
    我在rhoCentralFoam中的createField.H里面看到:const volScalarField& T = thermo.T(); 请问为何这里将T声明为const呢?在之后加T.boundaryFieldRef()=###, 编译会报错,就是说T被声明为了const。想问const的声明是否是必须的呢?

    谢谢大家!

    1 条回复 最后回复
  • S 离线
    S 离线
    sibo
    写于2018年1月19日 05:40 最后由 李东岳 编辑 2018年1月21日 07:58
    #2

    做了一些search后有如下进展:
    解完能量方程后,有这样一行:thermo.correct();
    然后thermal correct基本就是calculate();
    在hePsiThermo.C中发现:

    TCells[celli] = mixture_.THE
            (
                hCells[celli],
                pCells[celli],
                TCells[celli]
            );
    

    就又去找了THE的解释:

    inline Foam::scalar Foam::species::thermo<Thermo, Type>::THE
    (
    const scalar he,
    const scalar p,
    const scalar T0
    ) const
    {
    return Type<thermo<Thermo, Type>>::THE(*this, he, p, T0);
    }

    但是到这里还是不清楚到底是如何计算T的啊?

    1 条回复 最后回复
  • 李 在线
    李 在线
    李东岳 管理员
    写于2018年1月21日 01:08 最后由 编辑
    #3

    const volScalarField& T = thermo.T();请问为何这里将T声明为const呢?

    防止求解器直接求解T,你建立一个场也可以,这有一部分是好编程习惯养成的问题。所以你操作T的boundaryField不成功

    计算方法总结一下,希望对后来者有用

    最原始来自于抽象基类basicThermo.H:

    rhoCentralFoam.C -> thermo.correct(); -> hePsiThermo.C -> correct(); -> calculate(); ->

    TCells[celli] = mixture_.THE
            (
                hCells[celli],
                pCells[celli],
                TCells[celli]
            );
    

    ->

    const typename MixtureType::thermoType& mixture_ =
    this->cellMixture(celli);

    ->
    basicThermo.H,
    ->

    //- Temperature from enthalpy/internal energy for cell-set
    virtual tmp<scalarField> THE
    (
    const scalarField& h,
    const scalarField& p,
    const scalarField& T0, // starting temperature
    const labelList& cells
    ) const = 0;

    -> 运行时选择 -> sensibleInternalEnerge.H

    //- Temperature from sensible internal energy
    // given an initial temperature T0
    scalar THE
    (
    const Thermo& thermo,
    const scalar e,
    const scalar p,
    const scalar T0
    ) const
    {
    return thermo.TEs(e, p, T0);
    }

    -> thermoI.H

    template<class Thermo, template<class> class Type>
    inline Foam::scalar Foam::species::thermo<Thermo, Type>::TEs
    (
    const scalar es,
    const scalar p,
    const scalar T0
    ) const
    {
    return T
    (
    es,
    p,
    T0,
    &thermo<Thermo, Type>::Es,
    &thermo<Thermo, Type>::Cv,
    &thermo<Thermo, Type>::limit
    );
    }

    ->

    template<class Thermo, template<class> class Type>
    inline Foam::scalar Foam::species::thermo<Thermo, Type>::T
    (
    scalar f,
    scalar p,
    scalar T0,
    scalar (thermo<Thermo, Type>::*F)(const scalar, const scalar) const,
    scalar (thermo<Thermo, Type>::*dFdT)(const scalar, const scalar)
    const,
    scalar (thermo<Thermo, Type>::*limit)(const scalar) const
    ) const
    {
    ...
    return Tnew;
    }

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    1 条回复 最后回复
  • S 离线
    S 离线
    sibo
    写于2018年1月21日 05:06 最后由 编辑
    #4

    感谢东岳师兄指导!当时找到THE就不知道该怎么找下去了,还想请问一下如何可以准确的找到方程的定义啊?比如在找THE的时候,会出现在很多.H文件里,怎么能知道具体的某个solver是用的哪个呢?我一直都是在doxygen里面看最相关的,但是有时候不熟悉的话就得重复找好多次。。。很糟心。。。后来用了Qt,在写自己solver的时候是挺方便,但是看其他openfoam solver还得自己重新整理所有头文件进去,也很麻烦。。还请各位前辈给些意见~谢谢啦!

    1 条回复 最后回复
  • 李 在线
    李 在线
    李东岳 管理员
    写于2018年1月25日 13:46 最后由 编辑
    #5

    这和工作习惯有关,我这面接触的课题组里面大家都没怎么用doxygen,导致我也没怎么用,不过我这面有人用Qt,但是我个人用的是VIM。但我知道好像大家说doxygen很好用,Qt在国内也很受欢迎。对于找代码,我非常低级,就是从类的继承关系找..需要哪个打开哪个

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    1 条回复 最后回复
2018年1月19日 05:31

5/5

2018年1月25日 13:46

2018年1月25日 13:46
  • 登录

  • 登录或注册以进行搜索。
5 / 5
  • 第一个帖子
    5/5
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]