DMD 算法汇总

  • POD
  • standard DMD
  • On-line DMD
  • Hankel-DMD
  • Koopman mode decomposition

持续更新中。。

POD

realization of a stationary stochastic process and therefore can use statistical tools such as POD to obtain a meaningful decomposition. POD is a linear decomposition of the flow field into spatially orthogonal modes and uncorrelated temporal coefficients.

the chaotic component $u_c(x,y,t)$ 可以分解:

其中, $\phi_k$ 为POD 模态3, $a_k$ 与时间相关。

DMD 或 Koopman decomposition mode, could evolve exponentially with time. POD 模态 互相空间正交,DMD 不必。POD provide a robust representation of post-transient chaotic components since the modes become independent of the initial condition due to 遍历性.

在该3文献中,Koopman modes 和 POD 模态同时使用,the most economical choices for constructing low-dimensional approximations of the quasi-periodic and chaotic components of the flow respectively.

stack the modes by starting from the Koopman modes (including the mean flow) in the order of decreasing energy and then use the POD modes of the chaotic component with the same order.

standard DMD

where $F$ denotes the Frobenius norm on matrices. The unique minimum-norm solution to this least-squares problem is given by

where $X_k^+$ denotes the Moore-Penrose pseudoinverse of $X_k$.

Here, we shall assume that $X_k$ has full row rank, in which case $X_k X_k^T$ is invertible, and

The $A_k$ given above is the unique solution that minimizes $J_k$.

Consider minimizing a modified cost function:

where $0<\rho \leqq 1$.

On-line DMD1

这个算法特别适合实验数据测点数n比较小,而时间t非常大的实时迭代更新.

一般一个snapshots的展开的列数相对较大,但snapshot数较少. 为了满足实时性计算性能要求,参考文献提出了类似于classical recursive least-squares estimation algorithm recursive least-squares algorithm update a vector in real time.

首先,将上面$A_k=Y_k X_k^+$改写为

那么,为了计算下个时间步的$Ak$,则需要更新$Q{k+1}$和$P_{k+1}$

上述公式说明了,可以通过单单更新rank-1来找到下一个时间不的Q和P矩阵。

这样就可以更新下个时间步的DMD矩阵:

计算$P_k^{-1}$还要设计到求逆,这是非常耗时的,$O(n^3)$. 可以通过Sherman-Morrision formula进行简化2

