Hello Developers,
The values in the csv file are random and don’t make sense. I am using the same code for storing data in csv file. It stores the correct values when the code is not run parallelly.
The code snippet:
{
SuperLatticePhysVelocity2D<T,DESCRIPTOR> velocityF(sLattice, converter);
BlockReduction2D2D<T> velocityPlane(velocityF,12, BlockDataSyncMode::ReduceOnly);
ofstream myfile1;
myfile1.open(“velocity_”+ std::to_string(iT) + “.csv”);
myfile1 << “i,” << “j,” << “Ux,” <<“Uy”<< std::endl;
int latticeR[2] { };
for (latticeR[0]=0; latticeR[0] < velocityPlane.getBlockStructure().getNx(); ++latticeR[0])
{
for (latticeR[1]=0; latticeR[1] < velocityPlane.getBlockStructure().getNy(); ++latticeR[1])
{
T vel[2] { };
velocityPlane(vel, latticeR);
myfile1 << latticeR[0] << “,” << latticeR[1] << “,”<< vel[0] << “,”<< vel[1] << std::endl;
}
}
myfile1.close();
}
I would really appreciate feedback on this matter.
Thank you.
Yours sincerely,
Abhijeet