Skip to content

Commit

Permalink
Merge pull request #59 from CHLNDDEV/new_tests
Browse files Browse the repository at this point in the history
New tests
  • Loading branch information
WPringle authored Mar 8, 2020
2 parents ae52714 + 030ad04 commit 1255184
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Tests/RunTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

TestJBAY

exit
TestECGC

exit
61 changes: 61 additions & 0 deletions Tests/TestECGC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
% Run example 3 to test multi-scale meshing, BoundCr, and interp
cd ..

addpath(genpath('utilities/'))
addpath(genpath('datasets/'))
addpath(genpath('m_map/'))

ERR_TOL = 0.05;
ERR2_TOL = 0.01;
QUAL_TOL = 0.25;
Re2 = 111^2;

bbox = [-71.6 42.7; -64 30; -80 24; -85 38; -71.6 42.7]; %polygon boubox
min_el = 1e3; % minimum resolution in meters.
max_el = 50e3; % maximum resolution in meters.
wl = 30; % 60 elements resolve M2 wavelength.
dt = [50,0.5,6.0]; % Automatically set timestep based on nearshore res
grade = 0.15; % mesh grade in decimal percent.
R = 3; % Number of elements to resolve feature.


dem = 'SRTM15+V2.nc';
coastline = 'GSHHS_f_L1';
gdat1 = geodata('shp',coastline,'dem',dem,'h0',min_el,...
'bbox',bbox);

fh1 = edgefx('geodata',gdat1,...
'fs',R,'wl',wl,'max_el',max_el,...
'dt',dt,'g',grade);

mshopts = meshgen('ef',fh1,'bou',gdat1,...
'plot_on',1,'proj','lam');
mshopts = mshopts.build;

m = mshopts.grd;

m = interp(m,gdat1);

m = BoundCr(m,50,6.0,0.5,20);

Crnew = CalcCFL(m,50);

if(sum(Crnew < 6) < 50)
error(['Unable to bound maximum Courant number. Got ',...
num2str(max(Crnew)),' expecting < 6.0']);
exit(1)
else
disp(['Unable to bound maximum Courant number. Got ',...
num2str(max(Crnew)),' expecting < 6.0']);
end
if(sum(Crnew > 0.5) < 50)
error(['Bounded minimum Courant number. Got ',...
num2str(min(Crnew))]);
exit(1)
else
disp(['Bounded maximum Courant number. Got ',...
num2str(max(Crnew))]);
end


disp('Passed: ECGC');

0 comments on commit 1255184

Please sign in to comment.