天天看點

Palabos程式代碼解讀(Code Explanation) | tutorial_1 | tutorial_1_7 檔案輸出部分vtk output

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);

繼續閱讀