This routine computes for each element whether the solution in it is
considered to be deviating from the mean above the given threshold or
not. The logical result is stored in
var%deviates for each element.
The total number of deviating elements is stored in
The variation is computed by the sum of the absolute values of all higher modes divided by the first mode. As we are using series of Legendre polynomials this also is a bounding estimation for the maximal (relative) deviation from the mean in this element.
A variation of 0.01 for example would imply that the state in the element is guaranteed to nowhere deviate from the mean by more than 1 percent. However, this is a very rough estimation and the actual maximal deviation from the mean is probably much lower (at least for sufficiently high polynomial degrees).
If the mean is too close to 0, we use epsilon for the normalization instead of the actual mean.
The computation is done for the current data found in
previous computations of these flags will be discarded by this routine.
Variable data to compute the deviation for.
Relative threshold to use as decision whether an element has a high deviation or not.
If the absolute value of higher modes sums to a larger value than threshold times the first mode (integral mean), the element is marked as deviating.
A minimal mean value to use as comparison (to cut off changes that are too close to 0).
This should be small but has to be larger than 0.