当前位置: 代码迷 >> 综合 >> Palabos Summer School Note 2: Data Processors
  详细解决方案

Palabos Summer School Note 2: Data Processors

热度:56   发布时间:2024-02-27 19:09:13.0

三种扩展Palabos的方法

  1. Lattice Descriptor: 如AdvectionDiffusionD3Q19Descriptor
  2. Dynamics Objects:如碰撞步骤
  3. Data Processors:所有其他的Palabos扩展,如耦合其他模型

数据处理器Data Processors

在这里插入图片描述
在这里插入图片描述
我记得以前在Palabos论坛上看过写入envelope的数据不会改变该格点的值,未确认是否为事实。
在这里插入图片描述

耦合例子

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
上图为一个典型的数据处理器模板,基本上所有的数据处理器都含有这些内容。
在这里插入图片描述
几乎所有的类都有clone函数。
在这里插入图片描述
告诉Palabos哪种参数会被改变,用于让MPI实施对应数据的数据交互。图示第一个Block没有任何改变,第二个Block的粒子群数据会被改变。

/// Indicates what kind of cell content was modified and must
/// be updated in a multi-block structure.
enum ModifT {
    nothing          =0,  //< No modification.staticVariables  =1,  //< Static cell content (populations+externals).dynamicVariables =2,  //< Only content of dynamics objects, but no static content.allVariables     =3,  //< Both the static and dynamic cell content.dataStructure    =4,  //< Recreate dynamics and copy both static and dynamic content.undefined        =5   //< Used for debugging purposes only.
};

if you want to modify the populations at a cell you need to use “staticVariables”. If you need to modify the relaxation parameter of a cel, you need to use “dynamicVariables”. If you need to change localy the dynamics, you need to use “dataStructure”, and so on…
——from Palabos Forum

virtual void getTypeOfModification(std::vector<modif::ModifT>& modified) const {
    std::fill(modified.begin(), modified.end(), modif::nothing);modified[0] = modif::dataStructure;    // Fluidmodified[1] = modif::staticVariables;  // rhoBar.modified[2] = modif::staticVariables;  // j.modified[3] = modif::staticVariables;  // Massmodified[4] = modif::staticVariables;  // Volume-fractionmodified[5] = modif::staticVariables;  // Flag-statusmodified[6] = modif::nothing;          // Normal.modified[7] = modif::nothing;          // Interface listsmodified[8] = modif::nothing;          // Curvature.modified[9] = modif::nothing;          // Outside density.
}

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
根据上上个ppt所示,小domain的坐标可能是不定的,需要根据上图所示的方案来访问你所需要的坐标。
在这里插入图片描述
velocityBeginsAt那行表示访问并得到流场中储存在碰撞迁移过程中的速度。
我认为这段介绍很重要,下面我将记录Jonas Latt在这段介绍时的所有发言。
原句:
You see we are back to our process function, which receives three arguments, the first is the domian which has been computed by Palabos and provided to you. Palabos says: well, please parse this domain and implement your operation on this domain. The first is ste# for the lattice, and then comes to the fluid lattice, and then comes to the scalar lattice. We want to parse the fluid lattice to compute the velocity on every cell and then we are going to copy the lattice which is computing the advention-diffusion equation. So the lattice which computes the advection-diffusion equation is also a lattice Boltzmann lattice. It has populations but after all the populations so I think that in 2d this is going to be 5 populations, it also stores the velocity. So every cell has essentially in 2D 7 values where 5 are for the populations, and 2 are for the velocity. So we are going to write the fluid velocity into these two velocity values and the local collision step is going to use them to compute the equilibrium and implement the lattice Boltzmann scheme.

This first line of this data processor is: I’m going to access the descriptor of the advection-diffusion field to determine at which position inside the cell as the adopted velocity is being stored, so we can write it into this. Then, as I said before, we need to cpmpute the relative offset between the fluid lattice and advection-diffusion lattice to be able to access their coordinates.

Then you as a user have to write an explicit loop over the domain provided to you by Palabos, in this loop, in this loop, you are going to compute the velocity on the fluid field so that’s is line which says fluid.get(ix,iy) because ix and iy are the coordinates of fluid lattice. fluid.get gives you a reference to the cell because according ix, iy which has a method computeVelocity to compute the velocity. I want you to have computed the velocity, you can copy the velocity to the advection-diffusion lattice into its scalar fied as scalar extension that comes right after the populations. This is now a data processor that implements a coupling that uses functionals of cells on either side on both lattices and copy data from one to the other. This data processor is fully local because you never, I mean none of the cells need to access neighboring cells, but because it involves a coupling bewteen two lattices, you cannot implement it in terms of a local collision, you cannot have a dynamics object which is doing this operation although it’s local, because it has two arguments. It has also the capability to be non-local, so as you play with this code you can try it out. Depending on the envelope instantiated by the MultiBlockLattice, every cell can also access ##bles in the example we will provide to you: the envelope is of size one, so every cell, every lattice here has the possibility to read, to have read access to one of its neighbors.

在这里插入图片描述

你可以访问subdomain之外的格点,但你只能写入数据至subdomain之内的格点,但是如果你写入subdomain之外的格点,将会没有作用,Palabos会清楚这些数据。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
level可以被当做一个组,你的程序可能会有许多数据处理器,然后你就需要用level,比如palabos运行level 0的数据处理器,计算所有的值,比如envelope中的值,然后继续计算level 1的数据处理器。
在这里插入图片描述

在这里插入图片描述

  相关解决方案