pymor.algorithms.error
¶
Module Contents¶
- pymor.algorithms.error.plot_reduction_error_analysis(result, max_basis_size=None, plot_effectivities=True, plot_condition=True, plot_custom_logarithmic=True, plot_custom_with_errors=False)[source]¶
Plots the results from
reduction_error_analysis
.- Parameters:
result – Dictionary with entries as returned by
reduction_error_analysis
.max_basis_size – Only plot results up to this basis size.
plot_effectivities – If
True
, plot the effectivities of the a posteriori error estimate.plot_condition – If
True
, plot the condition of the reduced system matrix.plot_custom_logarithmic – If
True
, use a logarithmic y-axis to plot the computed custom values.plot_custom_with_errors – It
True
, plot errors and custom values in a single plot (otherwise in separate ones).
- pymor.algorithms.error.reduction_error_analysis(rom, fom, reductor, test_mus, basis_sizes=0, error_estimator=True, condition=False, error_norms=(), error_norm_names=None, error_estimator_norm_index=0, custom=(), custom_names=None, plot=False, plot_custom_logarithmic=True, pool=dummy_pool)[source]¶
Analyze the model reduction error.
The maximum model reduction error is estimated by solving the reduced
Model
for given randomParameters
.- Parameters:
rom – The reduced
Model
.fom – The high-dimensional
Model
.reductor – The reductor which has created
rom
.test_mus – List of
Parameters
to compute the errors for.basis_sizes – Either a list of reduced basis dimensions to consider, or the number of dimensions (which are then selected equidistantly, always including the maximum reduced space dimension). The dimensions are input for the
dim
-Parameter ofreductor.reduce()
.error_estimator – If
True
evaluate the error estimator ofrom
on the testParameters
.condition – If
True
, compute the condition of the reduced system matrix for the given testParameters
(can only be specified ifrom
is an instance ofStationaryModel
androm.operator
is linear).error_norms – List of norms in which to compute the model reduction error.
error_norm_names – Names of the norms given by
error_norms
. IfNone
, thename
attributes of the given norms are used.error_estimator_norm_index – When
error_estimator
isTrue
anderror_norms
are specified, this is the index of the norm inerror_norms
w.r.t. which to compute the effectivity of the error estimator.custom –
List of custom functions which are evaluated for each test
parameter values
and basis size. The functions must have the signaturedef custom_value(rom, fom, reductor, mu, dim): pass
custom_names – List of names to be used for plotting custom values.
plot – If
True
, generate a plot of the computed quantities w.r.t. the basis size.plot_custom_logarithmic – If
True
, use a logarithmic y-axis to plot the computed custom values.pool – If not
None
, theWorkerPool
to use for parallelization.
- Returns:
data – Dict with the following fields:
- mus:
The test
Parameters
which have been considered.- basis_sizes:
The reduced basis dimensions which have been considered.
- norms:
NumPy array
of the norms of the high-dimensional solutions w.r.t. all given testParameters
and norms inerror_norms
. (Only present whenerror_norms
has been specified.)- max_norms:
Maxima of
norms
over the given testParameters
.- max_norm_mus:
Parameters
corresponding tomax_norms
.- errors:
NumPy array
of the norms of the model reduction errors w.r.t. all given testParameters
, reduced basis dimensions and norms inerror_norms
. (Only present whenerror_norms
has been specified.)- max_errors:
Maxima of
errors
over the given testParameters
.- max_error_mus:
Parameters
corresponding tomax_errors
.- rel_errors:
errors
divided bynorms
. (Only present whenerror_norms
has been specified.)- max_rel_errors:
Maxima of
rel_errors
over the given testParameters
.- max_rel_error_mus:
Parameters
corresponding tomax_rel_errors
.- error_norm_names:
Names of the given
error_norms
. (Only present whenerror_norms
has been specified.)- error_estimates:
NumPy array
of the model reduction error estimates w.r.t. all given testParameters
and reduced basis dimensions. (Only present whenerror_estimator
isTrue
.)- max_error_estimate:
Maxima of
error_estimates
over the given testParameters
.- max_error_estimate_mus:
Parameters
corresponding tomax_error_estimates
.- effectivities:
errors
divided byerror_estimates
. (Only present whenerror_estimator
isTrue
anderror_norms
has been specified.)- min_effectivities:
Minima of
effectivities
over the given testParameters
.- min_effectivity_mus:
Parameters
corresponding tomin_effectivities
.- max_effectivities:
Maxima of
effectivities
over the given testParameters
.- max_effectivity_mus:
Parameters
corresponding tomax_effectivities
.- errors:
NumPy array
of the reduced system matrix conditions w.r.t. all given testParameters
and reduced basis dimensions. (Only present whenconditions
isTrue
.)- max_conditions:
Maxima of
conditions
over the given testParameters
.- max_condition_mus:
Parameters
corresponding tomax_conditions
.- custom_values:
NumPy array
of custom function evaluations w.r.t. all given testParameters
, reduced basis dimensions and functions incustom
. (Only present whencustom
has been specified.)- max_custom_values:
Maxima of
custom_values
over the given testParameters
.- max_custom_values_mus:
Parameters
corresponding tomax_custom_values
.- time:
Time (in seconds) needed for the error analysis.
- summary:
String containing a summary of all computed quantities for the largest (last) considered basis size.