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 = 2 # run adaptivity 2 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
The results shown here are created using 6 refinement steps. However, because it can take a while to run, the ex05.i
input file only specifies running 2 mesh refinement steps. Mesh results from each of the 6 refinement steps 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