天天看点

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

继续阅读