Analyzing coherent structures by means of dynamic mode decomposition

Andre Weiner
TU Braunschweig, Institute of Fluid Mechanics

Outline

  1. Simulation overview
  2. Introduction to DMD
  3. Preliminary flow analysis
  4. DMD with Python
  5. DMD with OpenFOAM

Training material available at:

github.com/AndreWeiner/ofw2022_dmd_training

(download the datasets if you want to work alongside)

Simulation overview

Flow past a surface mounted cube at $Re=40000$.

Simulation details:

OpenFoam - surfaceMountedCube

Introduction to DMD

Modal decomp. = spatial structures + temp. behavior

Preliminaries - state vector and data matrix:

$\mathbf{x}_n$ - state vector (e.g., pressure, velocity, ...)

$$ \mathbf{X} = \left[ \begin{array}{cccc} | & | & & | \\ \mathbf{x}_1 & \mathbf{x}_2 & ... & \mathbf{x}_{N} \\ | & | & & | \\ \end{array}\right] $$

Preliminaries - singular value decomposition (SVD):

$$ \mathbf{X} = \mathbf{U\Sigma V}^T $$

  • $\mathbf{U}$ - left singular vectors
  • $\mathbf{\Sigma}$ - singular values
  • $\mathbf{V}$ - right singular vectors
  • $\mathbf{U}$ and $\mathbf{V}$ are orthonormal
  • non-zero $\sigma_{ij}$ on diagonal of $\mathbf{\Sigma}$

DMD core idea:

$$ \mathbf{x}_{n+1} = \mathbf{Ax}_n $$

$\mathbf{A}\in \mathbb{C}^{M\times M}$ - (best-fit) linear operator

How to compute $\mathbf{A}$?

$$ \underbrace{[\mathbf{x}_2, ..., \mathbf{x}_N]}_{\mathbf{X}^\prime} = A \underbrace{[\mathbf{x}_1, ..., \mathbf{x}_{N-1}]}_{\mathbf{X}} $$

$$ \mathbf{X}^\prime = \mathbf{AX} \rightarrow A\approx \mathbf{X}^\prime\mathbf{X}^{-1} = \mathbf{X}^\prime\mathbf{V\Sigma}^{-1}\mathbf{U}^T $$

best-fit (least squares) linear operator

The mode decomposition part:

$$ \mathbf{A} = \mathbf{\Phi\Lambda\Phi}^{-1} $$ $$ \mathbf{x}_2 = \mathbf{Ax}_1 = \mathbf{\Phi\Lambda\Phi}^{-1} \mathbf{x}_1 $$ $$ \mathbf{x}_3 = \mathbf{AAx}_1 = \mathbf{\Phi\Lambda\Phi}^{-1}\mathbf{\Phi\Lambda\Phi}^{-1} \mathbf{x}_1 = \mathbf{\Phi\Lambda}^{2}\mathbf{\Phi}^{-1} \mathbf{x}_1 $$ $$ \mathbf{x}_N = \mathbf{\Phi\Lambda}^{N-1}\mathbf{\Phi}^{-1} \mathbf{x}_1 $$

Only the $\mathbf{\Lambda}$ term changes!

Reconstruction and terminology:

$$ \mathbf{x}_n = \sum\limits_{j=1}^{N}\mathbf{\phi}_j \lambda_j^{n-1} b_j $$

  • DMD modes - column vectors $\mathbf{\phi}_j$
  • mode amplitudes - $\mathbf{b} = \mathbf{\Phi}^{-1}\mathbf{x}_1$
  • eigenvalues describe time dynamics

What is the meaning of complex eigenvalues? Time-continuous formulation:

$$ \frac{\mathrm{d}\mathbf{x}}{\mathrm{d}t} = \mathbf{\mathcal{A}x} $$

Analytical solution by diagonalization of $\mathbf{\mathcal{A}}$:

$$ \frac{\mathrm{d}\mathbf{x}}{\mathrm{d}t} = \mathbf{\Phi}\tilde{\mathbf{\Lambda}}\mathbf{\Phi}^{-1}\mathbf{x} $$

$$ \mathbf{\Phi}^{-1}\frac{\mathrm{d}\mathbf{x}}{\mathrm{d}t} = \tilde{\mathbf{\Lambda}}\mathbf{\Phi}^{-1}\mathbf{x} $$

substitution $\mathbf{y} = \mathbf{\Phi}^{-1}\mathbf{x}$

$$ \frac{\mathrm{d}\mathbf{y}}{\mathrm{d}t} = \tilde{\mathbf{\Lambda}}\mathbf{y} $$

$$ y_1 = e^{\lambda_1 t} y_1(t=0),\ y_2=... $$

$$ \mathbf{y}(t) = \mathrm{exp}(\tilde{\mathbf{\Lambda}}t)\mathbf{y}_0 $$

$$ \mathbf{y}(t) = \mathrm{exp}(\tilde{\mathbf{\Lambda}}t)\mathbf{y}_0 $$

back-substitution $\mathbf{y} = \mathbf{\Phi}^{-1}\mathbf{x}$

$$ \mathbf{x}(t) = \mathbf{\Phi}\mathrm{exp}(\tilde{\mathbf{\Lambda}}t)\underbrace{\mathbf{\Phi}^{-1}\mathbf{x}_0}_{\mathbf{b}} $$

Back to the meaning of complex eigenvalues:

$$ \begin{align} \tilde{\lambda}_j &= a_i + b_i j \\ \mathrm{exp}\left(\tilde{\lambda}_i t\right) &= \mathrm{exp}\left((a_i+b_i j) t\right)\\ &= \mathrm{exp}\left(a_i t\right)\mathrm{exp}\left(b_i j t\right) \\ &= \mathrm{exp}\left(a_i t\right) \left(\mathrm{cos}\left(b_i t\right)+j\mathrm{sin}\left(b_i t\right)\right), \end{align} $$

  • $Re(\tilde{\lambda}_i)$ - growth/decay rate
  • $Im(\tilde{\lambda}_i) = 2\pi f_i$ - frequency

Preliminary flow analysis

$\rightarrow$ open preliminary_flow_analysis.ipynb

DMD in Python

$\rightarrow$ open dmd_flowtorch.ipynb

Flow past a surface mounted cube at $Re=40000$.

Reconstruction of main vortex shedding mode.

Reconstruction of high-frequency vortex shedding mode.

DMD with OpenFOAM

$\rightarrow$ open fullCaseDMD

Advantages of OpenFOAM-based DMD:

  • runtime processing of snapshots
  • MPI-parallel
  • everything in OpenFOAM/ParaView

Some possible improvements:

  • stabilize eigen-decomposition
  • weighting with cell volumes/areas
  • application to cell sets/zones
  • application to sampled surfaces
  • optimization of mode amplitudes
  • additional state vector norms

What's next?

Analysis of transonic shock buffets using DMD

$\rightarrow$ Aerodynamics I, 10:00 am (Tuesday), Sixties

Data-driven modeling SIG

SIG workshop meeting today at 4:45 pm

THE END

Thank you for you attention!

for2895