Palabos论坛笔记:像多孔介质一样在一片随机区域随机生成一些反弹格式的点

Author: orestis Hello,

the get(iX,iY) method returns a cell. A cell is made of different
things. Among them the f_i’s are stored there. I guess that what you
want to do is to assign a random number to each f_i. TO access them
you have to use the brackets :

lattice.get(iX,iY)[iPop]

returns f[iPop]. Then you can assign the random number to each f_i.

I hope it helps.

Orestis

Author: orestis
Hello, As I told you in a preceding post. lattice.get(iX,iY) return a Cell object. The cell object contains the
f_i, a pointer to a dynamic, and different other methods.

You therefore cannot give a integer value to a cell :

lattice.get(iX,iY) = 1

will not compile since 1 is not of type cell but of type integer.

Four your purpose you should simply write some thing like :

for (int iX=0; iX<nx; ++iX) {
for (int iY=0; iY<ny; ++iY) {

if ( (rand()%10)+1 < 8)
lattice node. {
lattice.defineDynamics( iX,iX,iY,iY,
&instances::getBounceBack<T,DESCRIPTOR>() );
} }

}

Good luck.

写数据处理器时,我们一般都定义一个cell=lattice.get(iX,iY)。

这里Orestis提到也可以用lattice.get(iX,iY)[iPop]返回f’s。

后面的 lattice.defineDynamics( iX,iX,iY,iY, &instances::getBounceBack<T,DESCRIPTOR>() );是将目标格点的Dynamics设置为BounceBack。

提问者的想法是在一片随机区域随机生成一些反弹格式的点(就像多孔介质一样)。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值