-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFun_SetInvFaultUpdate.m
More file actions
33 lines (27 loc) · 1.34 KB
/
Copy pathFun_SetInvFaultUpdate.m
File metadata and controls
33 lines (27 loc) · 1.34 KB
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
function [newGrid, newSource, newIndex] = Fun_SetInvFaultUpdate( ...
NormSlip, oldGrid, oldSource, gridsize, SDR, loca, ...
epicenter, depth, IndexEQ)
% =========================================================================
% Update the fault grid based on the principal rupture region, then remove
% rows that lie above the free surface
[newGrid, newSource] = subfaults_making(NormSlip, oldGrid, oldSource);
% Generate depths for the proposed updated fault grid.
[~, newDep] = get_subloca( ...
SDR, newGrid([2, 1]), gridsize, [1, newSource([2, 1])], loca, epicenter);
newIndex = (newSource(2) - 1) * newGrid(1) + newSource(1);
% Shift the entire fault plane so that the source subfault matches the
% prescribed hypocentral depth.
newDep = newDep + (depth(IndexEQ) - newDep(newIndex));
%% ------------------------------------------------------------------------
% Remove dip-direction rows that are above the free surface
nRemoveTop = ceil(sum(newDep(:) < 0) / newGrid(2));
if nRemoveTop > 0
newSource(1) = newSource(1) - nRemoveTop;
newGrid(1) = newGrid(1) - nRemoveTop;
if newSource(1) < 1 || newGrid(1) < 1
error(['Fault-grid adjustment removed the hypocentral row ', ...
'or all dip-direction rows.']);
end
end
newIndex = (newSource(2) - 1) * newGrid(1) + newSource(1);
end