如何创建一个list装符合条件的单元
-
各位前辈好!
我现在想在interPhaseChengFoam中添加一个链表list,里面放一些符合某些条件的单元,比如要求单元蒸汽体积分数大于0.5,我应该如何操作呢?有没有哪些类似的代码 可以参考呢?
麻烦哪位老师指点一下
谢谢
-
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 } }
2021年9月16日 13:06
3/3
2021年9月17日 00:31