Hi all,

Looking for advice on the best way to create a mesh with three different layers of refinement. For example, something like a spherical shell with refinement 3 below 1000km depth, refinement 5 above this and then refinement 6 above 300km depth.

I’ve previously used the minimum and maximum refinement functions with an if statement to create a two layered shell with higher refinement in the upper mantle, e.g. below, but I can’t figure out how to do this for 3 layers.

subsection Minimum refinement function

set Coordinate system = depth

set Function constants = TZ=1000e3

set Function expression = if(x<TZ,5,3)

end

subsection Maximum refinement function

set Coordinate system = depth

set Function constants = TZ=1000e3

set Function expression = if(x<TZ,5,3)

end

Thanks in advance for your guidance!

Sophie

Hey Sophie,

You should be able to do that by nesting if statements: if(x < 300e3, 6, if(x <TZ, 5, 3)).

Hope this helps!

Menno

Hi Sophie,

If I am interpreting the desired mesh structure correctly, I think you can do this just with the Minimum refinement function.

The minimum refinement level in the entire model is 3, so `Initial global refinement = 3`

. Assuming z is depth, you can then structure the function in the following manner:

`if (z> height_1, if ( z>height_2, 5, 4), 3)`

Let us know if this works!

John

EDIT: Menno beat me to it , but same idea. Also, you would replace `, 5, 4)`

with `, 6, 5`

above. Either this or Menno’s version of the function should work.

Thanks both, this works great!

While I’m here - I’m currently using the ruler in paraview to figure out the dimensions of the cells, is there a more elegant way to know what size they are for a specific geometry?

What you can do is compute the dimensions of every refinement level by hand. If you have a 2d cartesian box of 200x400 and you have an initial subdivision in the length, the coarsest element is 200x200, one refinement up is 100x100, etc. Then you only need to know at what refinement level each cell is, which is usually easy to estimate.

Would this work for you?

Yea that makes sense. But is there a specific number of cells we start with? i.e. for a spherical shell how many cells will there be for refinement 0?

There’s an input parameter “Cells along circumference” that you can set

in the .prm file. If you don’t set one, ASPECT will take the default,

which is 12 in 2d and 96 in 3d.

Best

W.