Skip to content

Commit d37e640

Browse files
sichinagamtezzele
authored andcommitted
Started the quickstart guide
1 parent fbe1ca8 commit d37e640

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,47 @@ Here we show a simple application (taken from [tutorial 2](tutorials/tutorial2/t
9898
<em>The system evolution reconstructed with dynamic mode decomposition</em>
9999
</p>
100100

101+
## Quickstart Tutorial
102+
As a simple example, we examine fluid flow past a cylinder vorticity data with Reynolds number $Re = 100$, available [here](dmdbook.com/DATA.zip).
103+
```python3
104+
# Import vorticity data and frame dimensions.
105+
import numpy as np
106+
import scipy.io as sio
107+
108+
mat = sio.loadmat("CYLINDER_ALL.mat")
109+
X = mat["VORTALL"] # (89351, 151) numpy array of snapshot data
110+
t = np.arange(X.shape[-1]) # (151,) numpy array of times of data collection
111+
nx = mat["nx"][0][0]
112+
ny = mat["ny"][0][0]
113+
```
114+
Users can perform DMD by initializing a PyDMD module that implements their DMD method of choice. Users may also pass a variety of parameters to their DMD models for added customization. Here, we show how a user might build an optimized DMD model with bagging.
115+
```python3
116+
from pydmd import BOPDMD
117+
118+
# Build and fit a bagging, optimized DMD model.
119+
dmd = BOPDMD(
120+
svd_rank=15, # rank of the DMD fit
121+
num_trials=100, # number of bagging trials to perform
122+
trial_size=0.5, # use half the total number of snapshots each trial
123+
eig_constraints={"imag", "conjugate_pairs"}, # optional: constrain the eigenvalue structure
124+
varpro_opts_dict={"tol":0.2, "verbose":True}, # optional: set variable projection parameters
125+
)
126+
dmd.fit(X, t)
127+
```
128+
129+
```python3
130+
from pydmd.plotter import plot_summary
131+
132+
# Display a summary of the DMD results.
133+
plot_summary(
134+
dmd,
135+
index_modes=[0, 1, 3],
136+
snapshots_shape=(nx, ny),
137+
order="F",
138+
figsize=(12, 6),
139+
)
140+
```
141+
101142
Here we also provide a flow chart that outlines how one might choose an appropriate DMD optimization or methodological variant based on their specific problem type or data set. Note that the color-coding of this flowchart follows that of the PyDMD Capabilities diagram.
102143

103144
<p align="center">

0 commit comments

Comments
 (0)