I found that when I use the get function under the PARALLEL_MODE_MPI, I always get zero; however, in the same code I get non-zero value when the PARALLEL_MODE_MPI is off.
Most of my program is implemented by following the cavity2d, 3d examples, except that I would get some information from the velocity field before conducting collideAndStream. Part of program can be shown as follows:
###############################################################################
TensorFieldBase3D<T,3> const& velField = lattice.getDataAnalysis().getVelocity();
int id_nx = (int)floor(pt.x); // pt.x, pt.y, pt.z are position with double(T) type.
int id_ny = (int)floor(pt.y);
int id_nz = (int)floor(pt.z);
int id_px = id_nx + 1;
int id_py = id_ny + 1;
int id_pz = id_nz + 1;
T w_px = pt.x - (double)(id_nx);
T w_py = pt.y - (double)(id_ny);
T w_pz = pt.z - (double)(id_nz);
T w_nx = 1.0 - w_px;
T w_ny = 1.0 - w_py;
T w_nz = 1.0 - w_pz;
T u[3];
for(int dim = 0; dim < 3; dim++)
{
u[dim] = velField.get(id_nx, id_ny, id_nz)[dim] * w_nx * w_ny * w_nz;
u[dim] += velField.get(id_nx, id_ny, id_pz)[dim] * w_nx * w_ny * w_pz;
u[dim] += velField.get(id_nx, id_py, id_nz)[dim] * w_nx * w_py * w_nz;
u[dim] += velField.get(id_nx, id_py, id_pz)[dim] * w_nx * w_py * w_pz;
u[dim] += velField.get(id_px, id_ny, id_nz)[dim] * w_px * w_ny * w_nz;
u[dim] += velField.get(id_px, id_ny, id_pz)[dim] * w_px * w_ny * w_pz;
u[dim] += velField.get(id_px, id_py, id_nz)[dim] * w_px * w_py * w_nz;
u[dim] += velField.get(id_px, id_py, id_pz)[dim] * w_px * w_py * w_pz;
}
###############################################################################
My compiler I use is pgi ( linux86-64/7.0-5 ).
Thanks.