Hi all,
I am trying to modify the multicomponent2d example in the palabos source files, so that instead of producing only .GIF images it produces a VTK output with the densities at each timestep. So I tried to include the following piece of code:
[code=“cpp”]
void writeVTK(MultiBlockLattice2D<T,DESCRIPTOR>& heavyFluid,
MultiBlockLattice2D<T,DESCRIPTOR>& lightFluid,
plint nx, plint ny, plint iter)
{
Array<T,15> Hprofile;
Array<T,15> Lprofile;
Array<T,15> Fprofile;
for (int iY=0; iY<15; ++iY){
Box2D(0, 100*iY, nx-1, 100*iY) slice;
Hprofile[iY]=computeAverageDensity(heavyFluid, slice);
Lprofile[iY]=computeAverageDensity(lightFluid, slice);
Fprofile[iY]=Lprofile[iY]+Hprofile[iY]
}
std::auto_ptr<ScalarField2D<T> > heavyDensity(computeDensity(heavyFluid,heavyFluid.getBoundingBox()));
std::auto_ptr<ScalarField2D<T> > lightDensity(computeDensity(lightFluid,lightFluid.getBoundingBox()));
VtkImageOutput2D<T> vtkOut(createFileName("vtk", iter, 6), 1);
vtkOut.writeData<1,T>(*heavyDensity, "Densityheavy",1.);
vtkOut.writeData<1,T>(*lightDensity, "Densitylight",1.);
vtkOut.writeData<15,T>(Hprofile, "DensityProfileHeavy", 1);
vtkOut.writeData<15,T>(Lprofile, "DensityProfileLight", 1);
vtkOut.writeData<15,T>(Fprofile, "DensityProfileTotal", 1);
}
With this code, I was trying to store in the VTK file not only the density of both fluids, but also an array with average densities calculated in 'slices' of fluid. I am not familiar with C++, so I'm getting several errors out of this. Chief among them, I get:
cannot convert ‘heavyDensity.std::auto_ptr<_Tp>::operator*<plb::ScalarField2D<double> >()’ (type ‘std::auto_ptr<plb::ScalarField2D<double> >::element_type {aka plb::ScalarField2D<double>}’) to type ‘plb::TensorField2D<double, 1>&’
I understand what it is trying to say, but I don't know how to correct it. Can someone please help me?
Also, if instead I wanted to analyze this data (for instance the array created here) on MATLAB, how could I export it?