Skip to content

Commit 48e0c1d

Browse files
Adaptive sine-taper SPOD
1 parent 12d6d7d commit 48e0c1d

File tree

4 files changed

+630
-0
lines changed

4 files changed

+630
-0
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ SPOD() is a Matlab implementation of the frequency domain form of proper orthogo
44
The large-eddy simulation data provided along with this example is a subset of the database of a Mach 0.9 turbulent jet described in [3] and was calculated using the unstructured flow solver Charles developed at Cascade Technologies. If you are using the database in your research or teaching, please include explicit mention of Brès et al. [3]. The test database consists of 5000 snapshots of the symmetric component (m=0) of a round turbulent jet.
55

66
`spod.m` is a stand-alone Matlab function with no toolbox dependencies. All other Matlab files contained in this repository are related to the six examples that demonstrate the functionality of the code (see file descriptions below). A physical interpretation of the results obtained from the examples can be found in [[4](https://arxiv.org/abs/1711.06296)]. The reference for the frequency-time analsyis is [[5](https://arxiv.org/abs/2011.03644)].
7+
8+
`spod_adaptive.m` is the adaptive sine-taper SPOD algorithm for broadband-tonal flows by Yeung & Schmidt [[7](https://arxiv.org/abs/2312.02385)]
9+
710
## Download
811

912
### Using your browser
@@ -19,6 +22,7 @@ git clone https://github.com/SpectralPOD/spod_matlab.git
1922
| File | Description |
2023
| ------------- |:-------------|
2124
| spod.m | Spectral proper orthogonal decomposition in Matlab |
25+
| spod_adaptive.m | Adaptive sine-taper SPOD in Matlab |
2226
| example_1.m | Inspect data and plot SPOD spectrum |
2327
| example_2.m | Plot SPOD spectrum and inspect SPOD modes |
2428
| example_3.m | Specify spectral estimation parameters and use weighted inner product |
@@ -28,6 +32,7 @@ git clone https://github.com/SpectralPOD/spod_matlab.git
2832
| example_7_FTanalysis.m | Frequency-time analysis |
2933
| example_8_invspod.m | Band-pass filtering using (inverse) SPOD |
3034
| example_9_multitaperWelch | SPOD using Multitaper-Welch estimators |
35+
| example_10_sineAdaptive | Adaptive SPOD example|
3136
| tcoeffs.m | Time-continuous expansion coefficients via convolution |
3237
| invspod.m | Inversion of SPOD using block-wise expansion coefficients |
3338
| jet_data/getjet.m | Interfaces external data source with SPOD() (examples 4-5) |
@@ -125,3 +130,5 @@ the SPOD.
125130
[5] Nekkanti, A. and Schmidt, O. T., *Frequency–time analysis, low-rank reconstruction and denoising of turbulent flows using SPOD* , J. of Fluid Mech. 926, A26, DOI 10.1017/jfm.2021.681, 2021
126131

127132
[6] Schmidt, O. T., *Spectral proper orthogonal decomposition using multitaper estimates*, Theor. Comput. Fluid Dyn., 1-14, DOI 10.1007/s00162-022-00626-x, https://rdcu.be/cUtP3, 2022
133+
134+
[7] Yeung, B. C. Y., Schmidt, O. T. *Adaptive spectral proper orthogonal decomposition of broadband-tonal flows*, Theor. Comput. Fluid Dyn. 38, 355–374, 2024, DOI 10.1007/s00162-024-00695-0

cavity_data/cavityPIV.mat

3.55 MB
Binary file not shown.

example_10_sineAdaptive.m

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
%% EXAMPLE 10: Adaptive sine-taper SPOD.
2+
% The time-resolved particle image velocimetry data provided along with
3+
% this example are a subset of the database of a Mach 0.6 turbulent open
4+
% cavity flow by Zhang et al. [1]. If you are using the database in your
5+
% research or teaching, please include explicit mention of Zhang et al.
6+
% [1]. The test database consists of 4000 snapshots of the streamwise
7+
% velocity component of a turbulent open cavity flow. This is a canonical
8+
% example of a mixed broadband-tonal turbulent flow, which requires sharp
9+
% peak resolution at tonal frequencies and smooth spectrum estimates of
10+
% broadband regions. If you are using this code for your research, please
11+
% cite Yeung & Schmidt [2].
12+
%
13+
% References:
14+
% [1] Zhang, Y., Cattafesta, L. N., and Ukeiley, L., Spectral analysis
15+
% modal methods (SAMMs) using non-time-resolved PIV, Exp. Fluids 61, 226, 1–12, 2020,
16+
% DOI 10.1007/s00348-020-03057-8
17+
% [2] Yeung, B. C. Y., Schmidt, O. T. Adaptive spectral proper orthogonal decomposition
18+
% of broadband-tonal flows, Theor. Comput. Fluid Dyn. 38, 355–374, 2024,
19+
% DOI 10.1007/s00162-024-00695-0
20+
%
21+
% B. Yeung ([email protected]) and O. T. Schmidt ([email protected])
22+
% Last revision: 10-Sep-2024
23+
24+
clc, clear variables
25+
addpath('utils')
26+
load(fullfile('cavity_data','cavityPIV.mat'),'u','x','y','dt');
27+
28+
%% Standard Welch SPOD of the test database using one sine window.
29+
% We manually specify a window length of 256 and an overlap
30+
% of 128 snaphots. A sine function is automatically used as the window.
31+
32+
% SPOD using a sine window of length 256 and 128 snaphots overlap
33+
nDFT = 256;
34+
nOvlp = 128;
35+
[L,P,f] = spod_adapt(u,nDFT,[],nOvlp,dt);
36+
37+
%% Plot the SPOD spectrum and some modes.
38+
figure
39+
loglog(f,L)
40+
xlabel('frequency'), ylabel('SPOD mode energy'), title('Welch SPOD')
41+
42+
%% Multitaper SPOD using six sine windows.
43+
% We can achieve higher frequency resolution and resolve down to lower
44+
% minimum frequencies using six sine windows of length equal to the
45+
% number of snapshots. Specify nWin as a vector of length 4000.
46+
% Multitaper SPOD neither requires nor benefits from overlap, so we leave
47+
% nOvlp empty.
48+
49+
% SPOD using six sine windows of length 4000 and 0 overlap
50+
nWin = 6*ones(size(u,1),1);
51+
[L,P,f] = spod_adapt(u,nWin,[],[],dt);
52+
53+
%% Plot the SPOD spectrum.
54+
figure
55+
loglog(f,L)
56+
xlabel('frequency'), ylabel('SPOD mode energy'), title('multitaper SPOD')
57+
58+
%% Adaptive multitaper SPOD.
59+
% To combine both sharp peak resolution and smooth spectrum estimates of
60+
% broadband regions, we allow the window number to vary with frequency.
61+
% The adaptive algorithm requires only a tolerance and determines the
62+
% window number autonomously. No spectral estimation parameters
63+
% are needed.
64+
65+
% SPOD using the adaptive algorithm with a tolerance of 1e-4
66+
% Can take a long time to compute
67+
clear opts
68+
opts.adaptive = true;
69+
opts.tol = 1e-4;
70+
[L,P,f,~,nWin] = spod_adapt(u,[],[],[],dt,opts);
71+
72+
%% Plot the SPOD spectrum and window number.
73+
figure
74+
yyaxis left
75+
loglog(f,L)
76+
xlabel('frequency'), ylabel('SPOD mode energy'), title('adaptive multitaper SPOD')
77+
78+
yyaxis right
79+
semilogx(f,nWin)
80+
ylabel('number of windows')
81+
82+
%% Plot some SPOD modes (Rossiter modes)
83+
figure
84+
count = 1;
85+
for fi = [470 770 1063]
86+
for mi = [1 2]
87+
subplot(3,2,count)
88+
contourf(x,y,real(squeeze(P(fi,:,:,mi))),11,'edgecolor','none'), axis equal tight, clim(max(abs(clim))*[-1 1])
89+
xlabel('x'), ylabel('y'), title(['f=' num2str(f(fi),'%.2f') ', mode ' num2str(mi) ', \lambda=' num2str(L(fi,mi),'%.2g')])
90+
count = count + 1;
91+
end
92+
end
93+
94+
% %% Multitple SPOD using non-uniform window number.
95+
% % If the (potentially non-uniform) window number is known a priori, e.g.,
96+
% % based on physical knowledge, it can be provided directly. As an example,
97+
% % we use the nWin computed previously to recover the same results as before.
98+
%
99+
% % SPOD using sine windows of length 4000, 0 overlap, and
100+
% % frequency-dependent window number
101+
% if length(nWin)<size(u,1), nWin(size(u,1)) = 0; end % zero-pad nWin to length 4000
102+
% [L,P,f] = spod_adapt(u,nWin,[],[],dt);
103+
%
104+
% %% Plot the SPOD spectrum.
105+
% % The spectrum should be identical to the previous figure.
106+
% figure
107+
% loglog(f,L)
108+
% xlabel('frequency'), ylabel('SPOD mode energy'), title('multitaper SPOD with non-uniform window number')

0 commit comments

Comments
 (0)