##################### Mesh refinement #########################

# We use adaptive mesh refinement to increase the resolution in regions where
# melt is present, and otherwise use a uniform grid.
subsection Mesh refinement
  set Coarsening fraction                      = 0.5
  set Refinement fraction                      = 0.5

  # A refinement level of 5 (4 global + 1 adaptive refinements) corresponds to
  # a cell size of approximately 1 km.
  set Initial adaptive refinement              = 1
  set Initial global refinement                = 4
  set Strategy                                 = minimum refinement function, composition threshold
  set Time steps between mesh refinement       = 5

  subsection Minimum refinement function
    set Coordinate system   = cartesian
    set Function expression = 4
    set Variable names      = x,y
  end

  # We use a very small refinement threshold for the porosity to make sure that
  # all cells where the two-phase flow equations are solved (melt cells) have
  # the higher resolution.
  subsection Composition threshold
    set Compositional field thresholds = 1e-6, 1.0
  end
end
