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
Modelfor given randomParameters.- Parameters:
rom – The reduced
Model.fom – The high-dimensional
Model.reductor – The reductor which has created
rom.test_mus – List of
Parametersto 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
Trueevaluate the error estimator ofromon the testParameters.condition – If
True, compute the condition of the reduced system matrix for the given testParameters(can only be specified ifromis an instance ofStationaryModelandrom.operatoris 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, thenameattributes of the given norms are used.error_estimator_norm_index – When
error_estimatorisTrueanderror_normsare specified, this is the index of the norm inerror_normsw.r.t. which to compute the effectivity of the error estimator.custom –
List of custom functions which are evaluated for each test
parameter valuesand 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, theWorkerPoolto use for parallelization.
- Returns:
data – Dict with the following fields:
- mus:
The test
Parameterswhich have been considered.- basis_sizes:
The reduced basis dimensions which have been considered.
- norms:
NumPy arrayof the norms of the high-dimensional solutions w.r.t. all given testParametersand norms inerror_norms. (Only present whenerror_normshas been specified.)- max_norms:
Maxima of
normsover the given testParameters.- max_norm_mus:
Parameterscorresponding tomax_norms.- errors:
NumPy arrayof the norms of the model reduction errors w.r.t. all given testParameters, reduced basis dimensions and norms inerror_norms. (Only present whenerror_normshas been specified.)- max_errors:
Maxima of
errorsover the given testParameters.- max_error_mus:
Parameterscorresponding tomax_errors.- rel_errors:
errorsdivided bynorms. (Only present whenerror_normshas been specified.)- max_rel_errors:
Maxima of
rel_errorsover the given testParameters.- max_rel_error_mus:
Parameterscorresponding tomax_rel_errors.- error_norm_names:
Names of the given
error_norms. (Only present whenerror_normshas been specified.)- error_estimates:
NumPy arrayof the model reduction error estimates w.r.t. all given testParametersand reduced basis dimensions. (Only present whenerror_estimatorisTrue.)- max_error_estimate:
Maxima of
error_estimatesover the given testParameters.- max_error_estimate_mus:
Parameterscorresponding tomax_error_estimates.- effectivities:
errorsdivided byerror_estimates. (Only present whenerror_estimatorisTrueanderror_normshas been specified.)- min_effectivities:
Minima of
effectivitiesover the given testParameters.- min_effectivity_mus:
Parameterscorresponding tomin_effectivities.- max_effectivities:
Maxima of
effectivitiesover the given testParameters.- max_effectivity_mus:
Parameterscorresponding tomax_effectivities.- errors:
NumPy arrayof the reduced system matrix conditions w.r.t. all given testParametersand reduced basis dimensions. (Only present whenconditionsisTrue.)- max_conditions:
Maxima of
conditionsover the given testParameters.- max_condition_mus:
Parameterscorresponding tomax_conditions.- custom_values:
NumPy arrayof custom function evaluations w.r.t. all given testParameters, reduced basis dimensions and functions incustom. (Only present whencustomhas been specified.)- max_custom_values:
Maxima of
custom_valuesover the given testParameters.- max_custom_values_mus:
Parameterscorresponding 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.