-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speeding up the random amplitudes code
- Loading branch information
1 parent
4ab959b
commit 81ce492
Showing
4 changed files
with
72 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Matlab/WaveVortexModel/@WVTransformConstantStratification/speedTest.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function resultsTable = speedTest | ||
% Initialize a WVTransformConstantStratification instance from an existing file | ||
% | ||
% - Topic: Initialization | ||
% - Declaration: wvt = waveVortexTransformFromFile(path,options) | ||
% - Parameter path: path to a NetCDF file | ||
% - Parameter iTime: (optional) time index to initialize from (default 1) | ||
|
||
Nxy = [32 64 64 128 128 128 256 256 256].'; | ||
Nz = [32 32 64 32 64 128 32 64 128].'+1; | ||
nReps = [50 50 50 50 50 50 50 25 10].'; | ||
measuredTime = zeros(size(Nxy)); | ||
|
||
for iProfile=1:length(Nxy) | ||
wvt = WVTransformConstantStratification([15e3, 15e3, 1300], [Nxy(iProfile) Nxy(iProfile) Nz(iProfile)]); | ||
wvt.initWithRandomFlow(uvMax=0.01); | ||
[Fp,Fm,F0] = wvt.nonlinearFlux(); | ||
tic | ||
for iRep=1:nReps(iProfile) | ||
wvt.t = iRep; % prevent caching | ||
[Fp,Fm,F0] = wvt.nonlinearFlux(); | ||
end | ||
measuredTime(iProfile) = toc/nReps(iProfile); | ||
end | ||
resultsTable = table(Nxy,Nz,measuredTime); | ||
disp(resultsTable) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters