Size of refinement levels in 2D

Hello everyone,

I’m currently trying to do grid refinement in 2D. Therefore, I use the following code :
Box2D refinementLevel0(param.lvl0xmin, param.lvl0xmax, param.lvl0ymin, param.lvl0ymax);
Box2D refinementLevel1(param.lvl1xmin, param.lvl1xmax, param.lvl1ymin, param.lvl1ymax);
Box2D refinementLevel2(param.lvl2xmin, param.lvl2xmax, param.lvl2ymin, param.lvl2ymax);

Then I try to visualize the density by creating a vtk file for each level :
vtkOut.writeData(*computeDensity(lattice.getComponent(iLevel)), “density”, 1.);

My problem is : when I try to visualize a level on paraview, it is twice bigger than the previous level. For example, level 3 is twice bigger than level 2, 4 times bigger than level 1, and so on… Whereas the distance between 2 nodes is kept, fixed by the reference level.
That’s a problem for me because I would like to superimpose levels on each other in order to get a single figure, so they need to have the same scale. Is there a way to do that ?

Thank you !

Problem solved, it was in fact much easier than I thought. For those who are interested, we can change the origin and the point spacing of the vtk file when creating the VtkImageOutput2D :
VtkImageOutput2D vtkOut(createFileName(fname.str(), iter, 6), dx/pow(2,iLevel), offset);

Hi, did u do some tests for 3d

I’ve not tried it but I think refinement in 3D is still not included in the latest version of palabos.