pymor.models.hierarchy

Module Contents

class pymor.models.hierarchy.ModelHierarchy(fom, reductor_factories, tol, time_reduction=np.max)[source]

Bases: pymor.models.interface.Model

Adaptive hierarchy of models of increasing fidelity.

The hierarchy consists of a sequence of reduced models of increasing fidelity together with a high-fidelity reference model (typically the full-order model) that serves as the final fallback. For a new parameter, the cheapest model is evaluated first and the accuracy of its result is verified by means of an a posteriori error estimator. If the estimated error is smaller than the prescribed tolerance tol, the corresponding (reconstructed) solution is returned. Otherwise, the hierarchy falls back to the next more accurate model, until either a model is accurate enough or the reference model is reached.

The hierarchy always tries the faster models first, until a solution is obtained that fulfills the accuracy requirement. Whenever the hierarchy has to fall back to a more accurate model, the cheaper models below it are adapted using the more accurate solution as training data (e.g. the reduced basis is extended or a data-driven surrogate is retrained). The hierarchy therefore starts with empty reduced models and improves them on demand. Models are only adapted when an actual solution or output is requested; queries for error estimates alone leave the hierarchy unchanged.

This hierarchy is not restricted to a fixed set of models: any number of adaptive reductors can be combined, e.g., only a reduced basis reductor together with a full-order model, or a data-driven surrogate on top of a reduced basis model. The implementation is based on the strategies described in [HKO+23].

Parameters:
  • fom – The high-fidelity reference model used as the final fallback.

  • reductor_factories – Sequence of callables, ordered from the highest-fidelity reduced model down to the cheapest one (i.e. the reductor right below the reference model first). Each callable is passed the next higher-fidelity model (starting with fom) and has to return an adaptive reductor for the level below it. A reductor has to provide reduce, reconstruct and adapt methods (see ProjectionBasedReductor and AdaptiveDataDrivenReductor).

  • tol – Tolerance against which the estimated errors are compared to decide which model’s solution to return.

  • time_reduction – Callable mapping a (possibly time-dependent) error estimate to a single scalar that is compared against tol. For instationary problems the error estimate is a trajectory over time; the default numpy.max uses the maximum in time (i.e. the \(\ell^\infty\)-in-time norm). Other choices (e.g. the value at the final time or an \(\ell^2\)-in-time norm) can be passed here.