modulo-vki 2.0.4__tar.gz → 2.0.5__tar.gz
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-2.0.4 → modulo_vki-2.0.5}/LICENSE +21 -21
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/PKG-INFO +96 -96
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/README.md +72 -72
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/__init__.py +22 -22
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/__init__.py +9 -9
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_dft.py +61 -61
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_dmd_s.py +72 -72
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_k_matrix.py +81 -81
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_mpod_space.py +180 -180
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_mpod_time.py +154 -154
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_pod_space.py +184 -184
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_pod_time.py +48 -48
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_spod_s.py +101 -101
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/core/_spod_t.py +104 -104
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/modulo.py +828 -829
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/utils/__init__.py +4 -4
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/utils/_plots.py +51 -51
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/utils/_utils.py +339 -339
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/utils/others.py +449 -449
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki/utils/read_db.py +339 -339
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki.egg-info/PKG-INFO +96 -96
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/setup.cfg +4 -4
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/setup.py +82 -82
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki.egg-info/SOURCES.txt +0 -0
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki.egg-info/dependency_links.txt +0 -0
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki.egg-info/requires.txt +0 -0
- {modulo_vki-2.0.4 → modulo_vki-2.0.5}/modulo_vki.egg-info/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 lorenzoschena
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 lorenzoschena
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: modulo_vki
|
|
3
|
-
Version: 2.0.
|
|
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
|
-
|
|
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
|
+
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
MODULO - latest update 2.0
|
|
4
|
-
===================
|
|
5
|
-
|
|
6
|
-
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).
|
|
7
|
-
|
|
8
|
-
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.
|
|
9
|
-
|
|
10
|
-
#### Documentation
|
|
11
|
-
|
|
12
|
-
The full documentation is available at https://modulo.readthedocs.io/en/latest/intro.html.
|
|
13
|
-
This documentation is stored alongside the source code and linked to a specific version of MODULO.
|
|
14
|
-
|
|
15
|
-
## What is MODULO, and what are data-driven decompositions?
|
|
16
|
-
|
|
17
|
-
MODULO allows to compute data-driven decompositions of experimental and numerical data. To have a concise overview of the context, we refer to:
|
|
18
|
-
|
|
19
|
-
- 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.
|
|
20
|
-
|
|
21
|
-
- 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)
|
|
22
|
-
|
|
23
|
-
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.
|
|
24
|
-
|
|
25
|
-
For a more comprehensive overview on the theory of data-driven decompositions, we refer to the chapter:
|
|
26
|
-
|
|
27
|
-
- 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.
|
|
28
|
-
|
|
29
|
-
and the article that first presented the complete treatment of the mPOD :
|
|
30
|
-
|
|
31
|
-
- 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.
|
|
32
|
-
|
|
33
|
-
Ongoing works on nonlinear methods are discussed here:
|
|
34
|
-
|
|
35
|
-
- 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.
|
|
36
|
-
|
|
37
|
-
## What is new in this V 2.0?
|
|
38
|
-
|
|
39
|
-
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.
|
|
40
|
-
The major updates are the following :
|
|
41
|
-
|
|
42
|
-
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.
|
|
43
|
-
|
|
44
|
-
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.
|
|
45
|
-
This is generally faster but requires more memory.
|
|
46
|
-
|
|
47
|
-
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.
|
|
48
|
-
|
|
49
|
-
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.
|
|
50
|
-
|
|
51
|
-
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).
|
|
52
|
-
|
|
53
|
-
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)
|
|
54
|
-
|
|
55
|
-
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).
|
|
56
|
-
|
|
57
|
-
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.
|
|
58
|
-
|
|
59
|
-
## New Tutorials
|
|
60
|
-
|
|
61
|
-
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.
|
|
62
|
-
|
|
63
|
-
- 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!
|
|
64
|
-
|
|
65
|
-
- 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.
|
|
66
|
-
|
|
67
|
-
- 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?
|
|
68
|
-
|
|
69
|
-
- 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!
|
|
70
|
-
|
|
71
|
-
- 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!
|
|
72
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
MODULO - latest update 2.0
|
|
4
|
+
===================
|
|
5
|
+
|
|
6
|
+
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).
|
|
7
|
+
|
|
8
|
+
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.
|
|
9
|
+
|
|
10
|
+
#### Documentation
|
|
11
|
+
|
|
12
|
+
The full documentation is available at https://modulo.readthedocs.io/en/latest/intro.html.
|
|
13
|
+
This documentation is stored alongside the source code and linked to a specific version of MODULO.
|
|
14
|
+
|
|
15
|
+
## What is MODULO, and what are data-driven decompositions?
|
|
16
|
+
|
|
17
|
+
MODULO allows to compute data-driven decompositions of experimental and numerical data. To have a concise overview of the context, we refer to:
|
|
18
|
+
|
|
19
|
+
- 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.
|
|
20
|
+
|
|
21
|
+
- 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)
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
For a more comprehensive overview on the theory of data-driven decompositions, we refer to the chapter:
|
|
26
|
+
|
|
27
|
+
- 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.
|
|
28
|
+
|
|
29
|
+
and the article that first presented the complete treatment of the mPOD :
|
|
30
|
+
|
|
31
|
+
- 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.
|
|
32
|
+
|
|
33
|
+
Ongoing works on nonlinear methods are discussed here:
|
|
34
|
+
|
|
35
|
+
- 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.
|
|
36
|
+
|
|
37
|
+
## What is new in this V 2.0?
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
The major updates are the following :
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
This is generally faster but requires more memory.
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
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).
|
|
52
|
+
|
|
53
|
+
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)
|
|
54
|
+
|
|
55
|
+
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).
|
|
56
|
+
|
|
57
|
+
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.
|
|
58
|
+
|
|
59
|
+
## New Tutorials
|
|
60
|
+
|
|
61
|
+
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.
|
|
62
|
+
|
|
63
|
+
- 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!
|
|
64
|
+
|
|
65
|
+
- 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.
|
|
66
|
+
|
|
67
|
+
- 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?
|
|
68
|
+
|
|
69
|
+
- 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!
|
|
70
|
+
|
|
71
|
+
- 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!
|
|
72
|
+
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
#from ._version import get_versions
|
|
3
|
-
#__version__ = get_versions()['version']
|
|
4
|
-
#del get_versions
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# from .utils.read_db import *
|
|
8
|
-
# from .utils._utils import *
|
|
9
|
-
# from .utils._plots import *
|
|
10
|
-
# from .utils.others import *
|
|
11
|
-
|
|
12
|
-
# from .core._k_matrix import *
|
|
13
|
-
# from .core._dft import *
|
|
14
|
-
# from .core._dmd_s import *
|
|
15
|
-
# from .core._k_matrix import *
|
|
16
|
-
# from .core._mpod_time import *
|
|
17
|
-
# from .core._mpod_space import *
|
|
18
|
-
# from .core._pod_time import *
|
|
19
|
-
# from .core._pod_space import *
|
|
20
|
-
# from .core._spod_s import *
|
|
21
|
-
# from .core._spod_t import *
|
|
22
|
-
|
|
1
|
+
|
|
2
|
+
#from ._version import get_versions
|
|
3
|
+
#__version__ = get_versions()['version']
|
|
4
|
+
#del get_versions
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# from .utils.read_db import *
|
|
8
|
+
# from .utils._utils import *
|
|
9
|
+
# from .utils._plots import *
|
|
10
|
+
# from .utils.others import *
|
|
11
|
+
|
|
12
|
+
# from .core._k_matrix import *
|
|
13
|
+
# from .core._dft import *
|
|
14
|
+
# from .core._dmd_s import *
|
|
15
|
+
# from .core._k_matrix import *
|
|
16
|
+
# from .core._mpod_time import *
|
|
17
|
+
# from .core._mpod_space import *
|
|
18
|
+
# from .core._pod_time import *
|
|
19
|
+
# from .core._pod_space import *
|
|
20
|
+
# from .core._spod_s import *
|
|
21
|
+
# from .core._spod_t import *
|
|
22
|
+
|
|
23
23
|
from modulo_vki.modulo import ModuloVKI
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
from ._dft import *
|
|
2
|
-
from ._dmd_s import *
|
|
3
|
-
from ._k_matrix import *
|
|
4
|
-
from ._mpod_space import *
|
|
5
|
-
from ._mpod_time import *
|
|
6
|
-
from ._pod_space import *
|
|
7
|
-
from ._pod_time import *
|
|
8
|
-
from ._spod_s import *
|
|
9
|
-
from ._spod_t import *
|
|
1
|
+
from ._dft import *
|
|
2
|
+
from ._dmd_s import *
|
|
3
|
+
from ._k_matrix import *
|
|
4
|
+
from ._mpod_space import *
|
|
5
|
+
from ._mpod_time import *
|
|
6
|
+
from ._pod_space import *
|
|
7
|
+
from ._pod_time import *
|
|
8
|
+
from ._spod_s import *
|
|
9
|
+
from ._spod_t import *
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
from tqdm import tqdm
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def dft_fit(N_T, F_S, D, FOLDER_OUT, SAVE_DFT=False):
|
|
8
|
-
"""
|
|
9
|
-
This function computes the DFT form the dataset D.
|
|
10
|
-
Currently, this does not handle the memory saving feature.
|
|
11
|
-
|
|
12
|
-
:param N_T: int.
|
|
13
|
-
number of snapshots
|
|
14
|
-
:param F_S:
|
|
15
|
-
Sampling frequency (in Hz)
|
|
16
|
-
:param D:
|
|
17
|
-
Snapshot matrix
|
|
18
|
-
:param FOLDER_OUT:
|
|
19
|
-
Folder in which the results are saved if SAVE_SPATIAL_POD = True
|
|
20
|
-
:param SAVE_DFT:
|
|
21
|
-
If True, results are saved on disk and released from memory
|
|
22
|
-
|
|
23
|
-
:return: Sorted_Freqs, np.array
|
|
24
|
-
Frequency bins, in Hz.
|
|
25
|
-
:return: Phi_F, np.array
|
|
26
|
-
(Complex) Spatial structures for each mode
|
|
27
|
-
:return: SIGMA_F, np.array
|
|
28
|
-
(real) amplitude of each modes
|
|
29
|
-
|
|
30
|
-
"""
|
|
31
|
-
n_t = int(N_T)
|
|
32
|
-
Freqs = np.fft.fftfreq(n_t) * F_S # Compute the frequency bins
|
|
33
|
-
# PSI_F = np.conj(np.fft.fft(np.eye(n_t)) / np.sqrt(n_t)) # Prepare the Fourier Matrix.
|
|
34
|
-
|
|
35
|
-
# Method 1 (didactic!)
|
|
36
|
-
# PHI_SIGMA = np.dot(D, np.conj(PSI_F)) # This is PHI * SIGMA
|
|
37
|
-
|
|
38
|
-
# Method 2
|
|
39
|
-
PHI_SIGMA = (np.fft.fft(D, n_t, 1)) / (n_t ** 0.5)
|
|
40
|
-
|
|
41
|
-
PHI_F = np.zeros((D.shape[0], n_t), dtype=complex) # Initialize the PHI_F MATRIX
|
|
42
|
-
SIGMA_F = np.zeros(n_t) # Initialize the SIGMA_F MATRIX
|
|
43
|
-
|
|
44
|
-
# Now we proceed with the normalization. This is also intense so we time it
|
|
45
|
-
for r in tqdm(range(0, n_t)): # Loop over the PHI_SIGMA to normalize
|
|
46
|
-
# MEX = 'Proj ' + str(r + 1) + ' /' + str(n_t)
|
|
47
|
-
# print(MEX)
|
|
48
|
-
SIGMA_F[r] = abs(np.vdot(PHI_SIGMA[:, r], PHI_SIGMA[:, r])) ** 0.5
|
|
49
|
-
PHI_F[:, r] = PHI_SIGMA[:, r] / SIGMA_F[r]
|
|
50
|
-
|
|
51
|
-
Indices = np.flipud(np.argsort(SIGMA_F)) # find indices for sorting in decreasing order
|
|
52
|
-
Sorted_Sigmas = SIGMA_F[Indices] # Sort all the sigmas
|
|
53
|
-
Sorted_Freqs = Freqs[Indices] # Sort all the frequencies accordingly.
|
|
54
|
-
Phi_F = PHI_F[:, Indices] # Sorted Spatial Structures Matrix
|
|
55
|
-
SIGMA_F = Sorted_Sigmas # Sorted Amplitude Matrix (vector)
|
|
56
|
-
|
|
57
|
-
if SAVE_DFT:
|
|
58
|
-
os.makedirs(FOLDER_OUT + 'DFT', exist_ok=True)
|
|
59
|
-
np.savez(FOLDER_OUT + 'DFT/dft_fitted', Freqs=Sorted_Freqs, Phis=Phi_F, Sigmas=SIGMA_F)
|
|
60
|
-
|
|
61
|
-
return Sorted_Freqs, Phi_F, SIGMA_F
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from tqdm import tqdm
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def dft_fit(N_T, F_S, D, FOLDER_OUT, SAVE_DFT=False):
|
|
8
|
+
"""
|
|
9
|
+
This function computes the DFT form the dataset D.
|
|
10
|
+
Currently, this does not handle the memory saving feature.
|
|
11
|
+
|
|
12
|
+
:param N_T: int.
|
|
13
|
+
number of snapshots
|
|
14
|
+
:param F_S:
|
|
15
|
+
Sampling frequency (in Hz)
|
|
16
|
+
:param D:
|
|
17
|
+
Snapshot matrix
|
|
18
|
+
:param FOLDER_OUT:
|
|
19
|
+
Folder in which the results are saved if SAVE_SPATIAL_POD = True
|
|
20
|
+
:param SAVE_DFT:
|
|
21
|
+
If True, results are saved on disk and released from memory
|
|
22
|
+
|
|
23
|
+
:return: Sorted_Freqs, np.array
|
|
24
|
+
Frequency bins, in Hz.
|
|
25
|
+
:return: Phi_F, np.array
|
|
26
|
+
(Complex) Spatial structures for each mode
|
|
27
|
+
:return: SIGMA_F, np.array
|
|
28
|
+
(real) amplitude of each modes
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
n_t = int(N_T)
|
|
32
|
+
Freqs = np.fft.fftfreq(n_t) * F_S # Compute the frequency bins
|
|
33
|
+
# PSI_F = np.conj(np.fft.fft(np.eye(n_t)) / np.sqrt(n_t)) # Prepare the Fourier Matrix.
|
|
34
|
+
|
|
35
|
+
# Method 1 (didactic!)
|
|
36
|
+
# PHI_SIGMA = np.dot(D, np.conj(PSI_F)) # This is PHI * SIGMA
|
|
37
|
+
|
|
38
|
+
# Method 2
|
|
39
|
+
PHI_SIGMA = (np.fft.fft(D, n_t, 1)) / (n_t ** 0.5)
|
|
40
|
+
|
|
41
|
+
PHI_F = np.zeros((D.shape[0], n_t), dtype=complex) # Initialize the PHI_F MATRIX
|
|
42
|
+
SIGMA_F = np.zeros(n_t) # Initialize the SIGMA_F MATRIX
|
|
43
|
+
|
|
44
|
+
# Now we proceed with the normalization. This is also intense so we time it
|
|
45
|
+
for r in tqdm(range(0, n_t)): # Loop over the PHI_SIGMA to normalize
|
|
46
|
+
# MEX = 'Proj ' + str(r + 1) + ' /' + str(n_t)
|
|
47
|
+
# print(MEX)
|
|
48
|
+
SIGMA_F[r] = abs(np.vdot(PHI_SIGMA[:, r], PHI_SIGMA[:, r])) ** 0.5
|
|
49
|
+
PHI_F[:, r] = PHI_SIGMA[:, r] / SIGMA_F[r]
|
|
50
|
+
|
|
51
|
+
Indices = np.flipud(np.argsort(SIGMA_F)) # find indices for sorting in decreasing order
|
|
52
|
+
Sorted_Sigmas = SIGMA_F[Indices] # Sort all the sigmas
|
|
53
|
+
Sorted_Freqs = Freqs[Indices] # Sort all the frequencies accordingly.
|
|
54
|
+
Phi_F = PHI_F[:, Indices] # Sorted Spatial Structures Matrix
|
|
55
|
+
SIGMA_F = Sorted_Sigmas # Sorted Amplitude Matrix (vector)
|
|
56
|
+
|
|
57
|
+
if SAVE_DFT:
|
|
58
|
+
os.makedirs(FOLDER_OUT + 'DFT', exist_ok=True)
|
|
59
|
+
np.savez(FOLDER_OUT + 'DFT/dft_fitted', Freqs=Sorted_Freqs, Phis=Phi_F, Sigmas=SIGMA_F)
|
|
60
|
+
|
|
61
|
+
return Sorted_Freqs, Phi_F, SIGMA_F
|