# Mesh refinement using minimum refinement function

Hi all,
I’m trying to change my mesh so that in a 2D spherical model it is more refined at the top boundary layer and at the CMB. I figured using the minimum refinement function would be the way to go and I’ve tried several different ways but it won’t refine the mesh at all. I followed the directions from the post in September '19 but it still does not work.
Thanks,
Erin

Erin,

I’m trying to change my mesh so that in a 2D spherical model it is more
refined at the top boundary layer and at the CMB. I figured using the
minimum refinement function would be the way to go and I’ve tried
several different ways but it won’t refine the mesh at all. I followed
the directions from the post in September '19 but it still does not work.

Can you be more specific? What do you put into your .prm file, and how
does the output look like?

Best
W.

For example, here’s an input I tried to simply see if the refinement function would work at all and the corresponding output.

This is using the simple material model.

Hi Erin,

the syntax is correct, but ASPECT will never refine the mesh to a higher refinement level than the sum of initial global and adaptive refinement, which is 4 in your setup. In your refinement function, you specify 7 as the minimum level even below 1000 km depth, so it tries to refine to 7 everywhere, but then stops at 4, which is the maximum. In addition, your refinement function only says: use a bigger refinement level below 1000 km depth. I don’t think this is what you want to do, you want to refine near the top and bottom.
So if you want to refine the mesh further, and only at the boundary, you would need to change your initial adaptive refinement so something like 3, and your refinement function to

``````if(depth<200e3 || depth>2600e3, 6, 3)
``````

This example would refine the mesh everywhere above 200 km depth and below 2600 km depth to level 6.
The other thing you need to change is the refinement fraction: If you set that to zero, then ASPECT may just not refine the mesh. Any value between 0 and 1 should work for that.

And one more comment: If you really only want a high resolution directly at the boundary, there is also a mesh refinement plugin called ‘boundary’ you can use.

Let us know if that works!
Juliane

Hi Juliane,
That’s very helpful, I didn’t know about the sum rule for the mesh. I did have an actual case for where I wanted to refine, that was just a simpler example that didn’t work. I’ll have a look at the boundary plugin too.
Thanks!