颗粒基础
在 MFIX-Exa 中,颗粒由 MFIXParticleContainer
类管理。这个类继承自 AMReX 的 NeighborParticleContainer
并处理所有颗粒数据。
MFIXParticleContainer
提供了解决颗粒动力学(基于颗粒-颗粒、颗粒-流体和颗粒-壁面力)的功能。
颗粒动力学
在 DES 步骤中,颗粒位置通过 MFIXParticleContainer::EvolveParticles 方法更新。其结构如下:
1 // 设置 DES 步骤的时间步长(subdt)和数量(nsubsteps)
2 des_init_time_loop( &time, &dt, &nsubsteps, &subdt, &subdt_io );
3
4 // 临时存储力和力矩
5 std::map<PairIndex, Vector<Real>> tow;
6 std::map<PairIndex, Vector<Real>> fc;
7 for (MFIXParIter pti(*this, lev); pti.isValid(); ++pti)
8 {
9 PairIndex index(pti.index(), pti.LocalTileIndex());
10 tow[index] = Vector<Real>();
11 fc[index] = Vector<Real>();
12 }
13
14 while (n < nsubsteps) // 遍历子步骤数量(DES 部分)
15 {
16 // 邻居列表管理
17 if (n % 25 == 0) {
18 clearNeighbors(lev);
19 Redistribute();
20 fillNeighbors(lev);
21 buildNeighborList(lev,sort_neighbor_list);
22 } else {
23 updateNeighbors(lev);
24 }
25
26 // 遍历颗粒
27 for (MFIXParIter pti(*this, lev); pti.isValid(); ++pti)
28 {
29 // 由于颗粒-壁面碰撞产生的力和力矩
30 calc_wall_collisions_ls(particles, & ntot, & nrp,
31 tow[index].dataPtr(), fc[index].dataPtr(), & subdt,
32 ...
33 );
34
35 calc_particle_collisions(particles , &nrp,
36 neighbors[index].dataPtr() , &size_ng,
37 neighbor_list[index].dataPtr(), &size_nl,
38 tow[index].dataPtr(), fc[index].dataPtr(),
39 &subdt, &ncoll);
40 }
41
42 // 根据速度和力移动颗粒
43 des_time_loop(&nrp , particles,
44 &ntot, tow[index].dataPtr(), fc[index].dataPtr(), &subdt,
45 &xlen, &ylen, &zlen, &stime, &n);
46 }
其中,高亮的行负责移动颗粒。