-
Notifications
You must be signed in to change notification settings - Fork 0
/
stretching_river_semi_analytical.m
484 lines (376 loc) · 17.7 KB
/
stretching_river_semi_analytical.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
function tc = stretching_river_semi_analytical(S0,reach,r,v,w0,hc)
yr2sec = @(yr) yr*(60*60*24*365);
if nargin == 0
example = 8; % toggle through these examples (1-8) to get a walkthrough of the approach
switch example
case 1
%% Example #1: Heaviside function
% define the intial shape of the river:
x = 0:0.01:10;
z = x<max(x)/2;
N = 1000; % This defines the number of sinusoidal terms in the fourier expansion
tarr = linspace(0,1,100);
k = 1;
figure; hold on
ph0 = plot(x,z,'Color',[1 0 0]);
for ti = tarr
zi = diffuse(x,z,k,ti,N);
plot(x,zi,'Color',[1-ti/max(tarr),0,ti/max(tarr)])
end
legend(ph0,'Initial profile')
xlabel('Along profile distance')
ylabel('Elevation')
case 2
%% Example #2: Dam removal/normal fault scarp
S0 = 0.1; % here we define an initial slope
dx = 0.01; % spacing
L = 10;
Dam_height = 5;
[x,z] = simple_profile(S0,dx,L);
z = z + Dam_height*(x<max(x)/2);
N = 500; % This defines the number of sinusoidal terms in the fourier expansion
tarr = linspace(0,1,100);
k = 1;
figure; hold on
ph0 = plot(x,z,'Color',[1 0 0]);
for ti = tarr
zi = diffuse(x,z,k,ti,N);
plot(x,zi,'Color',[1-ti/max(tarr),0,ti/max(tarr)])
end
legend(ph0,'Initial profile')
xlabel('Along profile distance')
ylabel('Elevation')
case 3
%% Example #3: Fault one offset
S0 = 0.1; % here we define an initial slope
dx = 0.01; % spacing
L = 10;
[x0,z0] = simple_profile(S0,dx,L);
% here I introduce the strech function (see below), which stretches
% an input profile by a factor (stretch), over a width (w) centered
% on a point (xo) and resamples the stretched interval at a spacing
% of dx
offset = 10;
fault_zone_width = 1;
stretch_factor = sqrt(fault_zone_width^2 + offset^2);
[x,z] = stretch(x0,z0,dx,fault_zone_width,max(x0)/2,stretch_factor);
N = 1000; % This defines the number of sinusoidal terms in the fourier expansion
tarr = linspace(0,10,5);
k = 1;
figure; hold on
ph0 = plot(x,z,'Color',[1 0 0]);
for ti = tarr
zi = diffuse(x,z,k,ti,N);
plot(x,zi,'Color',[1-ti/max(tarr),0,ti/max(tarr)])
end
legend(ph0,'Initial profile')
xlabel('Along profile distance')
ylabel('Elevation')
case 4
%% Example #4: Fault multiple constant offsets with constant recurrence
S0 = 0.1; % here we define an initial slope
dx = 0.01; % spacing
L = 10;
[x,z] = simple_profile(S0,dx,L);
% diffusive terms
N = 1000; % This defines the number of sinusoidal terms in the fourier expansion
k = 0.5;
nEq = 10;
recurranceInterval = 1*ones(1,nEq); % population of recurrence intervals
offsetArray = 1*ones(1,nEq); % population of slips (charecteristic in this case)
w0 = 1; % width of the fault zone
hc = 0.1; % possible to make this related to water level
avulseYN = false;
tc = eq_cycle_channel_model(x,z,dx,w0, ... % Geometry
k, N, ... % Diffusion
recurranceInterval, offsetArray, ... % Earthquakes
hc, avulseYN); % Channel
case 5
%% Example #5: Fault with mulitple offsets which can avulse
S0 = 0.1; % here we define an initial slope
dx = 0.01; % spacing
L = 10;
[x,z] = simple_profile(S0,dx,L);
% diffusive terms
N = 100; % This defines the number of sinusoidal terms in the fourier expansion
k = 1;
nEq = 100;
v = 10;
recurranceInterval = 1*ones(1,nEq); % population of recurrence intervals
offsetArray = v*(recurranceInterval); % population of slips (charecteristic in this case)
w0 = 1; % width of the fault zone
hc = 0.1; % possible to make this related to water level
avulseYN = true;
showLive = false;
tc = eq_cycle_channel_model(x,z,dx,w0, ... % Geometry
k, N, ... % Diffusion
recurranceInterval, offsetArray, ... % Earthquakes
hc, avulseYN, ... % Channel
showLive);
case 6
%% Example #6: Fault with mulitple random offsets and recurrance intervals can avulse
S0 = 0.1; % here we define an initial slope
dx = 0.01; % spacing
L = 10;
[x,z] = simple_profile(S0,dx,L);
% diffusive terms
N = 1000; % This defines the number of sinusoidal terms in the fourier expansion
k = 0.05;
nEq = 100;
recurranceInterval = 2*10*rand(1,nEq); % population of recurrence intervals
offsetArray = 2*0.1*rand(1,nEq); % population of slips (charecteristic in this case)
w0 = 1; % width of the fault zone
hc = 0.1; % possible to make this related to water level
avulseYN = true;
showLive = true;
tc = eq_cycle_channel_model(x,z,dx,w0, ... % Geometry
k, N, ... % Diffusion
recurranceInterval, offsetArray, ... % Earthquakes
hc, avulseYN, ... % Channel
showLive);
case 7
%% Example #7: Fault with "shutter ridges" veritical offset (hc(t))
S0 = 0.1; % here we define an initial slope
dx = 0.01; % spacing
L = 10;
[x,z] = simple_profile(S0,dx,L);
% diffusive terms
N = 1000; % This defines the number of sinusoidal terms in the fourier expansion
k = 0.05*10^-7;
nEq = 500;
v = 0.01;
recurranceInterval = 10*ones(1,nEq); % population of recurrence intervals
offsetArray = v*(recurranceInterval); % population of slips (charecteristic in this case)
w0 = 1; % width of the fault zone
hc = 0.1; % possible to make this related to water level
avulseYN = true;
shutterRidge_sp = 10;
hcfh = @(t) 2*hc + hc*sin(2*pi*t/(shutterRidge_sp/v)); % e.g. shutter ridges
showLive = true;
tc = eq_cycle_channel_model(x,z,dx,w0, ... % Geometry
k, N, ... % Diffusion
recurranceInterval, offsetArray, ... % Earthquakes
hcfh, avulseYN, ... % Channel
showLive);
case 8
%% Example #8: Exploring realistic parameters
S0 = 0.05; % slope (Rise over run)
dx = 1; % point spacing (m)
L = 3000; % domain size (m)
r = 0.05; % annual rainfall (m)
[x,z] = simple_profile(S0,dx,L);
N = 100; % order of fourier expansion
nEq = 20;
vcmyr = 3.3; % slip velocity (cm/year)
v = vcmyr / 100 /yr2sec(1); % m/s
k = 0.1*r*L/2/yr2sec(1); % m^2/s
recurranceInterval = yr2sec(500)*ones(1,nEq);
offsetArray = v*(recurranceInterval);
w0 = 3; % width of the fault zone (m)
hc = 5; % height to avulse (loosely based on the channel height at wallace creek
avulseYN = true; % simulate avulsions
shutterRidgeSp = 100; % shutter ridge spacing (m)
shutterRidgeHeight = 0.00; % add amplitude here to simulate shutter ridge
upliftRate = 0.000*v/yr2sec(1); % (m/s) add uplift here to simulate uplift
hcfh = @(t) ...
hc + shutterRidgeHeight*abs(sin(2*pi*v*t/(2*shutterRidgeSp))) + upliftRate*t; % hill-looking thing + uplift
showLive = true;
tc = eq_cycle_channel_model(x,z,dx,w0, ... % Geometry
k, N, ... % Diffusion
recurranceInterval, offsetArray, ... % Earthquakes
hcfh, avulseYN, ... % Channel
showLive);
end
elseif nargin == 6
L = 2*reach;
dx = L/1000;
N = 100;
[x,z] = simple_profile(S0,dx,L);
k = 0.1*r*reach/yr2sec(1); % m^2/s
charEQ = 6; % characteristic slip (m)
recurranceInterval = charEQ/v;
offsetArray = v*(recurranceInterval);
avulseYN = 'break';
showLive = false;
tc = eq_cycle_channel_model(x,z,dx,w0, ... % Geometry
k, N, ... % Diffusion
recurranceInterval, offsetArray, ... % Earthquakes
hc, avulseYN, ... % Channel
showLive);
end
end
function ut = diffuse(x,fx,k,t,N)
x = x(:); fx= fx(:);
nx= length(x);
L = range(x);
T1 = fx(1);
T2 = fx(end);
u_E = T1 + (T2-T1)/L * x;
%% determine coefficients:
B = zeros(N,1);
Narr = (1:N)';
for n = Narr'
B(n) = 2/L * trapz(x,(fx-u_E).* sin(n*pi*x/L));
end
%% solution at time t
ut = u_E' + B' * (sin(Narr*pi*x'/L) .* (exp(-k*(Narr*pi/L).^2*t)*ones(1,nx)));
end
function [x,z] = simple_profile(S0,dx,L)
x = 0:dx:L;
z = S0*L-S0*x;
end
function [nx,ny] = stretch(x,y,dx,w,xo,stretch_factor)
% edge case to deal with:
% w<dx
% fault right on/near the edge
I = x>xo-w/2 & x<xo+w/2;
I0 = find(I,1,'first');
If = find(I,1,'last');
% initial stretched segment:
yS_o = y(I);
xS_o = x(I);
% stretch
% x -> x*stretch_factor
xS = xS_o(1)+(xS_o-xS_o(1))*stretch_factor;
% densify
xD = linspace(min(xS),max(xS),ceil(range(xS)/dx)); % NOTE! this results in uneven point spacing!
% densify the y coord
yD = interp1(xS,yS_o,xD);
nx = [x(1:I0-1),xD,x(If+1:end)+(range(xD)-range(xS_o))];
ny = [y(1:I0-1),yD,y(If+1:end)];
end
function tc = eq_cycle_channel_model(x,z,dx,w0, ... % Geometry
k, N, ... % Diffusion
recurranceInterval, offsetArray, ... % Earthquakes
hc, avulseYN, ... % Channel
showLive)
% turn hc into a function handle if not already
if ~isa(hc,'function_handle')
hcfh = @(t) hc*ones(size(t));
else
hcfh = hc;
end
% initial geometry
[z0,zz] = deal(z);
[x0,xx] = deal(x);
nEq= length(recurranceInterval);
figure; set(gcf,'color','w');
subplot(2,2,1);
ph0 = plot(x0,z0,'Color',[1 0 0]); hold on
wInProfile = w0;
T = sum(recurranceInterval);
fx0 = max(x)/2;
xc = fx0 - w0/2;
Ic = find(x0<xc,1,'last');
plot(xc*ones(1,2),minmax(z0),'--');
zxc = zeros(1,nEq);
zxc0 = interp1(x0,z0,xc);
tc = 0;
NA = 1;
for n = 1:nEq
stretch_factor = sqrt(w0^2+(sum(offsetArray(NA:n))^2))/wInProfile;
[x,z] = stretch(x,z,dx,wInProfile,fx0,stretch_factor);
[xx,zz] = stretch(xx,zz,dx,wInProfile,fx0,stretch_factor);
z = diffuse(x,z,k,recurranceInterval(n),N);
% plot the profile after it has diffused (right before the next
% earthquake)
subplot(2,2,1);
lp = plot(x,z, ...
'Color',[1-sum(recurranceInterval(1:n))/T,0,sum(recurranceInterval(1:n))/T]);
I = x>xc & x<(xc + wInProfile);
hold on
lf = plot(x(I),z(I), ...
'Color',[1-sum(recurranceInterval(1:n))/T,0,sum(recurranceInterval(1:n))/T], ...
'LineWidth',1.5);
lp.Color(4) = 0.5;
lf.Color(4) = 0.5;
if nargin == 11
if showLive
plot(x0,z0)
plot(xx,zz,'k')
hold off
set(gca,'xlim',[min(x0),max(x0)*1.5])
set(gca,'ylim',minmax(z0))
drawnow
end
end
subplot(2,2,3)
curvature = gradient(gradient(z, x),x);
curvNorm = curvature/max(abs(curvature));
plot(x,curvNorm, ...
'Color',[1-sum(recurranceInterval(1:n))/T,0,sum(recurranceInterval(1:n))/T]);
I = x>xc & x<(xc + wInProfile);
hold on
lf = plot(x(I),curvNorm(I), ...
'Color',[1-sum(recurranceInterval(1:n))/T,0,sum(recurranceInterval(1:n))/T], ...
'LineWidth',1.5);
lp.Color(4) = 0.5;
lf.Color(4) = 0.5;
if nargin == 11
if showLive
plot(xlim,[0 0],'-','Color',[0.8 0.8 0.8])
hold off
set(gca,'Ylim',[-1,1],'Ytick',[-0.5,0.5],'yticklabel',{'Eroding', 'Aggrading'})
set(gca,'xlim',[min(x0),max(x0)*1.5])
drawnow
end
end
ti = sum(recurranceInterval(1:n));
zxc(n) = interp1(x,z,xc);
if zxc(n)-zxc0 > hcfh(ti)
tc = [tc,ti-sum(tc)];
if avulseYN
% Resest the channel to the original form beyond xc
% this is not necessarily as straight forward as it may
% seem...
z = [z(1:Ic),z0((Ic+1):end)]; % reset to original channel after the critical point
% z = [z(1:Ic),z0((Ic+1):end) + (z(Ic)-z0(Ic+1))]; % reset to the original channel after the critical point, but shifted up by the aggradation at xc
% z = [z(1:Ic),z(Ic)-z(Ic)*(x0((Ic+1):end)-xc)/(max(x0)-xc)]; % reset to return to base level over the original domain size from xc
% z = [z(1:Ic), (z0(Ic+1)+hcfh(ti))-((z0(Ic+1)+hcfh(ti))-z0(end))/(max(x0)-xc)*(x0((Ic+1):end)-xc)];
x = [x(1:Ic),x0((Ic+1):end)];
zz= z0;
xx= x0;
wInProfile = w0;
NA = n;
elseif strcmp(avulseYN,'break')
break
end
end
wInProfile = sqrt(w0^2+ sum(offsetArray(NA:n))^2);
fx0 = xc + wInProfile/2;
end
tc = tc(2:end);
yr2sec = @(yr) yr*(60*60*24*365);
t = cumsum(recurranceInterval)/yr2sec(1)/1000;
ax1 = subplot(2,2,[2,4]); hold on
plot(t,zxc-zxc0,'.-')
ylabel('Aggradation [m]')
xlabel('Time (kyr)')
phhc = plot(t,hcfh(t),'--');
legend(phhc,'h_c')
set(gca,'Ylim',[0,max(zxc-zxc0)*1.5])
t = title('c)');
set(t,'Units','normalized','Position',[-0.22,0.95])
subplot(2,2,1);
try legend([ph0,lp],{'Initial profile','Final profile'}); catch; legend(lp,'Final profile'); end
ylabel('Elevation [m]')
t = title('a)');
set(t,'Units','normalized','Position',[-0.22,0.95])
subplot(2,2,3);
xlabel('Along profile distance [m]')
ylabel('Normalized Curvature')
t = title('b)');
set(t,'Units','normalized','Position',[-0.22,0.95])
ftsz = @(fh,fontSize) set(findall(fh,'-property','FontSize'),'FontSize',fontSize);
setsize = @(fh,dim1,dim2) set(fh,...
'Units', 'Inches', ...
'Position', [0,0,dim1,dim2],...
'PaperUnits', 'Inches',...
'PaperSize', [dim1,dim2]);
ftsz(gcf,12)
setsize(gcf,7,3.5)
end
% substitude for minmax
function OUT = minmax(A)
OUT = [min(A),max(A)];
end