Physics-informed DMD

Derived module from dmd.py for Physics-informed DMD.

References: - Peter J. Baddoo, Benjamin Herrmann, Beverley J. McKeon, J. Nathan Kutz, and Steven L. Brunton. Physics-informed dynamic mode decomposition (pidmd). 2021. arXiv:2112.04307.

class PiDMD(manifold, manifold_opt=None, compute_A=False, svd_rank=-1, tlsq_rank=0, opt=False)[source]

Bases: DMD

Physics-informed Dynamic Mode Decomposition.

Parameters:
  • manifold (str) – the matrix manifold to restrict the full operator A to. The following matrix manifolds are permissible: - “unitary” - “uppertriangular” - “lowertriangular” - “diagonal” - “symmetric” - “skewsymmetric” - “toeplitz” - “hankel” - “circulant” - “circulant_unitary” - “circulant_symmetric” - “circulant_skewsymmetric” - “symmetric_tridiagonal” - “BC” (block circulant) - “BCTB” (BC with tridiagonal blocks) - “BCCB” (BC with circulant blocks) - “BCCBunitary” (BCCB and unitary) - “BCCBsymmetric” (BCCB and symmetric) - “BCCBskewsymmetric” (BCCB and skewsymmetric)

  • manifold_opt (int, tuple(int,int), or numpy.ndarray) – option used to specify certain manifolds. If manifold is “diagonal”, manifold_opt may be used to specify the width of the diagonal of A. If manifold_opt is an integer k, A is banded, with a lower and upper bandwidth of k-1. If manifold_opt is a tuple containing two integers k1 and k2, A is banded with a lower bandwidth of k1-1 and an upper bandwidth of k2-1. Finally, if manifold_opt is a numpy array of size (len(X), 2), the entries of manifold_opt are used to explicitly define the the upper and lower bounds of the indices of the non-zero elements of A. If manifold starts with “BC”, manifold_opt must be a 2D tuple that specifies the desired dimensions of the blocks of A. Note that all other manifolds do not use manifold_opt.

  • compute_A (bool) – Flag that determines whether or not to compute the full Koopman operator A.

  • svd_rank (int or float) – the rank for the truncation; If 0, the method computes the optimal rank and uses it for truncation; if positive integer, the method uses the argument for the truncation; if float between 0 and 1, the rank is the number of the biggest singular values that are needed to reach the ‘energy’ specified by svd_rank; if -1, the method does not compute truncation. Default is -1, meaning no truncation.

  • tlsq_rank (int) – rank truncation computing Total Least Square. Default is 0, meaning no truncation.

  • opt (bool or int) – If True, amplitudes are computed like in optimized DMD (see _compute_amplitudes() for reference). If False, amplitudes are computed following the standard algorithm. If opt is an integer, it is used as the (temporal) index of the snapshot used to compute DMD modes amplitudes (following the standard algorithm). The reconstruction will generally be better in time instants near the chosen snapshot; however increasing opt may lead to wrong results when the system presents small eigenvalues. For this reason a manual selection of the number of eigenvalues considered for the analyisis may be needed (check svd_rank). Also setting svd_rank to a value between 0 and 1 may give better results. Default is False.

property A

Get the full Koopman operator A.

Returns:

the full Koopman operator A.

Return type:

numpy.ndarray

class PiDMDOperator(manifold, manifold_opt, compute_A, svd_rank)[source]

Bases: DMDOperator

DMD operator for Physics-informed DMD.

Parameters:
  • manifold (str) – the matrix manifold for the full DMD operator A.

  • manifold_opt (int, tuple(int,int), or numpy.ndarray) – option used to specify certain manifolds. If manifold is “diagonal”, manifold_opt may be used to specify the width of the diagonal of A. If manifold starts with “BC”, manifold_opt must be a 2D tuple that specifies the desired dimensions of the blocks of A.

  • compute_A (bool) – Flag that determines whether or not to compute the full Koopman operator A.

  • svd_rank (int or float) – the rank for the truncation; If 0, the method computes the optimal rank and uses it for truncation; if positive integer, the method uses the argument for the truncation; if float between 0 and 1, the rank is the number of the biggest singular values that are needed to reach the ‘energy’ specified by svd_rank; if -1, the method does not compute truncation.

property A

Get the full Koopman operator A.

Returns:

the full Koopman operator A.

Return type:

numpy.ndarray

_check_compute_A()[source]

Helper method that checks that compute_A is True. Throws an error if compute_A is False.

_compute_procrustes(X, Y)[source]

Private method that computes the best-fit linear operator A in the relationship Y = AX such that A is restricted to the family of matrices defined by the given manifold (and manifold option if applicable). Computes and returns a dictionary that contains either… (1) the reduced operator “atilde”, (2) the full operator “A”, or (3) the “eigenvalues” and eigenvectors of A, referred to as “modes”, depending on the chosen manifold and the compute_A parameter.

compute_operator(X, Y)[source]

Compute and store the low-rank operator and the full operator A.

Parameters:
  • X (numpy.ndarray) – matrix containing the snapshots x0,..x{n-1} by column.

  • Y (numpy.ndarray) – matrix containing the snapshots x1,..x{n} by column.

Returns:

the (truncated) left-singular vectors matrix, the (truncated) singular values array, and the (truncated) right-singular vectors matrix of X.

Return type:

numpy.ndarray, numpy.ndarray, numpy.ndarray