Skip to content

Commit

Permalink
Carefully checking aliased horizontal modes
Browse files Browse the repository at this point in the history
All looks good.
  • Loading branch information
JeffreyEarly committed Oct 12, 2024
1 parent 9ffd0d1 commit b66692a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Matlab/WaveVortexModel/UnitTests/MiscTests/FFTCoefficientTable.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
wvg = WVGeometryDoublyPeriodic([2*pi 2*pi], [16 16]);


function Aklz = wvToDFT(wvg,Azkl)
Aklz = nan(wvg.Nx*wvg.Ny,1);
for iK=1:wvg.Nkl_wv
Aklz(wvg.dftPrimaryIndices(iK)) = Azkl(iK);
end
Aklz = reshape(Aklz,[wvg.Nx wvg.Ny]);
end

k_dft = wvToDFT(wvg,wvg.k_wv);
l_dft = wvToDFT(wvg,wvg.l_wv);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% https://math.jhu.edu/~feilu/notes/DealiasingFFT.pdf
Lxyz = [2*pi 2*pi 1];
Nxyz = [16 16 2];
wvt = WVTransformConstantStratification(Lxyz, Nxyz,shouldAntialias=0);
wvt = WVTransformConstantStratification(Lxyz, Nxyz,shouldAntialias=1);

[X,Y,Z] = wvt.xyzGrid;

Expand Down Expand Up @@ -81,7 +81,8 @@
error('Returned two wavenumbers!')
else
k_mn = wvt.k(quad_nm_index); l_mn = wvt.l(quad_nm_index);
if k_mn == wavenumberOperation{iOp}(k_m,k_n) && l_mn == wavenumberOperation{iOp}(l_m,l_n)
% be skeptical of these abs!
if abs(k_mn) == abs(wavenumberOperation{iOp}(k_m,k_n)) && abs(l_mn) == abs(wavenumberOperation{iOp}(l_m,l_n))
op_resolved(m) = op_resolved(m) + 1;
else
op_aliased(m) = op_aliased(m) + 1;
Expand Down Expand Up @@ -133,10 +134,14 @@
tiledlayout(1,3)
nexttile
jpcolor(wvt.kAxis,wvt.lAxis,op_resolved_kl.'), shading flat
title('resolved')
nexttile
jpcolor(wvt.kAxis,wvt.lAxis,op_zero_kl.'), shading flat
title('zero')
nexttile
jpcolor(wvt.kAxis,wvt.lAxis,op_aliased_kl.'), shading flat
title('aliased')
colorbar('eastoutside')

%%
k_n = 3;
Expand Down

0 comments on commit b66692a

Please sign in to comment.