Example 05 : Automatic Mesh Adaptivity

MOOSE has support for mesh adaptivity that can automatically refine and coarsen the mesh in areas of higher/lower error when solving problems. This can improve the quality of your results in addition to reducing computation time. You don't need to write any C++ code to use mesh adaptivity. Instead, it can easily be enabled by filling out the Adaptivity section in an input file:

[Adaptivity]
  marker = errorfrac # this specifies which marker from 'Markers' subsection to use
  steps = 6 # run adaptivity 6 times, recomputing solution, indicators, and markers each time

  # Use an indicator to compute an error-estimate for each element:
  [./Indicators]
    # create an indicator computing an error metric for the convected variable
    [./error] # arbitrary, use-chosen name
      type = GradientJumpIndicator
      variable = convected
      outputs = none
    [../]
  [../]

  # Create a marker that determines which elements to refine/coarsen based on error estimates
  # from an indicator:
  [./Markers]
    [./errorfrac] # arbitrary, use-chosen name (must match 'marker=...' name above
      type = ErrorFractionMarker
      indicator = error # use the 'error' indicator specified above
      refine = 0.5 # split/refine elements in the upper half of the indicator error range
      coarsen = 0 # don't do any coarsening
      outputs = none
    [../]
  [../]
[]
(examples/ex05_amr/ex05.i)

More details about this functionality are provided on the Adaptivity page. MOOSE includes multiple Indicators you can use to compute different error estimates in addition to a few Markers.

Results

Mesh results from each refinement step in ex05.i are shown below:

Initial mesh

Adaptivity Step 1

Adaptivity Step 2

Adaptivity Step 3

Adaptivity Step 4

Adaptivity Step 5

Adaptivity Step 6

And here is the final solution after all refinement steps are complete:

Example 5 Output

Complete Source Files