Skip to content

Reply To: Printing velocity data

#4851
Adrian
Keymaster

One straight forward way of extracting such data from a super lattice into a single block is to use BlockReduction2D2D.

This is actually used in laminar/cavity2d/parallel and most other examples for extracting image data in getResults.

Something along these lines should do what you want:


  SuperLatticePhysVelocity2D<T,DESCRIPTOR> velocity(sLattice, converter);
  BlockReduction2D2D<T> velocityPlane(velocityF, 600, BlockDataSyncMode::ReduceOnly);
  for (int iX=0; iX < velocityPlane.getNx(); ++iX) {
    for (int iY=0; iY < velocityPlane.getNy(); ++iY) {
      myfile << iX << " " << iY << " "
             << std::setprecision(9)
             << velocityPlane.get(iX,iY,0) << " "
             << velocityPlane.get(iX,iY,1) << std::endl;  
    }
  }