Any way to change lattice's velocity without changing e.q.?

I know we can change a lattice node’s populations by the functions below, but is there any way that we simply change that node’s momentum?
iniCellAtEquilibrium(cell, density, velocity);
cell.getDynamics().computeEquilibria(fEq, rhoBar, j, jSqr);
cell[iPop] = cell.computeEquilibrium(iPop, rhoBar, j, jSqr);

My thought is to use cell.defineVelocity without iniCellAtEquilibrium function, but it will not work as I checked by running the code.

So I would like to ask is there a way to change lattice’s velocity?


I’m not sure what you are trying to achieve. Could you be a bit more specific?

Hello, sorry for the late reply.

Recently I was trying to implement multi-direct forcing scheme by a coupling of Palabos and Lammps, and there is a step to correct the fluid velocity after force spreading:
u(x, t) = u(x, t) + f(x, t)∆t

I was following the idea below:
Cell<T,Descriptor>& cell = lattice.get(ix,iy,iz);
cell.getDynamics().computeRhoBarJ(cell, rhoBar, j);
j += f(x, t)∆t
cell.getDynamics().computeEquilibria(fEq, rhoBar, j, jSqr);
for (plint iPop=0; iPop<D::q; ++iPop) {
cell[iPop] = fEq[iPop];

When I run the code, I printed the cell[ipop] to check, results are fine after a while, but then the code stoped(it’s been a while, I forget the error messages)

I am not sure where is the problem, so I was wondering if there is any other way to change the velocity?

The j correction seems a bit odd to me there. If you are interested in using this kind of forcing I suggest you have a look at ShanForcing scheme in Palabos. It’s based on the same idea you are using I guess.

Thanks for your reply.

I have found an another way to achieve it.

1 Like