# nBlock in Refinement

Hi everyone,
I see that we need to build octree structure when we need to refine grid. But what the means of nBlock in example 3D Grid Refinement?
Thanks all

1 Like

nBlock is the size (the number of grid points) in each direction of each octree block.

1 Like

But in the example refinement3d, I see the maxoctreelevel is 4 and numlevel is 3, then nBlock=2^4 so it equal to 16. But in XML it said that nBlock will be no smaller than 6, but when maxoctreelevel=1, there will be just 3 nodes on each edge?
Furthermore, is maxoctreelevel means the highest level of various resolution region in the whole field? But numlevel seems not mean the refine level of a specified region?
Sorry for too much questions, I really need to solve these questions so that I can implement my simulation as soon.
Best regards

Since we are using an octree structure that refines by a factor of two at each refinement, this means that no matter at which level you are the number of point per block will be the same (there will be more blocks at finer levels). So no matter at which level you are the number of points per block will be the same.

If nBlock=6 then each block will have 6^3=216 bulk points (again at each level).

The maxoctreelevel is the maximum number of octree levels that we will try to generate. It does not mean that it is consistently possible to have them all on the simulation. Since the transitions allowed are only of a factor 2, and that for continuity reasons it is mandatory to have at least a block at each level, it may happen that all the levels will not be generated. numlevels in turn is the amount of levels we would like to have at most (again it may not be possible to generate them all for the same consistency reason).

Sorry, orestis. I still did’n understand.
I think numlevel is the refine level which basement is 1. So when numlevel=3, maxoctreelevel=3+1.
But I stil didn’t understand why nblock should be large equal to 6. If numlevel=1, then in each lattice there will be just 2^2=4 block.
Thanks

No. Each block will be 6x6x6. This is because we are using a 4 points stencil (in 1d) for the interpolation between grid levels and in some cases if you do not have 6 points per block dimension then you are having problems (like accessing values that are not updated yet and thus are wrong).

Now if you look at the octree structure and why each block at each level has the same amount of points. Let’s try to make a 1d ascii art:

``````|       |       |       |           level 1 (1 bar per block)
|   |   |   |   |   |   |   |       level 2 (1 bar per block)
| | | | | | | | | | | | | | | |     level 3 (1 bar per block)
``````

Now if each block is let’s say of size 6, the resolution of the first line would be 4*6=24 grid points, the second line, 8 * 6 = 48, in the third line 16 * 6 = 96, …

So although each block has the same amount of points, each level has twice as many points (thus doubling the resolution).

Thanks very much orestis, so the ‘Block’ is not grid it self. It is just the structure that store the gird information. If nBlock=10, each block will be 101010 grid points. And so as the higher level of octree subdivision.