The module provides a tool for estimating the error of a numerical solution of an elliptic PDE obtained using pdeModeler.
The project also includes, as a separate submodule, a method for estimating the error for a 1D problem.
The entire module is developed based on the book [1] authored by P. Neittaanmaki and S. Repin.
1D submodule requires Curve Fitting Toolbox.
The Indicator class requires the elliptic PDE problem parameters exported from pdeModeler. The current release only supports the problem in the rectangular domain.
Let
where
Code block 1D numerically shows the validity of the inequality relating the error of the Galerkin approximation
where
User can vary parameters in the section 'setting of research params':
- N is the number of intervals for discretisation (for example, in figures below N = 32 and N = 64);
- flag_Gal_approx is a flag that allows to make the approximation
$u_h$ non-Galerkin (in this case the inequality is violated); - frac_val is parameter for variate the noise level in
$u_h$ (non-Galerkin solution).
%% setting of research params
N = 128;
flag_Gal_approx = false;
frac_val = 0.015;
The coefficient and exact solution of the problem must also be specified (note:
%% init params of problem
alpha_sym = (152*x_sym^3 - 234*x_sym^2 + 97*x_sym + 24)/24;
u_sym = sin(8*pi*x_sym);
An example below shows two histograms for dividing the interval
The function
where function
Let
The indicator of the error is a field constructed by a vector function
The essay [2] also contains a detailed description and numerical example. Two indicators are described below.
This method uses gradient of a numerical solution (
The approximation error estimate is [1]
where
(here
The vector function
User must upload the parameters of his task into the workspace (can be exported from pdeModeler) and pass them to the constructor of Indicator.
The indicator can then be obtained by calling the getIndicator method with the projection_type argument (can be “AG” or “MP”).
Finnaly, the field of the indicator can be marked and plotted using the marker and plotFld methods respectively.
ind_obj = Indicator(gd, a, b, c, e, f, p, t);
indr = ind_obj.getIndicator(projection_type);
indr_m = Indicator.marker(indr);
ind_obj.plotFld(indr_m);
An example below shows three fields: error, AG- and MP- indicators. In the example, the exact solution was known, so the indicators were compared with the actual error field.
The table below shows the reliability of both indicators based on the example above, it was calculated as the ratio of the number of correctly marked elements to the total number of elements.
indicator | marked correctly | total | reliability, % |
---|---|---|---|
AG | 284 | 324 | 87.65 |
MP | 311 | 324 | 95.99 |
[1] P. Neittaanmaki and S. Repin. Reliable methods for computer simulation. Error control and a posteriori estimates. Elsevier, NY, 2004
[2] Alexey Vasilyev. An Error Indicator of Finite Element Solution.