-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFun_SetInvFaultTrim.m
More file actions
45 lines (36 loc) · 1.42 KB
/
Copy pathFun_SetInvFaultTrim.m
File metadata and controls
45 lines (36 loc) · 1.42 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
34
35
36
37
38
39
40
41
42
43
44
45
function [g, locasub, locadep, muSubfault, ...
substf, slip, grid, source] = Fun_SetInvFaultTrim( ...
g, locasub, locadep, muSubfault, ...
substf, substfa, grid, source, ...
gridsize, CCritSlip)
% =========================================================================
% Fun_FinalFaultTrim
%
% Trim subfaults outside the final main rupture region.
%
% The last page of substfa is used because it stores the final inversion
% result generated by ids_data.
% =========================================================================
if isempty(substfa)
error('substfa is empty. Final fault trimming cannot be performed.');
end
% Slip before trimming, using the final inversion page.
fSlip = sum(substfa(:, :, end), 1) ./ 3e16 ./ prod(gridsize);
% kf is the index vector of retained subfaults.
[kf, grid, source] = adjust_grid( ...
fSlip, grid, source, CCritSlip);
if isempty(kf)
error('adjust_grid returned an empty subfault selection.');
end
% Retain selected source-time functions.
substf = substfa(:, kf, end);
% Retain geometry and rigidity values consistently.
locadep = locadep(kf, :);
locasub = locasub(kf, :);
muSubfault = muSubfault(kf);
% Retain the corresponding Green functions.
g = g(:, :, kf);
% Final slip distribution on the trimmed fault grid.
fSlip = sum(substf, 1) ./ 3e16 ./ prod(gridsize);
slip = reshape(fSlip, grid);
end