# populations

Dear All.

How can i get the populations inside a cell? Which is the function to use to get this information?
stefano

Hello,

a cell access its populations simply by using the “[iPop]” operator, where iPop is the population’s number you want to access.

For example :

Cell<double,D2Q9descriptor> cell;

cout << cell[1] << endl;

will first declare a cell of 9 populations (corresponding to the D2Q9 lattice) and then print of the screen the value of population 1 (which is corresponding to c=(-1,1)).

For example, if the lattice is 10 nodes in the x direction and 10 in y direction, how can i access the (3,3) populations?

I tried
Cell<double,D2Q9Descriptor> cell;
lattice.get(3,3).getPopulations(cell);

but it doesn’t work.

Stefano

The get method returns a Cell object. Therefore to access a population 4 on the lattice node (3,3) just do

lattice.get(3,3)[4];

thanks.
Stefano

Hello Orestis,

To display all populations (f_q with q = 0, …, 8 for D2Q9) on all lattice nodes, I used “pcout << * computeAllPopulations (lattice)”, and got the expected results (I am working on the example of poiseuille existing in palabos).

However, when I use lattice.get (i, j) [q] to access a population “q”, I always get a nul populations for any node (i, j) and all q at each iteration. Can you tell me why please?!