modulo-vki 2.0.5__py3-none-any.whl → 2.0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- modulo_vki/core/_pod_space.py +2 -2
- modulo_vki/utils/_utils.py +2 -0
- modulo_vki/utils/others.py +34 -31
- modulo_vki/utils/read_db.py +1 -1
- modulo_vki-2.0.7.dist-info/METADATA +304 -0
- {modulo_vki-2.0.5.dist-info → modulo_vki-2.0.7.dist-info}/RECORD +9 -9
- {modulo_vki-2.0.5.dist-info → modulo_vki-2.0.7.dist-info}/WHEEL +1 -1
- modulo_vki-2.0.5.dist-info/METADATA +0 -96
- {modulo_vki-2.0.5.dist-info → modulo_vki-2.0.7.dist-info}/LICENSE +0 -0
- {modulo_vki-2.0.5.dist-info → modulo_vki-2.0.7.dist-info}/top_level.txt +0 -0
modulo_vki/core/_pod_space.py
CHANGED
|
@@ -154,7 +154,7 @@ def Spatial_basis_POD(D, PSI_P, Sigma_P, MEMORY_SAVING, N_T, FOLDER_OUT='./', N_
|
|
|
154
154
|
R1 = (i - 1) * dim_col
|
|
155
155
|
R2 = i * dim_col
|
|
156
156
|
|
|
157
|
-
if (b ==
|
|
157
|
+
if (b == tot_blocks_row) and (N_S - dim_row * N_PARTITIONS > 0): # Change here
|
|
158
158
|
C1 = C2
|
|
159
159
|
C2 = C1 + (N_S - dim_row * N_PARTITIONS)
|
|
160
160
|
else:
|
|
@@ -173,7 +173,7 @@ def Spatial_basis_POD(D, PSI_P, Sigma_P, MEMORY_SAVING, N_T, FOLDER_OUT='./', N_
|
|
|
173
173
|
else:
|
|
174
174
|
for j in range(R1, R2):
|
|
175
175
|
jj = j - R1
|
|
176
|
-
Phi_P = dps[:, jj] / Sigma_P[
|
|
176
|
+
Phi_P = dps[:, jj] / Sigma_P[j] # Change here
|
|
177
177
|
np.savez(FOLDER_OUT + f"/phi_{j + 1}", phi_p=Phi_P)
|
|
178
178
|
|
|
179
179
|
Phi_P_M = np.zeros((N_S, R))
|
modulo_vki/utils/_utils.py
CHANGED
|
@@ -334,6 +334,8 @@ def switch_eigs(A, n_modes, eig_solver):
|
|
|
334
334
|
idx = np.flip(np.argsort(Lambda_P))
|
|
335
335
|
Lambda_P = Lambda_P[idx]
|
|
336
336
|
Psi_P = Psi_P[:, idx]
|
|
337
|
+
else:
|
|
338
|
+
raise ValueError('eig_solver must be svd_sklearn_randomized, eigh or eigsh')
|
|
337
339
|
|
|
338
340
|
Sigma_P = np.sqrt(Lambda_P)
|
|
339
341
|
|
modulo_vki/utils/others.py
CHANGED
|
@@ -23,8 +23,8 @@ def Plot_Field_TEXT_JET(File):
|
|
|
23
23
|
nxny = Dat.shape[0] # is the to be doubled at the end we will have n_s=2 * n_x * n_y
|
|
24
24
|
n_s = 2 * nxny
|
|
25
25
|
## 1. Reconstruct Mesh from file
|
|
26
|
-
X_S = Dat[:, 0]
|
|
27
|
-
Y_S = Dat[:, 1]
|
|
26
|
+
X_S = Dat[:, 0]
|
|
27
|
+
Y_S = Dat[:, 1]
|
|
28
28
|
# Reshape also the velocity components
|
|
29
29
|
V_X = Dat[:, 2] # U component
|
|
30
30
|
V_Y = Dat[:, 3] # V component
|
|
@@ -194,7 +194,7 @@ def Animation_JET(Giff_NAME,D,X_S,Y_S,In,Fin,Step):
|
|
|
194
194
|
|
|
195
195
|
|
|
196
196
|
|
|
197
|
-
def Plot_2D_CFD_Cyl(Xg,Yg,U,V,k=10,CL=16,Name=''):
|
|
197
|
+
def Plot_2D_CFD_Cyl(Xg,Yg,U,V,k=10,CL=16,Name='', verbose=False):
|
|
198
198
|
# Make a 2D plot of the 2D cylinder test case in Openfoam.
|
|
199
199
|
n_x,n_y=np.shape(Xg)
|
|
200
200
|
U_g=U[:,k].reshape(n_y,n_x).T
|
|
@@ -222,7 +222,9 @@ def Plot_2D_CFD_Cyl(Xg,Yg,U,V,k=10,CL=16,Name=''):
|
|
|
222
222
|
if len(Name) !=0:
|
|
223
223
|
plt.savefig(Name, dpi=200)
|
|
224
224
|
plt.close(fig)
|
|
225
|
-
|
|
225
|
+
|
|
226
|
+
if verbose:
|
|
227
|
+
print('Image exported')
|
|
226
228
|
|
|
227
229
|
return
|
|
228
230
|
|
|
@@ -416,34 +418,35 @@ def Plot_Scalar_Field_Cylinder(X_S,Y_S,V_X,V_Y,Scalar,PLOT,Step,Scale):
|
|
|
416
418
|
|
|
417
419
|
|
|
418
420
|
def plot_grid_cylinder_flow(Xg,Yg,Vxg,Vyg):
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
421
|
+
STEPx=1; STEPy=1
|
|
422
|
+
# This creates the figure
|
|
423
|
+
fig, ax = plt.subplots(figsize=(6, 3))
|
|
424
|
+
Magn=np.sqrt(Vxg**2+Vyg**2)
|
|
425
|
+
# Plot Contour
|
|
426
|
+
#CL=plt.contourf(Xg,Yg,Magn,levels=np.linspace(0,np.max(Magn),5))
|
|
427
|
+
CL=plt.contourf(Xg,Yg,Magn,20,cmap='viridis',alpha=0.95)
|
|
428
|
+
# One possibility is to use quiver
|
|
429
|
+
STEPx=1; STEPy=1
|
|
430
|
+
plt.quiver(Xg[::STEPx,::STEPy],Yg[::STEPx,::STEPy],\
|
|
429
431
|
Vxg[::STEPx,::STEPy],Vyg[::STEPx,::STEPy],color='k')
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
432
|
+
plt.rc('text', usetex=True)
|
|
433
|
+
plt.rc('font', family='serif')
|
|
434
|
+
plt.rc('xtick',labelsize=12)
|
|
435
|
+
plt.rc('ytick',labelsize=12)
|
|
436
|
+
#fig.colorbar(CL,pad=0.05,fraction=0.025)
|
|
437
|
+
ax.set_aspect('equal') # Set equal aspect ratio
|
|
438
|
+
ax.set_xlabel('$x[mm]$',fontsize=13)
|
|
439
|
+
ax.set_ylabel('$y[mm]$',fontsize=13)
|
|
440
|
+
#ax.set_title('Tutorial 2: Cylinder Wake',fontsize=12)
|
|
441
|
+
ax.set_xticks(np.arange(0,70,10))
|
|
442
|
+
ax.set_yticks(np.arange(-10,11,10))
|
|
443
|
+
ax.set_xlim([0,50])
|
|
444
|
+
ax.set_ylim(-10,10)
|
|
445
|
+
circle = plt.Circle((0,0),2.5,fill=True,color='r',edgecolor='k',alpha=0.5)
|
|
446
|
+
plt.gcf().gca().add_artist(circle)
|
|
447
|
+
plt.tight_layout()
|
|
448
|
+
|
|
449
|
+
return fig, ax
|
|
447
450
|
|
|
448
451
|
|
|
449
452
|
|
modulo_vki/utils/read_db.py
CHANGED
|
@@ -114,7 +114,7 @@ class ReadData:
|
|
|
114
114
|
'''Saving data matrix in FOLDER_OUT'''
|
|
115
115
|
os.makedirs(FOLDER_OUT + "/data_matrix", exist_ok=True)
|
|
116
116
|
print(f"Saving the matrix D in {FOLDER_OUT}")
|
|
117
|
-
np.savez(FOLDER_OUT + '/data_matrix/database', D=
|
|
117
|
+
np.savez(FOLDER_OUT + '/data_matrix/database', D=D.astype('float32', casting='same_kind'), n_t=N_T, n_s=N_S)
|
|
118
118
|
else: # try to read the data
|
|
119
119
|
print("Data matrix was not provided, reading it from {}".format(FOLDER_IN))
|
|
120
120
|
# First check if the data were saved in the supported format
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: modulo_vki
|
|
3
|
+
Version: 2.0.7
|
|
4
|
+
Summary: MODULO (MODal mULtiscale pOd) is a software developed at the von Karman Institute to perform Multiscale Modal Analysis of numerical and experimental data.
|
|
5
|
+
Home-page: https://github.com/mendezVKI/MODULO/tree/master/modulo_python_package/
|
|
6
|
+
Author: ['R. Poletti', 'L. Schena', 'D. Ninni', 'M. A. Mendez']
|
|
7
|
+
Author-email: mendez@vki.ac.be
|
|
8
|
+
License: BSD (3-clause)
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Natural Language :: English
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: tqdm
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: scikit-learn
|
|
19
|
+
Requires-Dist: ipykernel
|
|
20
|
+
Requires-Dist: ipython
|
|
21
|
+
Requires-Dist: ipython-genutils
|
|
22
|
+
Requires-Dist: ipywidgets
|
|
23
|
+
Requires-Dist: matplotlib
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
MODULO: a python toolbox for data-driven modal decomposition
|
|
28
|
+
-----------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
.. image:: https://readthedocs.org/projects/modulo/badge/?version=latest
|
|
31
|
+
:target: https://modulo.readthedocs.io/en/latest/?badge=latest
|
|
32
|
+
:alt: Documentation Status
|
|
33
|
+
|
|
34
|
+
.. raw:: html
|
|
35
|
+
|
|
36
|
+
<div style="text-align: center;">
|
|
37
|
+
<img src="https://modulo.readthedocs.io/en/latest/_images/modulo_logo.png" alt="Modulo Logo" width="500"/>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
**MODULO** is a modal decomposition package developed at the von Karman Institute for Fluid Dynamics (VKI).
|
|
41
|
+
It offers a wide range of decomposition techniques, enabling users to select the most suitable method based
|
|
42
|
+
on the specific physics of their problem and their desired outcomes. MODULO can natively handle large
|
|
43
|
+
datasets efficiently, featuring a memory-saving option that partitions the data and computes the decomposition in
|
|
44
|
+
chunks (ninni2020modulo). Additionally, it supports non-uniform meshes through its weighted inner product formulation.
|
|
45
|
+
|
|
46
|
+
While the discontinued MATLAB version of MODULO (ninni2020modulo) is accessible in the “Old_Matlab_Implementation” branch,
|
|
47
|
+
it is no longer maintained. The latest decomposition techniques are exclusively available in the current Python version.
|
|
48
|
+
|
|
49
|
+
As a part of the MODULO project, we provide a series of lectures on data-driven modal decomposition, and its applications.
|
|
50
|
+
These are available at the `MODULO YouTube channel <https://www.youtube.com/@modulompod5682>`_.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
.. contents:: Table of contents
|
|
54
|
+
|
|
55
|
+
Modal decompositions
|
|
56
|
+
--------------------
|
|
57
|
+
Modal decompositions aim to describe the data as a linear combination of *modes*, obtained by projecting the data
|
|
58
|
+
onto a suitable set of basis. For instance, consider a matrix $D(x, t)$, where $x$ and $t$ are the spatial and temporal
|
|
59
|
+
coordinates, respectively, the modal decomposition can be written as:
|
|
60
|
+
|
|
61
|
+
$D(x_i, t_k) = \\phi(x_i) \\Sigma \\psi(t_k)^T$
|
|
62
|
+
|
|
63
|
+
where $\\phi(x_i)$ is the spatial basis, $\\psi(t_k)$ is the temporal basis, and $\\Sigma$ is the modal coefficients.
|
|
64
|
+
Different decompositions employ different basis, such as prescribed Fourier basis ($\\psi_\\mathcal{F}$) for
|
|
65
|
+
the Discrete Fourier Transform (DFT), or data-driven basis, i.e. tailored on the dataset at hand,
|
|
66
|
+
for the Proper Orthogonal Decomposition (POD).
|
|
67
|
+
|
|
68
|
+
We refer to (mendez2022statistical, mendez2022generalizedmultiscalemodalanalysis, Mendez_2023) for an introduction to the topic.
|
|
69
|
+
|
|
70
|
+
MODULO currently features the following decompositions:
|
|
71
|
+
- Discrete Fourier Transform (DFT) (briggs1995dft)
|
|
72
|
+
- Proper Orthogonal Decomposition (POD) (sirovich1987turbulence, berkooz1993proper)
|
|
73
|
+
- Multi-Scale Proper Orthogonal Decomposition (mPOD) (mendez2019multi)
|
|
74
|
+
- Dynamic Mode Decomposition (DMD) (schmid2010dynamic)
|
|
75
|
+
- Spectral Proper Orthogonal Decomposition (SPOD) (csieber2016spectral, towne2018spectral), note that the two are
|
|
76
|
+
different formulations, and both are available in MODULO.
|
|
77
|
+
- Kernel Proper Orthogonal Decomposition (KPOD) (mika1998kernel)
|
|
78
|
+
|
|
79
|
+
We remind the curious reader to the respective references for a detailed description of each decomposition, and to the
|
|
80
|
+
documentation for a practical guide on how to use them in MODULO.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
Release Notes
|
|
84
|
+
-------------
|
|
85
|
+
The latest version of MODULO (v2.0) includes the following updates:
|
|
86
|
+
|
|
87
|
+
1. **Faster EIG/SVD algorithms**, using powerful randomized svd solvers from scikit_learn
|
|
88
|
+
(see `here<https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.TruncatedSVD.html>`_
|
|
89
|
+
and `here <https://scikit-learn.org/stable/modules/generated/sklearn.utils.extmath.randomized_svd.html>`_.)
|
|
90
|
+
It is now possible to select various options as "eig_solver" and "svd_solver",
|
|
91
|
+
offering different trade-offs in terms of accuracy vs computational time.
|
|
92
|
+
|
|
93
|
+
2. **Computation the POD directly via SVD**, using any of the four "svd_solver" options.
|
|
94
|
+
This is generally faster but requires more memory.
|
|
95
|
+
|
|
96
|
+
1. **Faster subscale estimators for the mPOD:** the previous version used the rank of the correlation matrix in each scale to define
|
|
97
|
+
the number of modes to be computed in each portion of the splitting vector before assembling the full basis.
|
|
98
|
+
This is computationally very demanding. This estimation has been replaced by a
|
|
99
|
+
frequency-based threshold (i.e. based on the frequency bins within each portion) since one can show that the
|
|
100
|
+
frequency-based estimator is always more "conservative" than the rank-based estimator.
|
|
101
|
+
|
|
102
|
+
1. **Major improvement on the memory saving option**: the previous version of modulo always required in input the matrix D.
|
|
103
|
+
Then, if the memory saving option was active, the matrix was partitioned and stored locally to free the RAM before computing the
|
|
104
|
+
correlation matrix (see [this tutorial by D. Ninni](https://www.youtube.com/watch?v=LclxO1WTuao)).
|
|
105
|
+
In the new version, it is possible to initialize a modulo object *without* the matrix D (see exercise 5 in the examples).
|
|
106
|
+
Instead, one can create the partitions without loading the matrix D.
|
|
107
|
+
|
|
108
|
+
1. **Implementation of Dynamic Mode Decomposition (DMD)** from (Schmid, P.J 2010)
|
|
109
|
+
|
|
110
|
+
2. **Implementation of the two Spectral POD formulations**, namely the one from (Sieber et al 2016),
|
|
111
|
+
and the one from (Towne et al 2018).
|
|
112
|
+
|
|
113
|
+
3. **Implementation of a kernel version of the POD**, in which the correlation matrix is replaced by a kernel matrix.
|
|
114
|
+
This is described in Lecture 15 of the course `Hands on Machine Learning for Fluid dynamics 2023 <https://www.vki.ac.be/index.php/events-ls/events/eventdetail/552/-/online-on-site-hands-on-machine-learning-for-fluid-dynamics-2023>`_.
|
|
115
|
+
We refer also to: `https://arxiv.org/abs/2208.07746`.
|
|
116
|
+
|
|
117
|
+
1. **Implementation of a formulation for non-uniform meshes**, using a weighted matrix for all the relevant inner products.
|
|
118
|
+
This is currently available only for POD and mPOD but allows for handling data produced from CFD simulation without resampling on a uniform grid (see exercise 4).
|
|
119
|
+
It can be used both with and without the memory-saving option.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Installation
|
|
123
|
+
-------------
|
|
124
|
+
|
|
125
|
+
Installation via pip
|
|
126
|
+
^^^^^^^^^^^^^^^^^^^^
|
|
127
|
+
|
|
128
|
+
You can access the latest update of the modulo python package on PyPI using the command line:
|
|
129
|
+
|
|
130
|
+
.. code-block:: bash
|
|
131
|
+
|
|
132
|
+
$ pip install modulo_vki
|
|
133
|
+
|
|
134
|
+
Installation from source
|
|
135
|
+
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
136
|
+
|
|
137
|
+
Alternatively, you can clone the repository and install the package locally:
|
|
138
|
+
|
|
139
|
+
.. code-block:: bash
|
|
140
|
+
|
|
141
|
+
$ git clone https://github.com/mendezVKI/MODULO.git
|
|
142
|
+
|
|
143
|
+
$ cd MODULO
|
|
144
|
+
|
|
145
|
+
$ python setup.py install
|
|
146
|
+
|
|
147
|
+
or, if you have pip installed in your environment,
|
|
148
|
+
|
|
149
|
+
.. code-block:: bash
|
|
150
|
+
|
|
151
|
+
$ pip install .
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
Documentation
|
|
155
|
+
-------------
|
|
156
|
+
|
|
157
|
+
The documentation of MODULO is available `here <https://modulo.readthedocs.io/en/latest/intro.html>`_. It
|
|
158
|
+
contains a comprehensive guide on how to install and use the package, as well as a detailed description of the
|
|
159
|
+
decompositions required inputs and outputs. A `list of YouTube videos<https://www.youtube.com/@modulompod5682>`_
|
|
160
|
+
is also available to guide the introduce the user to modal decomposition and MODULO.
|
|
161
|
+
|
|
162
|
+
Example
|
|
163
|
+
-------------
|
|
164
|
+
|
|
165
|
+
Example 1: POD decomposition
|
|
166
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
167
|
+
|
|
168
|
+
The following example illustrates how to decompose a data set (D) using the POD decomposition.
|
|
169
|
+
|
|
170
|
+
.. code-block:: python
|
|
171
|
+
|
|
172
|
+
from modulo_vki import ModuloVKI
|
|
173
|
+
import numpy as np
|
|
174
|
+
|
|
175
|
+
# Create a random dataset
|
|
176
|
+
D = np.random.rand(100, 1000)
|
|
177
|
+
|
|
178
|
+
# Initialize the ModuloVKI object
|
|
179
|
+
m = ModuloVKI(D)
|
|
180
|
+
|
|
181
|
+
# Compute the POD decomposition
|
|
182
|
+
phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
|
|
183
|
+
|
|
184
|
+
which returns the spatial basis ($\phi$), the temporal basis ($\psi$), and the modal
|
|
185
|
+
amplitudes ($\Sigma$) of the POD decomposition.
|
|
186
|
+
|
|
187
|
+
Example 2: Memory Saving option
|
|
188
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
189
|
+
|
|
190
|
+
For the Memory Saving option, MODULO decomposes $D$ in `N_partitions`, defined
|
|
191
|
+
by the user (refer to `examples/ex_04_Memory_Saving.py`).
|
|
192
|
+
|
|
193
|
+
.. code-block:: python
|
|
194
|
+
|
|
195
|
+
from modulo_vki import ModuloVKI
|
|
196
|
+
import numpy as np
|
|
197
|
+
|
|
198
|
+
# Create a random dataset
|
|
199
|
+
D = np.random.rand(100, 1000)
|
|
200
|
+
|
|
201
|
+
# Initialize the ModuloVKI object
|
|
202
|
+
m = ModuloVKI(D, N_PARTITIONS=10)
|
|
203
|
+
|
|
204
|
+
# Compute the POD decomposition
|
|
205
|
+
phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
|
|
206
|
+
|
|
207
|
+
Example 3: non-uniform grid
|
|
208
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
209
|
+
|
|
210
|
+
If you are dealing with non-uniform grid (e.g. output of a Computational Fluid Dynamic (CFD) simulation),
|
|
211
|
+
you can use the weighted inner product formulation (refer to `examples/ex_05_nonUniform_POD.py`).
|
|
212
|
+
|
|
213
|
+
.. code-block:: python
|
|
214
|
+
|
|
215
|
+
from modulo_vki import ModuloVKI
|
|
216
|
+
import numpy as np
|
|
217
|
+
|
|
218
|
+
# Create a random dataset
|
|
219
|
+
D = np.random.rand(100, 1000)
|
|
220
|
+
|
|
221
|
+
# Get the area of the grid
|
|
222
|
+
a_dataSet = gridData.compute_cell_sizes()
|
|
223
|
+
area = a_dataSet['Area']
|
|
224
|
+
|
|
225
|
+
# Compute weights
|
|
226
|
+
areaTot = np.sum(area)
|
|
227
|
+
weights = area/areaTot # sum should be equal to 1
|
|
228
|
+
|
|
229
|
+
# Initialize the ModuloVKI object
|
|
230
|
+
m = ModuloVKI(D, weights=weights)
|
|
231
|
+
|
|
232
|
+
# Compute the POD decomposition
|
|
233
|
+
phi_POD, Sigma_POD, psi_POD = m.Compute_POD_K()
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
Community guidelines
|
|
238
|
+
---------------------
|
|
239
|
+
|
|
240
|
+
Contributing to MODULO
|
|
241
|
+
^^^^^^^^^^^^^^^^^^^^^^^
|
|
242
|
+
We welcome contributions to MODULO. To create a new feature, please submit a pull request, specifying the proposed changes and
|
|
243
|
+
providing an example of how to use the new feature (that will be included in the `examples/` folder).
|
|
244
|
+
|
|
245
|
+
The pull request will be reviewed by the MODULO team before being merged into the main branch, and your contribution duly acknowledged.
|
|
246
|
+
|
|
247
|
+
Report bugs
|
|
248
|
+
^^^^^^^^^^^^
|
|
249
|
+
If you find a bug, or you encounter unexpected behaviour, please open an issue on the MODULO GitHub repository.
|
|
250
|
+
|
|
251
|
+
Ask for help
|
|
252
|
+
^^^^^^^^^^^^
|
|
253
|
+
|
|
254
|
+
Citation
|
|
255
|
+
---------
|
|
256
|
+
If you use MODULO in your research, please cite it as follows:
|
|
257
|
+
|
|
258
|
+
``Ninni, D., & Mendez, M. A. (2020). MODULO: A software for Multiscale Proper Orthogonal Decomposition of data. SoftwareX, 12, 100622.``
|
|
259
|
+
|
|
260
|
+
.. code-block:: text
|
|
261
|
+
|
|
262
|
+
@article{ninni2020modulo,
|
|
263
|
+
title={MODULO: A software for Multiscale Proper Orthogonal Decomposition of data},
|
|
264
|
+
author={Ninni, Davide and Mendez, Miguel A},
|
|
265
|
+
journal={SoftwareX},
|
|
266
|
+
volume={12},
|
|
267
|
+
pages={100622},
|
|
268
|
+
year={2020},
|
|
269
|
+
publisher={Elsevier}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
We are currently working on a Journal of Open Source article that will be available soon.
|
|
273
|
+
|
|
274
|
+
References
|
|
275
|
+
----------
|
|
276
|
+
|
|
277
|
+
- Mendez, Miguel Alfonso. "Statistical Treatment, Fourier and Modal Decomposition." arXiv preprint arXiv:2201.03847 (2022).
|
|
278
|
+
- Mendez, M. A. (2023) "Generalized and Multiscale Modal Analysis". In : Mendez M.A., Ianiro, A., Noack, B.R., Brunton, S. L. (Eds),
|
|
279
|
+
"Data-Driven Fluid Mechanics: Combining First Principles and Machine Learning". Cambridge University Press, 2023:153-181.
|
|
280
|
+
https://doi.org/10.1017/9781108896214.013. The pre-print is available at https://arxiv.org/abs/2208.12630.
|
|
281
|
+
- Ninni, Davide, and Miguel A. Mendez. "MODULO: A software for Multiscale Proper Orthogonal Decomposition of data." SoftwareX 12 (2020): 100622.
|
|
282
|
+
- Mendez, Miguel A. "Linear and nonlinear dimensionality reduction from fluid mechanics to machine learning." Measurement Science and Technology 34.4 (2023): 042001.
|
|
283
|
+
- Briggs, William L., and Van Emden Henson. The DFT: an owner's manual for the discrete Fourier transform. Society for Industrial and Applied Mathematics, 1995.
|
|
284
|
+
- Berkooz, Gal, Philip Holmes, and John L. Lumley. "The proper orthogonal decomposition in the analysis of turbulent flows." Annual review of fluid mechanics 25.1 (1993): 539-575.
|
|
285
|
+
- Sirovich, Lawrence. "Turbulence and the dynamics of coherent structures. III. Dynamics and scaling." Quarterly of Applied mathematics 45.3 (1987): 583-590.
|
|
286
|
+
- Mendez, M. A., M. Balabane, and J-M. Buchlin. "Multi-scale proper orthogonal decomposition of complex fluid flows." Journal of Fluid Mechanics 870 (2019): 988-1036.
|
|
287
|
+
- Schmid, Peter J. "Dynamic mode decomposition of numerical and experimental data." Journal of fluid mechanics 656 (2010): 5-28.
|
|
288
|
+
- Sieber, Moritz, C. Oliver Paschereit, and Kilian Oberleithner. "Spectral proper orthogonal decomposition." Journal of Fluid Mechanics 792 (2016): 798-828.
|
|
289
|
+
- Towne, Aaron, Oliver T. Schmidt, and Tim Colonius. "Spectral proper orthogonal decomposition and its relationship to dynamic mode decomposition and resolvent analysis." Journal of Fluid Mechanics 847 (2018): 821-867.
|
|
290
|
+
- Mika, Sebastian, et al. "Kernel PCA and de-noising in feature spaces." Advances in neural information processing systems 11 (1998).
|
|
291
|
+
|
|
292
|
+
Related projects
|
|
293
|
+
----------------
|
|
294
|
+
MODULO encapsulates a wide range of decomposition techniques, but not all of them. We refer to the project below for an additional set of decomposition techniques:
|
|
295
|
+
|
|
296
|
+
- ModRed, https://github.com/belson17/modred
|
|
297
|
+
|
|
298
|
+
There are also decomposition-specific projects, some of which are listed below:
|
|
299
|
+
|
|
300
|
+
- Rogowski, Marcin, Brandon CY Yeung, Oliver T. Schmidt, Romit Maulik, Lisandro Dalcin, Matteo Parsani, and Gianmarco Mengaldo. "Unlocking massively parallel spectral proper orthogonal decompositions in the PySPOD package." Computer Physics Communications 302 (2024): 109246.
|
|
301
|
+
- Lario, A., Maulik, R., Schmidt, O.T., Rozza, G. and Mengaldo, G., 2022. Neural-network learning of SPOD latent dynamics. Journal of Computational Physics, 468, p.111475.
|
|
302
|
+
- Ichinaga, Andreuzzi, Demo, Tezzele, Lapo, Rozza, Brunton, Kutz. PyDMD: A Python package for robust dynamic mode decomposition. arXiv preprint, 2024.
|
|
303
|
+
- Rogowski, Marcin, et al. "Unlocking massively parallel spectral proper orthogonal decompositions in the PySPOD package." Computer Physics Communications 302 (2024): 109246.
|
|
304
|
+
|
|
@@ -6,17 +6,17 @@ modulo_vki/core/_dmd_s.py,sha256=lD7COE1Zinxyjd4IZl0MxT4XtqKM9JtXLL4U26MbtFc,267
|
|
|
6
6
|
modulo_vki/core/_k_matrix.py,sha256=SxS5esKl8ifMtTYWWeX437UWADKB3fW4ozKGryxVHpM,3687
|
|
7
7
|
modulo_vki/core/_mpod_space.py,sha256=0Om-kMQV5n5oI67Ef5ZuXtvBDaRePMVBQYfhJ-_hK0E,7327
|
|
8
8
|
modulo_vki/core/_mpod_time.py,sha256=ItlFTEl-uhj76aIpHpq8U2-vokTnPiE3PL60RKHUYlM,8498
|
|
9
|
-
modulo_vki/core/_pod_space.py,sha256=
|
|
9
|
+
modulo_vki/core/_pod_space.py,sha256=l-Fbcg0JdnOMb_jyKwFyM8YeanXxWa8EvwEdOs5QV6U,6960
|
|
10
10
|
modulo_vki/core/_pod_time.py,sha256=xWEOX6pO7Cpx1Vm7vF7X4YSORMNuAOpJyfpJiG-foTI,2144
|
|
11
11
|
modulo_vki/core/_spod_s.py,sha256=rxXSsNdSTLv3sjvlUErw3xjHk0eF8H7IkSJr5nMQ8Vo,4149
|
|
12
12
|
modulo_vki/core/_spod_t.py,sha256=csftCPRSqs-OghQa8l0mRDL7cy5eXXSCnW8O4pnXTCY,3866
|
|
13
13
|
modulo_vki/utils/__init__.py,sha256=F5yy5R19dONK9oaBEpKzylorVJNcjT2kiJ5Og-ZX1ek,94
|
|
14
14
|
modulo_vki/utils/_plots.py,sha256=m43t08cVq-TY0BW0YPqT71hN-54hBphIYKZEn8Kw16E,1453
|
|
15
|
-
modulo_vki/utils/_utils.py,sha256=
|
|
16
|
-
modulo_vki/utils/others.py,sha256=
|
|
17
|
-
modulo_vki/utils/read_db.py,sha256=
|
|
18
|
-
modulo_vki-2.0.
|
|
19
|
-
modulo_vki-2.0.
|
|
20
|
-
modulo_vki-2.0.
|
|
21
|
-
modulo_vki-2.0.
|
|
22
|
-
modulo_vki-2.0.
|
|
15
|
+
modulo_vki/utils/_utils.py,sha256=5-keBtdW6Z-QmUvgX2ITWOIddsdn0svHudynUXkc3ag,13935
|
|
16
|
+
modulo_vki/utils/others.py,sha256=4VOfB5Xf-lYYdh2qFDXK3Oy7u4xgvjzTgidNTlg2qg0,17101
|
|
17
|
+
modulo_vki/utils/read_db.py,sha256=lJFauxJxS0_mYoxrbn-43UqZjOkr-qb9f6RTUq4IxZU,15149
|
|
18
|
+
modulo_vki-2.0.7.dist-info/LICENSE,sha256=5TivriXFErrYrJgBq3M72kHNHqtSiCft3xESM1zHc0k,1091
|
|
19
|
+
modulo_vki-2.0.7.dist-info/METADATA,sha256=6CuUQwoompNn5fy8b2dfI7xRN31xtfItgYGo9HbMqQo,14572
|
|
20
|
+
modulo_vki-2.0.7.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
21
|
+
modulo_vki-2.0.7.dist-info/top_level.txt,sha256=4PA4AmafKU6M7us7gvt_Q976Khx3qjNUEThRRM5zxeA,11
|
|
22
|
+
modulo_vki-2.0.7.dist-info/RECORD,,
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: modulo_vki
|
|
3
|
-
Version: 2.0.5
|
|
4
|
-
Summary: MODULO (MODal mULtiscale pOd) is a software developed at the von Karman Institute to perform Multiscale Modal Analysis of numerical and experimental data.
|
|
5
|
-
Home-page: https://github.com/mendezVKI/MODULO/tree/master/modulo_python_package/
|
|
6
|
-
Author: ['R. Poletti', 'L. Schena', 'D. Ninni', 'M. A. Mendez']
|
|
7
|
-
Author-email: mendez@vki.ac.be
|
|
8
|
-
License: BSD (3-clause)
|
|
9
|
-
Classifier: Development Status :: 4 - Beta
|
|
10
|
-
Classifier: Natural Language :: English
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Requires-Python: >=3.6
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE
|
|
15
|
-
Requires-Dist: tqdm
|
|
16
|
-
Requires-Dist: numpy
|
|
17
|
-
Requires-Dist: scipy
|
|
18
|
-
Requires-Dist: scikit-learn
|
|
19
|
-
Requires-Dist: ipykernel
|
|
20
|
-
Requires-Dist: ipython
|
|
21
|
-
Requires-Dist: ipython-genutils
|
|
22
|
-
Requires-Dist: ipywidgets
|
|
23
|
-
Requires-Dist: matplotlib
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
MODULO - latest update 2.0
|
|
28
|
-
===================
|
|
29
|
-
|
|
30
|
-
This repository contains version 2.0 of MODULO (MODal mULtiscale pOd), a software developed at the von Karman Institute to perform data-driven modal decompositions and, in particular, the Multiscale Proper Orthogonal Decomposition (mPOD).
|
|
31
|
-
|
|
32
|
-
The old version based on MATLAB implementation and related GUI is no longer maintained but will remain available on the branch "Old_Matlab_Implementation". We also keep the first Python implementation in the branch "Old_Python_Implementation". See the Readme file in these branches for more information.
|
|
33
|
-
|
|
34
|
-
#### Documentation
|
|
35
|
-
|
|
36
|
-
The full documentation is available at https://modulo.readthedocs.io/en/latest/intro.html.
|
|
37
|
-
This documentation is stored alongside the source code and linked to a specific version of MODULO.
|
|
38
|
-
|
|
39
|
-
## What is MODULO, and what are data-driven decompositions?
|
|
40
|
-
|
|
41
|
-
MODULO allows to compute data-driven decompositions of experimental and numerical data. To have a concise overview of the context, we refer to:
|
|
42
|
-
|
|
43
|
-
- Ninni, D., Mendez, M. A. (2020), "MODULO: A Software for Multiscale Proper Orthogonal Decomposition of data", Software X, Vol 12, 100622, https://doi.org/10.1016/j.softx.2020.100622.
|
|
44
|
-
|
|
45
|
-
- Poletti, R., Schena, L., Ninni, D., Mendez, M.A (2024) "MODULO: a python toolbox for data-driven modal decomposition", Submitted to Journal of Open Source Software. Preprint available [here](https://www.researchgate.net/publication/376885484_MODULO_a_python_toolbox_for_data-driven_modal_decomposition)
|
|
46
|
-
|
|
47
|
-
The first article also presents the first version of MODULO (available in the OLD_Matlab_Implementation branch) and its GUI developed by D. Ninni. The second introduces MODULO v2 in this branch and alternative open source projects. While many projects allows for computing common decompositions such as POD, DMD and the SPODs, MODULO is currently the only opensource project allowing to compute the mPOD.
|
|
48
|
-
|
|
49
|
-
For a more comprehensive overview on the theory of data-driven decompositions, we refer to the chapter:
|
|
50
|
-
|
|
51
|
-
- Mendez, M. A. (2023) "Generalized and Multiscale Modal Analysis". In : Mendez M.A., Ianiro, A., Noack, B.R., Brunton, S. L. (Eds), "Data-Driven Fluid Mechanics: Combining First Principles and Machine Learning". Cambridge University Press, 2023:153-181. https://doi.org/10.1017/9781108896214.013. The pre-print is available at https://arxiv.org/abs/2208.12630.
|
|
52
|
-
|
|
53
|
-
and the article that first presented the complete treatment of the mPOD :
|
|
54
|
-
|
|
55
|
-
- Mendez, M. A., Balabane, M., Buchlin, J.-M. (2019) "Multi-Scale Proper Orthogonal Decomposition of Complex Fluid Flows" Journal of Fluid Mechanics 870:988-1036, https://doi.org/10.1017/9781108896214.013. The pre-print is available at https://arxiv.org/abs/2208.12630.
|
|
56
|
-
|
|
57
|
-
Ongoing works on nonlinear methods are discussed here:
|
|
58
|
-
|
|
59
|
-
- Mendez, M. A. (2023) "Linear and Nonlinear Dimensionality Reduction from Fluid Mechanics to Machine Learning", Meas. Sci. Technol. 34(042001), https://doi.org/10.1088/1361-6501/acaffe. The pre-print is available at https://arxiv.org/abs/2208.07746.
|
|
60
|
-
|
|
61
|
-
## What is new in this V 2.0?
|
|
62
|
-
|
|
63
|
-
This version expands considerably the version v1 in "Old_Python_Implementation", for which a first tutorial was provided by L. Schena in https://www.youtube.com/watch?v=y2uSvdxAwHk.
|
|
64
|
-
The major updates are the following :
|
|
65
|
-
|
|
66
|
-
1. Faster EIG/SVD algorithms, using powerful randomized svd solvers from scikit_learn (see [this](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.TruncatedSVD.html) and [this](https://scikit-learn.org/stable/modules/generated/sklearn.utils.extmath.randomized_svd.html) ). It is now possible to select various options as "eig_solver" and "svd_solver", offering different trade-offs in terms of accuracy vs computational time.
|
|
67
|
-
|
|
68
|
-
2. In addition to the traditional POD computation using the K matrix (Sirovinch's method), it is now possible to compute the POD directly via SVD using any of the four "svd_solver" options.
|
|
69
|
-
This is generally faster but requires more memory.
|
|
70
|
-
|
|
71
|
-
3. Faster subscale estimators for the mPOD: the previous version used the rank of the correlation matrix in each scale to define the number of modes to be computed in each portion of the splitting vector before assembling the full basis. This is computationally very demanding. This estimation has been replaced by a frequency-based threshold (i.e. based on the frequency bins within each portion) since one can show that the frequency-based estimator is always more "conservative" than the rank-based estimator.
|
|
72
|
-
|
|
73
|
-
4. Major improvement on the memory saving option: the previous version of modulo always required in input the matrix D. Then, if the memory saving option was active, the matrix was partitioned and stored locally to free the RAM before computing the correlation matrix (see [this tutorial by D. Ninni](https://www.youtube.com/watch?v=LclxO1WTuao)). In the new version, it is possible to initialize a modulo object *without* the matrix D (see exercise 5 in the examples). Instead, one can create the partitions without loading the matrix D.
|
|
74
|
-
|
|
75
|
-
5. Implementation of Dynamic Mode Decomposition (DMD) from [Schmid, P.J 2010](https://www.cambridge.org/core/journals/journal-of-fluid-mechanics/article/dynamic-mode-decomposition-of-numerical-and-experimental-data/AA4C763B525515AD4521A6CC5E10DBD4).
|
|
76
|
-
|
|
77
|
-
6. Implementation of the two Spectral POD formulations, namely the one from [Sieber et al 2016](https://www.cambridge.org/core/journals/journal-of-fluid-mechanics/article/abs/spectral-proper-orthogonal-decomposition/DCD8A6EDEFD56F5A9715DBAD38BD461A), and the one from [Towne et al 2018](https://www.cambridge.org/core/journals/journal-of-fluid-mechanics/article/abs/spectral-proper-orthogonal-decomposition-and-its-relationship-to-dynamic-mode-decomposition-and-resolvent-analysis/EC2A6DF76490A0B9EB208CC2CA037717)
|
|
78
|
-
|
|
79
|
-
7. Implementation of a kernel version of the POD, in which the correlation matrix is replaced by a kernel matrix. This is described in Lecture 15 of the course [Hands on Machine Learning for Fluid dynamics 2023](https://www.vki.ac.be/index.php/events-ls/events/eventdetail/552/-/online-on-site-hands-on-machine-learning-for-fluid-dynamics-2023). See also [this](https://arxiv.org/abs/2208.07746).
|
|
80
|
-
|
|
81
|
-
8. Implementation of a formulation for non-uniform meshes, using a weighted matrix for all the relevant inner products. This is currently available only for POD and mPOD but allows for handling data produced from CFD simulation without resampling on a uniform grid (see exercise 4). It can be used both with and without the memory-saving option.
|
|
82
|
-
|
|
83
|
-
## New Tutorials
|
|
84
|
-
|
|
85
|
-
The installation provides five exercises to explore MODULO's features while familiarizing with data-driven decompositions. These are available in the /exercise/ folder in plain Python format and jupyter notebooks.
|
|
86
|
-
|
|
87
|
-
- Exercise 1. In this exercise, we consider the flow past a cylinder. The dataset was created via Large Eddy Simulations (LES) by Denis Dumoulin during his STP at VKI in 2016 (Report available on request). For convenience, the data was first mapped to a Cartesian grid. This test case is by far the most popular because it's well-known to have a simple low-order representation with modes that have nearly harmonic temporal structures. We compute the POD and the DMD and compare the results... the difference between DMD and POD modes is hardly distinguishable!
|
|
88
|
-
|
|
89
|
-
- Exercise 2. We consider the flow of an impinging gas jet, taken from [this](https://arxiv.org/abs/1804.09646) paper. This dataset was collected via Time-Resolved Particle Image Velocimetry (TR-PIV). Only the first 200 POD modes were stored. This dataset has much richer dynamics than the previous one and cannot be easily approximated using a few modes. We use it to explore the differences between the DFT, the SPODs and the mPOD. These have different purposes and look for different features.
|
|
90
|
-
|
|
91
|
-
- Exercise 3. We take back the cylinder test case to explore the differences between the POD and the generalized Karhunen–Loève (KL) expansion in which a kernel matrix replaces the correlation matrix. The POD is a particular case of KL where the kernel function generating the kernel matrix is the plain inner product. Here, we also consider a Gaussian kernel. Different kernel functions define similarity in different ways and thus produce widely different modes. Different modal structures tell different stories about the dataset, but... what can you say about efficiency in data compression?
|
|
92
|
-
|
|
93
|
-
- Exercise 4. We consider the flow past a cylinder again, but this time in transient conditions and on an experimental test case taken from [this](https://arxiv.org/abs/2001.01971) paper. In this exercise, you can reproduce the same results from the article to see how the mPOD allows to achieve both time and frequency localization without compromising much of the convergence of the POD. The dataset is quite large, so you might have difficulties handling it if you have less than 32 GB of RAM. But fear not: the memory saving feature allows to compute POD and mPOD without loading the data into memory!
|
|
94
|
-
|
|
95
|
-
- Exercise 5. We consider the flow of an impinging gas jet again, but this time on a numerical test case. This dataset was produced by Yannic Lowenstein during his STP at VKI at the end of 2023, with the help of Dr. Maria Faruoli. The Reynolds number is two orders of magnitude higher than in exercise 2, yet the flow features you will observe are pretty similar, at least qualitatively. From a learning perspective, the key feature of this test case is that the data is not available on a uniform grid. But fear not: with the new features, it is possible to compute the decompositions using appropriate weights!
|
|
96
|
-
|
|
File without changes
|
|
File without changes
|