pymor.reductors package¶
Submodules¶
basic module¶

class
pymor.reductors.basic.
GenericRBReconstructor
(RB)[source]¶ Bases:
pymor.core.interfaces.BasicInterface
Simple reconstructor forming linear combinations with a reduced basis.
Methods
GenericRBReconstructor
reconstruct
,restricted_to_subbasis
BasicInterface
disable_logging
,enable_logging
,has_interface_name
,implementor_names
,implementors
,lock
,unlock
,__setattr__
Attributes
BasicInterface
locked
,logger
,logging_disabled
,name
,uid

class
pymor.reductors.basic.
SubbasisReconstructor
(dim, dim_subbasis, old_recontructor=None)[source]¶ Bases:
pymor.core.interfaces.BasicInterface
Returned by
reduce_to_subbasis
.Methods
SubbasisReconstructor
reconstruct
BasicInterface
disable_logging
,enable_logging
,has_interface_name
,implementor_names
,implementors
,lock
,unlock
,__setattr__
Attributes
BasicInterface
locked
,logger
,logging_disabled
,name
,uid

pymor.reductors.basic.
reduce_generic_rb
(discretization, RB, vector_product=None, disable_caching=True, extends=None)[source]¶ Generic reduced basis reductor.
Replaces each
Operator
of the givenDiscretization
with the Galerkin projection onto the span of the given reduced basis.Parameters
 discretization
 The
Discretization
which is to be reduced.  RB
VectorArray
containing the reduced basis on which to project. vector_product
 Inner product for the projection of vectorlike
Operators
. (A typical vectorlike operator would be theinitial_data
Operator
of anInstationaryDiscretization
holding the initial data of a Cauchy problem.)  disable_caching
 If
True
, caching of solutions is disabled for the reducedDiscretization
.  extends
 Set by
greedy
to the result of the last reduction in case the basis extension washierarchic
(ignored).
Returns
 rd
 The reduced
Discretization
.  rc
 The
reconstructor
providing areconstruct(U)
method which reconstructs highdimensional solutions from solutionsU
of the reducedDiscretization
.  reduction_data
 Additional data produced by the reduction process (empty).

pymor.reductors.basic.
reduce_to_subbasis
(discretization, dim, reconstructor=None)[source]¶ Further reduce a
Discretization
to the subbasis formed by the firstdim
basis vectors.This is achieved by calling
projected_to_subbasis
for each operator of the givenDiscretization
. Additionally, if a reconstructor for theDiscretization
is provided, itsrestricted_to_subbasis
method is also called to obtain a reconstructor for the further reducedDiscretization
. OtherwiseSubbasisReconstructor
is used (which will be less efficient).Parameters
 discretization
 The
Discretization
to further reduce.  dim
 The dimension of the subbasis.
 reconstructor
 Reconstructor for
discretization
orNone
.
Returns
 rd
 The further reduced
Discretization
.  rc
 Reconstructor for
rd
.
coercive module¶

class
pymor.reductors.coercive.
ReduceCoerciveEstimator
(residual, residual_range_dims, coercivity_estimator)[source]¶ Bases:
pymor.core.interfaces.ImmutableInterface
Instantiated by
reduce_coercive
.Not to be used directly.
Methods
ReduceCoerciveEstimator
estimate
,restricted_to_subbasis
ImmutableInterface
generate_sid
,unlock
,with_
BasicInterface
disable_logging
,enable_logging
,has_interface_name
,implementor_names
,implementors
,lock
,__setattr__
Attributes
ImmutableInterface
add_with_arguments
,sid
,sid_ignore
,with_arguments
BasicInterface
locked
,logger
,logging_disabled
,name
,uid

class
pymor.reductors.coercive.
ReduceCoerciveSimpleEstimator
(estimator_matrix, coercivity_estimator)[source]¶ Bases:
pymor.core.interfaces.ImmutableInterface
Instantiated by
reduce_coercive_simple
.Not to be used directly.
Methods
ReduceCoerciveSimpleEstimator
estimate
,restricted_to_subbasis
ImmutableInterface
generate_sid
,unlock
,with_
BasicInterface
disable_logging
,enable_logging
,has_interface_name
,implementor_names
,implementors
,lock
,__setattr__
Attributes
ImmutableInterface
add_with_arguments
,sid
,sid_ignore
,with_arguments
BasicInterface
locked
,logger
,logging_disabled
,name
,uid

