Version 1.0 (137 KB) by Alexey
The module provides a tool for estimating the error of a numerical solution of an elliptic PDE obtained using pdeModeler.
Updated 6 Nov 2023
A Posteriori Estimates for Finite Element Approximations
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.
Requirements and Limitations
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 a rectangular domain.
Explicit Residual Method in a 1D Problem
Problem Formulation
Let is the solution of the problem
where .
Code block 1D numerically shows the validity of the inequality relating the error of the Galerkin approximation to the residual [1]
where is norm in .
How to use
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 non-Galerkin (in this case the inequality is violated);
  • frac_val is parameter for variate the noise level in (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 [0, 1] into the 32 and 64 elements.
Methods Based upon Post-processing of Finite Element Approximations
Problem Formulation
The function is the solution to the problem
where function.
Let here also be the Galerkin approximation, it was calculated on the meshgrid of finite elements .
The indicator of the error is a field constructed by a vector function y and defined on each finite element as
The essay [2] also contains a detailed description and numerical example. Two indicators are described below.
Averaging Gradient
This method uses gradient of a numerical solution () and involves averaging this function over a patch (a set of elements with a common vertex) over the entire mesh; and y is a piecewise affine continuation of the resulting function. See more details in [1].
Minimizing the Majorant
The approximation error estimate is [1]
where is the norm in and the majorant by definition is
(here is the Friedrichs' constant).
The vector function , which is used to construct the -indicator, is
How to use
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);
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.
[1] P. Neittaanmaki and S. Repin. Reliable methods for computer simulation. Error control and a posteriori estimates. Elsevier, NY, 2004

Cite As

Alexey (2024). indicator (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2023b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.