-
Notifications
You must be signed in to change notification settings - Fork 2
Data Evaluation Explanation
Array<T,2> velocity;
lattice.get(nx/2, ny/2).computeVelocity(velocity);
pcout << "Velocity in the middle of the lattice: ("
<< velocity[0] << "," << velocity[1] << ")" << endl;
//--------------//
pcout << "Velocity norm along a horizontal line: " << endl;
Box2D line(0, 100, ny/2, ny/2);
pcout << setprecision(3) << *computeVelocityNorm(*extractSubDomain(lattice, line)) << endl;
//--------------//
plb_ofstream ofile("profile.dat");
ofile << setprecision(3) << *computeVelocityNorm(*extractSubDomain(lattice, line)) << endl;
//--------------//
pcout << "Average density in the domain: " << computeAverageDensity(lattice) << endl;
pcout << "Average energy in the domain: " << computeAverageEnergy(lattice) << endl;
//--------------//
Codes from tutorial1_1_4
Array<T,2> velocity定义了一个两组元素的velocity,通过lattice.get(nx/2, ny/2).computeVelocity(velocity)来计算得出(nx/2, ny/2),即流域中心点的速度值。
Array<T,2> velocity defined a two-element velocity, by lattice.get(nx/2, ny/2).computeVelocity(velocity) to calculate (nx/2, ny/2), that is the velocity of the center of the domain.
在Palabos中,输出使用pcout而非cout。
In Palabos, output should not use cout but pcout.
通过Box2D line来定义一条线,随后用pcout << setprecision(3) << *computeVelocityNorm(*extractSubDomain(lattice, line)) << endl,以3位数的精度,通过 *extractSubDomain来计算这条线line的速度向量。
Through Box2D line to define a line, then use pcout << setprecision(3) << *computeVelocityNorm(*extractSubDomain(lattice, line)) << endl, with a 3-digit precision, to calculate velocity norm in this line by *extractSubDomain.
在Palabos,输出文件使用plb_ofstream而非ofstream,以确保并行运行正常。
In Palabos, use plb_ofstream , not ofstream to output file, for normal parallel programing.
computeAverageDensity(lattice)与computeAverageEnergy(lattice)是Palabos预先就有的功能,计算平均密度和平均能量
computeAverageDensity(lattice) and computeAverageEnergy(lattice) are predefined functionals in Palabos,to calculate average density and energy respectively.
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
pcout << "Writing VTK file at time "
<< iT*parameters.getDeltaT() << endl;
writeVTK(lattice, parameters, iT);
//Codes from tutorial1_1_7
VTK文件中存储的都是无量纲的变量,所以输出的时候需要dx来表示格子的尺寸,在上面的代码里,double被替换为float来缩小数据大小。 VTK file stores dimentionless variables, so it is needed to use dx to represent cell's size when output. In the code above, double was replaced by float to reduce data size.
If you have any thing for error correction, please send them to me by any way you want. My email is ahdhfang@hotmail.com.