pymor.reductors.coercive.
reduce_coercive
(discretization, RB, error_product=None, coercivity_estimator=None, disable_caching=True, extends=None)[source]¶ Reductor for
StationaryDiscretizations
with coercive linear operator.This reductor uses
reduce_generic_rb
for the actual reduce basis projection. The only addition is an error estimator which evaluates the dual norm of the residual with respect to a given inner product. For the reduction of the residual we usereduce_residual
for improved numerical stability [BEOR14].[BEOR14] (1, 2) A. Buhr, C. Engwer, M. Ohlberger, S. Rave, A Numerically Stable A Posteriori Error Estimator for Reduced Basis Approximations of Elliptic Equations, Proceedings of the 11th World Congress on Computational Mechanics, 2014. Parameters
 discretization
 The
Discretization
which is to be reduced.  RB
VectorArray
containing the reduced basis on which to project. error_product
 Inner product
Operator
used to calculate Riesz representative of the residual. IfNone
, the Euclidean product is used.  coercivity_estimator
None
or aParameterFunctional
returning a lower bound for the coercivity constant of the given problem. Note that the computed error estimate is only guaranteed to be an upper bound for the error when an appropriate coercivity estimate is specified. disable_caching
 If
True
, caching of solutions is disabled for the reducedDiscretization
.  extends
 Set by
greedy
to the result of the last reduction in case the basis extension washierarchic
(used to prevent recomputation of residual range basis vectors already obtained from previous reductions).
Returns
 rd
 The reduced
Discretization
.  rc
 The
reconstructor
providing areconstruct(U)
method which reconstructs highdimensional solutions from solutionsU
of the reducedDiscretization
.  reduction_data
 Additional data produced by the reduction process (compare the
extends
parameter).

pymor.reductors.coercive.
reduce_coercive_simple
(discretization, RB, error_product=None, coercivity_estimator=None, disable_caching=True, extends=None)[source]¶ Reductor for linear
StationaryDiscretizations
with affinely decomposed operator and rhs.Note
The reductor
reduce_coercive
can be used for arbitrary coerciveStationaryDiscretizations
and offers an improved error estimator with better numerical stability.This reductor uses
reduce_generic_rb
for the actual reduced basis projection. The only addition is an error estimator. The estimator evaluates the norm of the residual with respect to a given inner product.Parameters
 discretization
 The
Discretization
which is to be reduced.  RB
VectorArray
containing the reduced basis on which to project. error_product
 Inner product
Operator
used to calculate the Riesz representative of the residual. IfNone
, the Euclidean product is used.  coercivity_estimator
None
or aParameterFunctional
returning a lower bound for the coercivity constant of the given problem. Note that the computed error estimate is only guaranteed to be an upper bound for the error when an appropriate coercivity estimate is specified. disable_caching
 If
True
, caching of solutions is disabled for the reducedDiscretization
.  extends
 Set by
greedy
to the result of the last reduction in case the basis extension washierarchic
(used to prevent recomputation of residual range basis vectors already obtained from previous reductions).
Returns
 rd
 The reduced
Discretization
.  rc
 The
reconstructor
providing areconstruct(U)
method which reconstructs highdimensional solutions from solutionsU
of the reducedDiscretization
.  reduction_data
 Additional data produced by the reduction process (compare the
extends
parameter).
linear module¶
parabolic module¶

class
pymor.reductors.parabolic.
ReduceParabolicEstimator
(residual, residual_range_dims, initial_residual, initial_residual_range_dims, coercivity_estimator)[source]¶ Bases:
pymor.core.interfaces.ImmutableInterface
Instantiated by
reduce_parabolic
.Not to be used directly.
Methods
ReduceParabolicEstimator
estimate
,restricted_to_subbasis
ImmutableInterface
generate_sid
,unlock
,with_
BasicInterface
disable_logging
,enable_logging
,has_interface_name
,implementor_names
,implementors
,lock
,__setattr__
Attributes
ImmutableInterface
add_with_arguments
,sid
,sid_ignore
,with_arguments
BasicInterface
locked
,logger
,logging_disabled
,name
,uid

