void writeVTK(MultiBlockLattice3D<T,DESCRIPTOR>& lattice,
IncomprFlowParam<T> const& parameters, plint iter) {
T dx = parameters.getDeltaX();
T dt = parameters.getDeltaT();
VtkImageOutput3D<T> vtkOut(createFileName(“vtk”, iter, 6), dx);
vtkOut.writeData<float>(*computeDensity(lattice), “density”, 1.);
vtkOut.writeData<3,float>(*computeVelocity(lattice), “velocity”, dx/dt); } Codes from tutorial1_1_7
VTK檔案中存儲的都是無量綱的變量,是以輸出的時候需要dx來表示格子的尺寸,在上面的代碼裡,double被替換為float來縮小資料大小。
pcout << "Writing VTK file at time "
<< iT*parameters.getDeltaT() << endl;
writeVTK(lattice, parameters, iT);