forked from krober10nd/BarrierMeshingScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewInlet.m
96 lines (76 loc) · 2.92 KB
/
NewInlet.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
clearvars; close all; clc;
%% DESCNIPTION: Generate the New Inlet patch for insertion into the GSBv4 msh.
% AUTHOR: KEITH ROBERTS
% LAST UPDATE: Sept 2, 2020
%% DECLARE PARAMETERS FOR MESHING
% The barNIer representation (these are the endpoints of the crestline).
WEIR_STRUCT.X = [-72.90171264 ; -72.89490667 ]; %
WEIR_STRUCT.Y = [ 40.72297164; 40.72508716];
NI = mean([ WEIR_STRUCT.Y, WEIR_STRUCT.X]);
WEIR_STRUCT.width = 10; % 10-m wide
WEIR_STRUCT.min_ele = 40; % 40-m element sizes on front/back faces
WEIR_STRUCT.crest_height=5; % assume a height of 5-m above the free surface.
BSZ = 0.05;
BBOXES{1} = [NI(2)-BSZ NI(2)+BSZ; NI(1)-BSZ NI(1)+BSZ];
% 0.025 x 0.025 degree box around NI with 10-m min. resolution
BSZ = 0.025;
BBOXES{2} = [NI(2)-BSZ NI(2)+BSZ; NI(1)-BSZ NI(1)+BSZ];
COASTLINE = 'NCEI_Sandy_DEMs_1m_NAVD88_contour';
FLOODLINE = 'NCEI_Sandy_DEMs_10m_NAVD88_contour';
DEM = 'NCEI_Sandy_DEMs_13and19asec.HBcleanup20191111.nc';
DT = 0.5; % DESIRABLE STABLE TIMESTEP
H0 = [40,10]; % MINIMUM MESH RESOLUTION IN METERS
FSS = [3,10]; % NUMBER OF POSSIBLE ELEMENTS ACROSS CHANNEL WIDTH
MAX_EL_NS = 100; % MAXIMUM ELEMENT SIZE NEARSHORE
SLP = 15; % NUMBER OF NODES PER GRADIENT OF BATHY
MAX_ELS{1} = [1e3 0 -inf % Globally, maximum mesh resolution in meters.
1e3 inf 0]; % Overland, maximum mesh resolution in meters.
MAX_ELS{2} = [1e3 0 -inf % Globally, maximum mesh resolution in meters.
100 inf 0]; % Overland, maximum mesh resolution in meters.
GRADES{1} = [0.25 0 -inf % Use a spatially vaNIable gradation rate overland.
0.35 inf 0] ;
GRADES{2} = [0.15 0 -inf % Use a spatially vaNIable gradation rate overland.
0.05 inf 0] ;
SMOOTHING_WINDOW = 1; % TURN OFF MOVING AVERAGE COASTLINE WINDOW SMOOTHING
%% BUILD GEOMETRY AND SIZING FUNCTION
for i = 1 : 2
BBOX = BBOXES{i};
MIN_EL = H0(i);
MAX_EL = MAX_ELS{i};
GRADE = GRADES{i};
FS = FSS(i);
if i == 2
gdat{i} = geodata('shp',FLOODLINE,...
'dem',DEM,...
'bbox',BBOX,...
'h0',MIN_EL,...
'window',SMOOTHING_WINDOW,...
'weirs',WEIR_STRUCT);
else
gdat{i} = geodata('shp',FLOODLINE,...
'dem',DEM,...
'bbox',BBOX,...
'h0',MIN_EL,...
'window',SMOOTHING_WINDOW);
end
fh{i} = edgefx('geodata',gdat{i},...
'fs',FS,...
'max_el_ns',MAX_EL_NS,...
'max_el',MAX_EL,...
'slp',SLP,...
'g',GRADE,...
'dt',DT);
end
%% BUID MESH
mshopts = meshgen('ef',fh,'bou',gdat,'plot_on',1);
m = mshopts.build.grd;
%% INTERPOLATE TOPOBATHY AND MAKE SURE ITS SMOOTH
m = interp(m,gdat);
m4 = lim_bathy_slope(m,0.10);
%% Plots and wNIte to dis
% plot(m2,'b'); % pretty plot
% plot(m2,'bmesh');
% plot(m2,'resolog');
% plot(m2,'bd');
m4 = make_bc(m4,'weirs',gdat{2});
save NI m4