Skip to content

Commit

Permalink
Adding notes on the expected number of computations per flux
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyEarly committed Sep 24, 2024
1 parent 81ce492 commit 6f8bac4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Matlab/WaveVortexModel/@WVTransform/WVTransform.m
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,15 @@

function u_bar = transformFromSpatialDomainWithFourier(self,u)
u_bar = fft(fft(u,self.Nx,1),self.Ny,2)/(self.Nx*self.Ny);
% u_bar = fft2(u)/(self.Nx*self.Ny);
u_bar = reshape(u_bar(self.dftPrimaryIndex),[self.Nz self.Nkl]);
end

function u = transformToSpatialDomainWithFourier(self,u_bar)
self.dftBuffer(self.dftPrimaryIndex) = u_bar;
self.dftBuffer(self.dftConjugateIndex) = conj(u_bar(self.wvConjugateIndex));
u = ifft(ifft(self.dftBuffer,self.Nx,1),self.Ny,2,'symmetric')*(self.Nx*self.Ny);
% u = ifft2(self.dftBuffer,'symmetric')*(self.Nx*self.Ny);
end

function u = transformToSpatialDomainWithFourierAtPosition(self,u_bar,x,y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ function buildDampingOperator(self)
end

function varargout = spatialFlux(self,wvt,varargin)
% To count everything:
% 1. (u,v,w,eta) -> 4 transformToSpatialDomainWithFourier
% 2. (u_x,u_y,v_x,v_y,eta_x,eta_y) -> 3 diffX, 3 diffY
% 3. (Ap,Am,A0) -> 3 transformFomSpatialDomainWithFourier
% a subclass can override this, and then modify the spatial
% fluxes that get returned.
phase = exp(wvt.iOmega*(wvt.t-wvt.t0));
Expand Down
4 changes: 2 additions & 2 deletions Matlab/WaveVortexModel/UnitTests/ProfileableSpeedTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
[Fp,Fm,F0] = wvt.nonlinearFlux();

tic
for i=1:10
for i=1:50
wvt.t = i;
[Fp,Fm,F0] = wvt.nonlinearFlux();
end
Expand All @@ -78,7 +78,7 @@

%%
profile on
for i=1:10
for i=1:20
wvt.t = i;
[Fp,Fm,F0] = wvt.nonlinearFlux();
end
Expand Down

0 comments on commit 6f8bac4

Please sign in to comment.