pymor.reductors.parabolic.
reduce_parabolic
(discretization, RB, product=None, coercivity_estimator=None, disable_caching=True, extends=None)[source]¶ Reductor for parabolic equations.
This reductor uses
reduce_generic_rb
for the actual RBprojection. The only addition is the assembly of an error estimator which bounds the discrete l2in time / energyin space error similar to [GP05], [HO08] as follows:Here, denotes the norm induced by the problem’s mass matrix (e.g. the L^2norm) and is an arbitrary energy norm w.r.t. which the space operator is coercive, and is a lower bound for its coercivity constant. Finally, denotes the implicit Euler timestepping residual for the (fixed) time step size ,
where denotes the mass operator and the source term. The dual norm of the residual is computed using the numerically stable projection from [BEOR14].
Warning
The reduced basis
RB
is required to be orthonormal w.r.t. the given energy product. If not, the projection of the initial values will be computed incorrectly.[GP05] M. A. Grepl, A. T. Patera, A Posteriori Error Bounds For ReducedBasis Approximations Of Parametrized Parabolic Partial Differential Equations, M2AN 39(1), 157181, 2005. [HO08] B. Haasdonk, M. Ohlberger, Reduced basis method for finite volume approximations of parametrized evolution equations, M2AN 42(2), 277302, 2008. Parameters
 discretization
 The
InstationaryDiscretization
which is to be reduced.  RB
VectorArray
containing the reduced basis on which to project. product
 The energy inner product
Operator
w.r.t. the reduction error is estimated. RB must be to be orthonomrmal w.r.t. this product!  coercivity_estimator
None
or aParameterFunctional
returning a lower bound for the coercivity constant ofdiscretization.operator
w.r.t.product
. disable_caching
 If
True
, caching of solutions is disabled for the reducedDiscretization
.  extends
 Set by
greedy
to the result of the last reduction in case the basis extension washierarchic
(used to prevent recomputation of residual range basis vectors already obtained from previous reductions).
Returns
 rd
 The reduced
Discretization
.  rc
 The reconstructor providing a
reconstruct(U)
method which reconstructs highdimensional solutions from solutionsU
of the reducedDiscretization
.  reduction_data
 Additional data produced by the reduction process (compare the
extends
parameter).
residual module¶

class
pymor.reductors.residual.
ImplicitEulerResidualOperator
(operator, mass, functional, dt, name=None)[source]¶ Bases:
pymor.operators.basic.OperatorBase
Returned by
reduce_implicit_euler_residual
.Methods
Attributes

apply
(U, U_old, ind, ind_old=None, mu=None)[source]¶ Apply the operator to a
VectorArray
.Parameters
 U
VectorArray
of vectors to which the operator is applied. ind
 The indices of the vectors in
U
to which the operator shall be applied (see theVectorArray
documentation for further details).  mu
 The
Parameter
for which to evaluate the operator.
Returns
VectorArray
of the operator evaluations.


class
pymor.reductors.residual.
NonProjectedImplicitEulerResidualOperator
(operator, mass, functional, dt, product)[source]¶ Bases:
pymor.reductors.residual.ImplicitEulerResidualOperator
Returned by
reduce_implicit_euler_residual
.Not to be used directly.
Methods
Attributes

apply
(U, U_old, ind=None, ind_old=None, mu=None)[source]¶ Apply the operator to a
VectorArray
.Parameters
 U
VectorArray
of vectors to which the operator is applied. ind
 The indices of the vectors in
U
to which the operator shall be applied (see theVectorArray
documentation for further details).  mu
 The
Parameter
for which to evaluate the operator.
Returns
VectorArray
of the operator evaluations.


class
pymor.reductors.residual.
NonProjectedReconstructor
(product)[source]¶ Bases:
pymor.core.interfaces.ImmutableInterface
Returned by
reduce_residual
.Not to be used directly.
Methods
Attributes
ImmutableInterface
add_with_arguments
,sid
,sid_ignore
,with_arguments
BasicInterface
locked
,logger
,logging_disabled
,name
,uid

class
pymor.reductors.residual.
NonProjectedResidualOperator
(operator, rhs, rhs_is_functional, product)[source]¶ Bases:
pymor.reductors.residual.ResidualOperator
Returned by
reduce_residual
.Not to be used directly.
Methods
Attributes

apply
(U, ind=None, mu=None)[source]¶ Apply the operator to a
VectorArray
.Parameters
 U
VectorArray
of vectors to which the operator is applied. ind
 The indices of the vectors in
U
to which the operator shall be applied (see theVectorArray
documentation for further details).  mu
 The
Parameter
for which to evaluate the operator.
Returns
VectorArray
of the operator evaluations.


class
pymor.reductors.residual.
ResidualOperator
(operator, rhs, rhs_is_functional=True, name=None)[source]¶ Bases:
pymor.operators.basic.OperatorBase
Returned by
reduce_residual
.Methods
Attributes

