# Butterfly refinement level cell sizes

Hi Butterfly users,

I have been trying to understand the refinement levels of butterfly but I am not able to understand how butterfly arrive with any cell sizes. the cell size on the butterfly WTGrading component is limited to only 2 intergers, and I don’t understand, what is it’s effect.

I suspected that the XYZGrad component is how we can set up the level of refinements. However, I am not sure what are each input/output means. Could anybody direct me to a documentation on this matter?

maybe someone can explain to me what does this mean?

1.0
(
(1.0 20.0 1.0)
(3.0 60.0 1.0)
(6.0 20.0 1.0)
)
(
(0.5 70.0 1.0)
(0.5 30.0 1.0)
)
)

Thank you so much!

It gradually changes the size of the cells throughout the tunnel. It’s a step you can use before you do the snappyHexMesh.
The below will grade in the Y direction

blocks
(
hex (0 1 2 3 4 5 6 7) (100 300 100) // number of cells in each direction X,Y,Z
(
1 // x-direction expansion ratio 1 = constant = not changing
( // start Y direction
(0.2 0.3 4) // 20% y-dir, 30% cells, expansion = 4
(0.6 0.4 1) // 60% y-dir, 40% cells, expansion = 1
(0.2 0.3 0.25) // 20% y-dir, 30% cells, expansion = 0.25 (1/4)
) // end Y direction
3 // z-direction expansion ratio
)
);

You can generate these numbers using this guy (unless you scripted them in GH)

Example image below showing a graded mesh:
Y (up here) direction is building up in size, let’s say 10-15% per cell as you move up.
X is building down to around the 40% mark (40% of the distance measured from left)
then its constant from 40 to 60% mark,
and builds up from 60 to 100%…

Have in mind that you should not increase the step per cell by more than around 10-15%. Also, make sure that all the cells close to your buildings are close to cube shape, otherwise you’ll get problems with snappyHexMesh.

@TheodorosGalanos also has a tutorial on this on Performance Network

Best, Mathias Sønderskov