Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    pairCollision中,A和B分别指网格还是粒子?

    OpenFOAM
    2
    5
    670
    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.
    • zhe
      zhe last edited by

          // Loop over all Parcels in cell A (a)
          forAll(cellOccupancy[realCelli], a)
          {
              pA_ptr = cellOccupancy[realCelli][a];
      
              forAll(dil[realCelli], interactingCells)
              {
                  List<typename CloudType::parcelType*> cellBParcels =
                      cellOccupancy[dil[realCelli][interactingCells]];
      
                  // Loop over all Parcels in cell B (b)
                  forAll(cellBParcels, b)
                  {
                      pB_ptr = cellBParcels[b];
      
                      evaluatePair(*pA_ptr, *pB_ptr);
                  }
              }
      
              // Loop over the other Parcels in cell A (aO)
              forAll(cellOccupancy[realCelli], aO)
              {
                  pB_ptr = cellOccupancy[realCelli][aO];
      
                  // Do not double-evaluate, compare pointers, arbitrary
                  // order
                  if (pB_ptr > pA_ptr)
                  {
                      evaluatePair(*pA_ptr, *pB_ptr);
                  }
              }
          }
      

      上述一段code是来自paircollision的,原本一直一位A 和B 是分别表示两个parcel,但是看上面的意思是指代两个网格吗?希望有人能帮忙解释一下,谢谢。

      1 Reply Last reply Reply Quote
      • bestucan
        bestucan 版主 副教授 last edited by

        这段一看 A B 就是网格。但是把 A B 理解成 parcel 相关也不算没有依据,parcel 好像就是从网格上划分出来的。比如,进口面有10个网格,那么每个网格喷出来1个 parcel。一次喷出来10个parcel。

        如果把 parcel 理解成单位时间内单位空间上的粒子物理量。那理解成网格还是parcel的区别不就是欧拉和拉格朗日的区别。
        我猜的:mianmo:

        滚来滚去……~(~o ̄▽ ̄)~o 滚来滚去都不能让大家看出来我不是老师么 O_o

        异步沟通方式(《posting style》from wiki)(下载后打开):
        https://www.jianguoyun.com/p/Dc52X2sQsLv2BRiqnKYD
        提问的智慧(github在gitee的镜像):
        https://gitee.com/bestucan/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md

        zhe 1 Reply Last reply Reply Quote
        • zhe
          zhe @bestucan last edited by

          @bestucan 谢谢回复。但是我还是没有理解您的意思。A和B从code上来看,确实是代表的网格。那么对于parcel A 和 parcel B之间的作用,怎么就能当作从网格里提取出来的呢?那是不是说明一个网格就只能代表一个parcel了?感觉这不是他们想表达的意思。希望您可以帮忙再想想。我也会再研究一下,希望还能再多沟通,谢谢🙏

          bestucan 1 Reply Last reply Reply Quote
          • bestucan
            bestucan 版主 副教授 @zhe last edited by

            @zhe 原来你是疑惑怎么从网格里提取 parcel 啊。

            https://www.openfoam.com/documentation/guides/latest/api/PairCollision_8C_source.html
            你放的代码是这个89行吧,84行创建了cellOccupancy,

            那个创建容积率的函数在多个模型下有同名的,我猜这里这个是
            https://www.openfoam.com/documentation/guides/latest/api/KinematicCloudI_8H_source.html
            这个的371行,

            这个函数就是判断是否存在,否则创建。就是这个函数buildCellOccupancy(),在
            https://www.openfoam.com/documentation/guides/latest/api/KinematicCloud_8C_source.html
            这里140行

            你给的代码里 pA_ptr, pB_ptr 都是通过 cellOccupancy 的返回值得到 parcel 的指针,就是 那个371行,如果存在就返回
            return *cellOccupancyPtr_;

            而这个 cellOccupancyPtr_ 也有多个定义,在这里应该是这个
            https://www.openfoam.com/documentation/guides/latest/api/KinematicCloud_8H_source.html
            173行。

            173行的注释大概解释了cell 和parcel怎么联系起来的。

            好了
            模板继承用的太多,我不太熟悉这部分,同名函数定义太多,剩下的我也没招了:136:

            滚来滚去……~(~o ̄▽ ̄)~o 滚来滚去都不能让大家看出来我不是老师么 O_o

            异步沟通方式(《posting style》from wiki)(下载后打开):
            https://www.jianguoyun.com/p/Dc52X2sQsLv2BRiqnKYD
            提问的智慧(github在gitee的镜像):
            https://gitee.com/bestucan/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md

            zhe 1 Reply Last reply Reply Quote
            • zhe
              zhe @bestucan last edited by

              @bestucan 抱歉回复的晚了,已经很感谢您的解答了,帮我捋清了很多了。我按着您的这个思路走了一遍,大概明白了我之前给出的的确是A和B都是网格名称。而同时,在分别中也代表着其中包含的粒子a和b,也就是您说的也可以理解为A 和B 也是粒子。

              我的理解是A 和B 是有相关的两个cells,而最后的

              evaluatePair(*pA_ptr, *pB_ptr);

              是建立两个网格之间(包括网格里所有粒子)的一种配对机制,不知道对不对?

                      // Loop over the other Parcels in cell A (aO)
                      forAll(cellOccupancy[realCelli], aO)
                      {
                          pB_ptr = cellOccupancy[realCelli][aO];
              
                          // Do not double-evaluate, compare pointers, arbitrary
                          // order
                          if (pB_ptr > pA_ptr)
                          {
                              evaluatePair(*pA_ptr, *pB_ptr);
                          }
                      }
              

              在之后的loop里,对于相同cell里的粒子相对配对,也就是说把一个粒子单拎出来a,然后其它的所有粒子相当于a0(而这个其实与之前B网格的指示相同而以)。这样理解不知道对不对?

              最后一点儿避免两次被征用,所以有了一个对比。

              知道您肯定也花时间翻了一遍了,实在是感谢!

              如果有其他朋友一起讨论,感激不尽。

              1 Reply Last reply Reply Quote
              • First post
                Last post

              CFD中文网 | 东岳流体 | 京ICP备15017992号-2