Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    如何创建一个list装符合条件的单元

    OpenFOAM
    2
    3
    258
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 小
      小考拉 last edited by

      各位前辈好!

      我现在想在interPhaseChengFoam中添加一个链表list,里面放一些符合某些条件的单元,比如要求单元蒸汽体积分数大于0.5,我应该如何操作呢?有没有哪些类似的代码 可以参考呢?:chitang:

      麻烦哪位老师指点一下

      谢谢

      队长别开枪 1 Reply Last reply Reply Quote
      • 队长别开枪
        队长别开枪 教授 @小考拉 last edited by 队长别开枪

        @小考拉

        DynamicList<label> xxxCells(0);
        
        const scalarField& alpha1In(alpha1.ref());
        
        forAll(alpha1In, cellI)
        {
            // alpha1 is liquid fraction, this condition equals to vapor fraction > 0.5
            if (alpha1In[cellI] <= 0.5)
            {
                xxxCells.append(cellI);
            }
        }
        
        // Usage of 'xxxCells' list
        if (xxxCells.size())
        {
            forAll(xxxCells, ci)
            {
                const label globalCellId(xxxCells[ci]);
          
                // Do whatever you want from here
            }
        }
        
        小 1 Reply Last reply Reply Quote
        • 小
          小考拉 @队长别开枪 last edited by

          @队长别开枪 谢谢老师指点,我好好研究一下

          1 Reply Last reply Reply Quote
          • First post
            Last post

          CFD中文网 | 东岳流体 | 京ICP备15017992号-2
          论坛登录问题反馈可联系 li.dy@dyfluid.com