把上面$\href{ #Overlinev}{公式}$ 应用到P

因此:

简化last two terms,

所以:

  • 解释:更新A的过程可以看成 将$y{k+1}-A_kx{k+1}$的误差用于更正$A_{k+1}$.
  • $Ak x{k+1}$ 和 $Pk x{k+1}$大概需要$4n^2$floating-point. 而 standard DMD 为 $O(kn^2
  • 思考: 这个获取可以用在DMD旋转失稳的旋转速度的捕捉,随着工况的变化,该速度一直在变化,也带来了频率的变化。

    可以用来作失速前的预警。

目前有做过尝试,但是由于time-delay的限制,效果不明显。

Hankel-DMD

Calculate the Koopman spectrum is to apply DMD to Hankel matrix of data. The Hankel matrix is created by the delay-embedding of time series measurements on the observables. Delay-embedding is an established method for geometric reconstruction of attractors for nonlinear systems based on measurements of generic observables.

Connection between linear analysis of delay-embedded data and identification of nonlinear systems using the Koopman linear analysis.

projections of data vectors converge to function projections in the space of observables.

new connection between the SVD and POD on the ensemble of observables on ergodic dynamical systems.

Koopman mode decomposition 4

首先从基本的N-S方程的简化形式出发:

g 表示可观,$U^\tau$ denotes maps the function g to a new function $g^\tau$., 为线性算子。所以,通过spectrum和特征值可以了解系统的运行机制。Koopman 特征值具有以下特性:

The Koopman freuqencies, $w_j$:

假定所有可观测的数据全部收敛到Koopman特征函数上,

最后形成Koopman mode decomposition 的基本表达:

The vector $g_i$ called the Koopman mode assosiated with the Koopman frequency $w_j$, describes the components of the observable g obtained by projection of the observable onto the Koopman eigenfunction $\phi_j$.

For chaos behavior, the scalar observable g can be written as

Informally speaking, $i\alpha$ with $\alpha \in (-\infty, \infty)$, denotes a continuum of eigenvalues distributed along the imaginary axis. $dE_\alpha(\cdot)$ is the spectral measure of the Koopman operator.

为了更好的应用于flow application, 转化为内积的形式:

在满足遍历性假设的基础上,有:

即为g的自相关函数。

因此,we can approximation the spectral density of the Koopman operator by first extracting the chaotic component of g, then approximating $r_g$ using finite-time observations, and finally applying inverse Fourier transform to $r_g$.

where $\rho$ is called the Power Speactral Density (PSD) of the stochastic process.

Koopman modes 自然也满足N-S 方程:

其vorticity field

  • 优于DMD的点在于:可以处理宽带噪声;

三步:

  • we apply a high-resolution algorithm - adapted from Laskar- to detect the candidate discrete Koopman frequencies and modes. The Laskar algorithm provides a controllable balance between accuracy and computational efficiency which makes it suitable for large data sets like high-resolution flow snapshots. Moreover, it makes direct use of the harmonic averaging which has proven convergence properties for computation of koopman mode.
  • use the ergodic properties of the attractor to discard the spurious frequencies that are artifacts of the continuous spectra.
  • After extracting the periodic components of the flow, we estimate the continuous Koopman spectrum by the Welch method to the chaotic residual.1

koopmankoopman

提取离散频率,然后continuous spectra estimator to the remainder.

A. Harmonic averaging and DFT

The koopman modes can be computed via direct projection of observables onto the Koopman eufebfybction, $\phi_j$.

Assuming uniform sampling at time instants, approximate the harmonic average as

The harmonic average of observation by DFT:

DFT is shown to be equivalent to DMD when applied to a linearly independent sequence of snapshots with zero mean.

对比

标准DMD:前6阶模态

koopman

Koopman DMD:前7阶模态Sp

前7阶模态Wm;轴向速度

前7阶模态Wr;径向速度

前7阶模态Wt;径向速度

但实验效果不佳!

Hypergraph && mix_norm 7

首先需要获得流场的速度场和速度梯度。

  • 方法1:

对于non-uniform grid, 利用matlab gridfit 函数近似,将非结构网格转化为等间距矩阵。

接着,参考利用Jacobian matrix:

1
2
3
[dxi,dxj]=gradient(x);
[dyi,dyj]=gradient(y);
[dui,duj]=gradient(u);

then the Jacobian of the transformation is

1
2
[dxi dxj
dyi dyj]

the determinant is

1
DET=dxi.*dyj- dxj.*dyi;

the inverse of the Jacobian has these 4 coefficients:

1
2
3
4
JAC11=DET.*dxi;
JAC21=DET.*dyi;
JAC12=DET.*dxj;
JAC22=DET.*dyj;

Then to transform the gradient [dui,duj] into dux, duy you just do:

1
2
dux=dui.*JAC11+duj.*JAC12;
duy=dui.*JAC21+duj.*JAC22;
  • 方法2:无网格法8

meshlessmeshless

Basic theory of the WLS meshless methods

The coordinate difference between the satellite j and the center i can be express as

For simplicity, we use $h_j$ and $l_j$ to denote $h_j^i$ and $l_j^i$, respectively. The vector

starts from i to j, its length is

and the reference radius of cloud as

$M_i$ is the total number of the satellites in the cloud.

The spirit of least-squares method apply Taylor sires about a point $P_i(x_i, y_i)$:

where $f= f(x,y)$ and $f_i = f(x_i,y_i)$ are the function values, $h=x-x_i$ and $l=y-y_i$ are the coordinate differences between the points. The coefficients $a_k(k=1,2,3,4,5)$ represent the partial derivatives of the function at $P_i(x_i,y_i)$:

Keeping the terms until second order, we obtain the approximate function value at Point $P_j(x_j, y_j)$

一阶精度:

and the error between the exact and approximate value is

A weight function is introduced here to construct $e_j$ considering the effect of different distance between the satellite j and the center i :

Then for cloud $C_i$, the total error can be estimated by the following expression:

In order to minimize the error, its derivatives about $a_1$ and $a_2$ are set to zero:

and we gain a set of linear equtions

If the matrix A is not singular, this system of equations can be solved by the following simple strategy:

The solution can be written into linear combinations of the function values at different points

where, $\alpha_i$ and $\beta_j$ are computed from $A^{-1}$. By removing the dependence of the points i itself in the derivative approximation to satisfy,

where

  • wlsqm.pdf (old documentation for the old pure-Python version of WLSQM included in FREYA, plus the sensitivity calculation)
  • eulerflow.pdf (clearer presentation of the original version, but without the sensitivity calculation)
  • wlsqm_gen.pdf (theory diff on how to make a version that handles also missing function values; also why WLSQM works and some analysis of its accuracy)
1
2
3
4
5
6
7
def main():
x = np.random.random( (1000, 2) ) # point cloud (no mesh topology!)
F = np.sin(np.pi*x[:,0]) * np.cos(np.pi*x[:,1]) # function values on the point cloud
X,Y,Z = project_onto_regular_grid_2D(x, F, fit_order=2, nk=30)
plot_wireframe( {"x" : (X, r"$x$"),
"y" : (Y, r"$y$"),
"z" : (Z, r"$f(x,y)$")} )

koopman

执行

细节:

numpy读取csv数据, output 格式为ndarray

1
2
us_file_path = "./data/US_video_data_numbers.csv"  # 数据存储路径
t_us = np.genfromtxt(us_file_path, delimiter=",")

scipy读取mat数据

1
2
3
import scipy.io as sio
data = sio.loadmat('train_data.mat');
data = data['data']
  • 目前未解决:

/home/wjq/anaconda3/bin/python /home/wjq/文档/GitHub/MeshlessDerivatives/main.py
Traceback (most recent call last):
File “/home/wjq/文档/GitHub/MeshlessDerivatives/main.py”, line 183, in
main()
File “/home/wjq/文档/GitHub/MeshlessDerivatives/main.py”, line 177, in main
X,Y,Z = project_onto_regular_grid_2D(x, F, fit_order=2, nk=50)
File “/home/wjq/文档/GitHub/MeshlessDerivatives/main.py”, line 92, in project_onto_regular_grid_2D
solver.prepare( xi=x, xk=x[hoods] ) # generate problem matrices from the geometry of the point cloud
File “wlsqm/fitter/expert.pyx”, line 399, in wlsqm.fitter.expert.ExpertSolver.prepare
ValueError: Buffer and memoryview are not contiguous in the same dimension.

Process finished with exit code 1

1. SIAM-Online dynamic mode decomposition for time-varying systems
2. Sherman, Adjustment of an inverse matrix corresponding to a change in one element of a given matrix.
3. Hassan Arbabi, Spectral analysis of mixing in 2D high-Reynolds flows, JFM
4. Study of dynamics in post-transient flows using Koopman mode decomposition-Physical review
5. Geneative stochastic modeling of strongly nonlinear flows with non-Gaussian statistics
6. Particles to Partial Differential Equations Parsimoniously
7. Spectral analysis of mixing in 2D high-Reynolds flows” by H. Arbabi and I. Mezic
8. Evolutionary Design Optimization with Nash Games and Hybridized Mesh/Meshless Methods in Computational Fluid Dynamics

9: