An adaptive polynomial order procedure is available for 2D and Quasi-3D simulations. This procedure consists of the following steps:

- Advance the equations for a determined number of time steps
- Use the sensor defined in equation 9.9 to estimate an error measure (the variable used in the sensor can be specified). The error is defined here as the square of the sensor.
- Use the error to determine if the order in each element should be increased by one, decreased by one, or left unaltered.
- Project the solution in each element to the new polynomial order and use it as an initial condition to restart the equation, repeating all steps a given number of times.

It is important to note that restarting the simulation after the refinement can be an expensive operation (in a typical case 200 times the cost of a single time step). Therefore, the number of steps between successive refinements needs to be carefully chosen, since if this value is too low the procedure becomes inefficient, while if it is too high the refinement might not capture accurately structures that are convected by the flow.

The use of the adaptive polynomial order procedure is enforced through the definition of the
`Driver`

which has to be `Adaptive`

.

The following parameters can be specified in the `PARAMETERS`

section of the session
file:

`NumSteps`

: when using the adaptive order procedure, this parameter determines the number of time steps between successive refinements.`NumRuns`

: this parameter defines the number of times the sequence of solving the equation and refining is performed. Therefore, the total number of time steps in the simulation is NumSteps × NumRuns.`AdaptiveMaxModes`

: sets the maximum number of modes (in each direction) that can be used in an element during the adaptive procedure. The solution will not be refined beyond this point, even if the error is higher than the tolerance. Default value: 12.`AdaptiveMinModes`

: sets the minimal number of modes (in each direction) that can be used in an element during the adaptive procedure. Default value: 4.`AdaptiveUpperTolerance`

: defines a constant tolerance. The polynomial order in an element is increased whenever the error is higher than this value. This can be replaced by a spatially-varying function, as described below. Default value: 10^{-6}.`AdaptiveLowerinModes`

: defines a constant tolerance. The polynomial order in an element is decreased whenever the error is lower than this value. This can also be replaced by a spatially-varying function. Default value: 10^{-8}.`AdaptiveSensorVariable`

: integer defining which variable will be considered when calculating the error. For example, if this parameter is set to 1 in the Incompressible Navier-Stokes Solver, the error will be estimated using the v velocity. Default value: 0.

Spatially varying tolerances can be specified by defining the functions `AdaptiveLowerinModes`

and/or `AdaptiveUpperTolerance`

. In this case, the tolerance in an element is taken as the
average of the function in the quadrature points of the element. If these functions are defined,
the values set for the tolerances in the `PARAMETERS`

section are ignored.

The simulation can be restarted using the final distribution of polynomial orders obtained from the adaptive procedure by setting the expansions as

note that this will only affect the polynomial order. The initial condition still needs to be set correctly, and does not need to come from the same file used for the expansions.