apply
(U, ind=None, mu=None)[source]¶ Apply the operator to a
VectorArray
.Parameters
 U
VectorArray
of vectors to which the operator is applied. ind
 The indices of the vectors in
U
to which the operator shall be applied (see theVectorArray
documentation for further details).  mu
 The
Parameter
for which to evaluate the operator.
Returns
VectorArray
of the operator evaluations.


pymor.reductors.residual.
reduce_implicit_euler_residual
(operator, mass, dt, functional=None, RB=None, product=None, extends=None)[source]¶ Reduced basis residual reductor with mass operator for implicit Euler timestepping.
Given an operator, mass and a functional, the concatenation of residual operator with the Riesz isomorphism is given by:
riesz_residual.apply(U, U_old, mu) == product.apply_inverse(operator.apply(U, mu) + 1/dt*mass.apply(U, mu)  1/dt*mass.apply(U_old, mu)  functional.as_vector(mu))
This reductor determines a lowdimensional subspace of the image of a reduced basis space under
riesz_residual
usingestimate_image_hierarchical
, computes an orthonormal basisresidual_range
of this range space and then returns the PetrovGalerkin projectionprojected_riesz_residual === riesz_residual.projected(range_basis=residual_range, source_basis=RB)
of the
riesz_residual
operator. Given reduced basis coefficient vectorsu
andu_old
, the dual norm of the residual can then be computed asprojected_riesz_residual.apply(u, u_old, mu).l2_norm()
Moreover, a
reconstructor
is provided such thatreconstructor.reconstruct(projected_riesz_residual.apply(u, u_old, mu)) == riesz_residual.apply(RB.lincomb(u), RB.lincomb(u_old), mu)
Parameters
 operator
 See definition of
riesz_residual
.  mass
 The mass operator. See definition of
riesz_residual
.  dt
 The time step size. See definition of
riesz_residual
.  functional
 See definition of
riesz_residual
. IfNone
, zero righthand side is assumed.  RB
VectorArray
containing a basis of the reduced space onto which to project. product
 Inner product
Operator
w.r.t. which to compute the Riesz representatives.  extends
 Set by
greedy
to the result of the last reduction in case the basis extension washierarchic
(used to prevent recomputation ofresidual_range
basis vectors already obtained from previous reductions).
Returns
 projected_riesz_residual
 See above.
 reconstructor
 See above.
 reduction_data
 Additional data produced by the reduction process (compare the
extends
parameter).

pymor.reductors.residual.
reduce_residual
(operator, rhs=None, RB=None, rhs_is_functional=True, product=None, extends=None)[source]¶ Generic reduced basis residual reductor.
Given an operator and a righthand side, the residual is given by:
residual.apply(U, mu) == operator.apply(U, mu)  rhs.as_vector(mu)
When the rhs is a functional we are usually interested in the Riesz representative of the residual:
residual.apply(U, mu) == product.apply_inverse(operator.apply(U, mu)  rhs.as_vector(mu))
Given a basis
RB
of a subspace of the source space ofoperator
, this method usesestimate_image_hierarchical
to determine a lowdimensional subspace containing the image of the subspace underresidual
(resp.riesz_residual
), computes an orthonormal basisresidual_range
for this range space and then returns the PetrovGalerkin projectionprojected_residual === residual.projected(range_basis=residual_range, source_basis=RB)
of the residual operator. Given an reduced basis coefficient vector
u
, w.r.t.RB
, the (dual) norm of the residual can then be computed asprojected_residual.apply(u, mu).l2_norm()
Moreover, a
reconstructor
is provided such thatreconstructor.reconstruct(projected_residual.apply(u, mu)) == residual.apply(RB.lincomb(u), mu)
Parameters
 operator
 See definition of
residual
.  rhs
 See definition of
residual
. IfNone
, zero righthand side is assumed.  rhs_is_functional
 Set this to
True
whenrhs
is aFunctional
.  RB
VectorArray
containing a basis of the reduced space onto which to project. product
 Inner product
Operator
w.r.t. which to compute the Riesz representatives in caserhs_is_functional
isTrue
. Whenproduct
isNone
, no Riesz representatives are computed  extends
 Set by
greedy
to the result of the last reduction in case the basis extension washierarchic
(used to prevent recomputation ofresidual_range
basis vectors already obtained from previous reductions).
Returns
 projected_residual
 See above.
 reconstructor
 See above.
 reduction_data
 Additional data produced by the reduction process (compare the
extends
parameter).