# Adaptive Refinement in Advection-Diffusion Problems by Anomaly Detection: A Numerical Study
## 3 Numerical Results
### Example 1: A Reaction-Diffusion Problem  
The first example is a reaction-diffusion problem ([31]), where the velocity field \(\mathbf{b}\) is zero. In this case, the computational domain is the unit square, \(\Omega=[0,1]\times[0,1]\), the source \(f=0\), \(\varepsilon=10^{-3}\) e \(\alpha=1\). The boundary conditions are shown in Figure 1, while an approximation of the solution is shown in Figure 2.  
Since homogeneous boundary conditions are assigned, besides at the four corners, we expect the solution to be zero almost everywhere except at the corners where it spikes to one. In Figure 3, on the left, we report the adapted mesh by using the residual error estimator. The four corners are highly refined, but we can also observe a rather dense grid in the middle of \(\Omega\), which seems unnecessary for this example. Therefore, we applied a threshold to the percentage of values that should be considered anomalous. By trying several different values, we experimentally derived that a good setting for the contamination parameter in the IF algorithm was 0.3. In these terms, only the points with the top 30% negative values will be considered anomalous. With this strategy, we can localize even more by neglecting a certain percentage of triangles that would otherwise be marked as anomalous. The obtained result with this setting can be seen in Figure 3, right. In Table 1, we report the estimated error in the \(L^{2}\) norm and in \(H^{1}\) seminorm, together with the number of elements (NT) per level of refinement (\(n\)), in both cases, i.e., \(c=\texttt{auto}\) and \(c=0.3\). The improvement with the second strategy is evident especially at the final stage: with the same order of magnitude of employed elements, one order of accuracy is gained in the \(L^{2}\) norm. Finally, in Figure 4, we show the comparison with global refinement. Figure 1: Boundary conditions of example 1. Figure 3: Adapted meshes for example 1 by using the residual-based error estimator. (**Left**) The last performed step, where the mesh is mostly refined at the four corners. (**Right**) The final mesh obtained with \(c=0.3\); the corners are highly refined with respect to the rest of the domain. Figure 2: Computed solution for example 1, displayed on the mesh adapted with \(\eta_{Z}\) and \(c=0.3\). In Figure 5, we show the results obtained by using the gradient recovery-based error estimator \(\eta_{Z}\). Moreover, in this case, we performed two tests: one with \(c=\texttt{auto}\) and one with \(c=0.3\). Table 2 collects the \(L^{2}\) norm error and \(H^{1}\) seminorm error. In this case, the benefit of introducing the cutoff percentile is less evident than in the previous example, but we notice that by reducing the number of elements at the first level, more elements were marked at the successive levels compared with the standard case (i.e., \(c=\texttt{auto}\)). This behavior did not lead to a significant gain in accuracy, but the resulting mesh appears more suitable to handle this example since the refinement is more localized at the four corners. In Figure 6, we show the comparison with global refinement. Finally, in Figure 7, the results obtained with \(\eta_{N}\) and with \(c=\texttt{auto}\) (on the left) and \(c=0.3\) (on the right) are shown. In Table 3, we report the results for the \(L^{2}\) norm and \(H^{1}\) seminorm estimates. The resulting mesh, adapted with \(c=0.3\), does not improve the reached accuracy compared to the case \(c=\texttt{auto}\). In fact, the refinement, besides appearing not to be symmetric, appears to be less localized. This can happen as the contamination parameter is only useful to select the top 30% of anomalous triangles, which are not necessarily the ones that exhibit the largest error among the anomalies. In Figure 8, we show the comparison with global refinement. In all three cases, the adaptive refinement achieved better accuracy and a better order of convergence compared to global refinement per used degrees of freedom. Figure 5: Adapted meshes for example 1 with the gradient recovery-based error estimator.