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. 影响计算效率的因素

影响计算效率的因素

已定时 已固定 已锁定 已移动 OpenFOAM
1 帖子 1 发布者 1.8k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • 浪 离线
    浪 离线
    浪迹天大
    写于 最后由 编辑
    #1
    //2.4s
    label meshSize = this->thermo().rho()().size();
    for(label i=0; i < this->nSpecie_; i++)
    {
        for(label icell = 0; icell < meshSize; icell++)
        {
            label  izone = ZoneNumber[icell];
            this->RR_[i][icell]     = RRCCM[i][izone]*correctCH[icell];
        }
    } 
    
    //24s
    for(label i=0; i < this->nSpecie_; i++)
    {
        for(label icell = 0; icell < this->thermo().rho()().size(); icell++)
        {
            label  izone = ZoneNumber[icell];
            this->RR_[i][icell]     = RRCCM[i][izone]*correctCH[icell];
        }
    } 
    

    上边两种用法,计算耗时相差 10 倍!
    改用 thermo.T() 之后计算时间又变成 2.4 s 了,所以原因应该是 rho 后边跟了两个括号,深层原因是啥呢?

    //2.4s
    label meshSize = this->thermo().rho()().size();
    for(label i=0; i < this->nSpecie_; i++)
    {
        for(label icell = 0; icell < this->thermo().T().size(); icell++)
        {
            label  izone = ZoneNumber[icell];
            this->RR_[i][icell]     = RRCCM[i][izone]*correctCH[icell];
        }
    } 
    

    此外,还可以使用 forAll(this->thermo().T(), icell),效果和 for 循环几乎一样。

    OpenFOAM 学习交流:https://openfoam.top

    1 条回复 最后回复

  • 登录

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