Skip to content

Commit e57e9b2

Browse files
committed
add example of using fit_econ to BOPDMD user manual script
1 parent 458b16a commit e57e9b2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tutorials/user-manual1/user-manual-bopdmd.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@
9595
flip_continuous_axes=True, # Rotate the continuous-time eig plot.
9696
)
9797

98+
# Alternatively, pre-compute the SVD and use the `fit_econ` function.
99+
# This is useful when the SVD is already computed and the snapshots matrix
100+
# X is not available or is too large to store in memory.
101+
U, s, V = np.linalg.svd(X, full_matrices=False)
102+
U = U[:, :11]
103+
s = s[:11]
104+
V = V[:11, :]
105+
106+
bopdmd_econ = BOPDMD(svd_rank=11, num_trials=0, use_proj=True, proj_basis=U)
107+
bopdmd_econ.fit_econ(s, V, t)
108+
109+
plot_summary(
110+
bopdmd_econ,
111+
figsize=(12, 6), # Figure size.
112+
index_modes=(0, 1, 3), # Indices of the modes to plot.
113+
snapshots_shape=(ny, nx), # Shape of the modes.
114+
order="F", # Order to use when reshaping the modes.
115+
flip_continuous_axes=True, # Rotate the continuous-time eig plot.
116+
)
98117

99118
# In[4]:
100119

0 commit comments

Comments
 (0)