Skip to content

Commit c9d7841

Browse files
committed
new NZ subduction models and page updates
1 parent 7cd616c commit c9d7841

File tree

8 files changed

+345
-25
lines changed

8 files changed

+345
-25
lines changed

src/main/java/scratch/kevin/simulators/RSQSimCatalog.java

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,70 @@ public enum Catalogs {
705705
FaultModels.FM3_1, DeformationModels.GEOLOGIC),
706706
BRUCE_5672("rundir5672", "Bruce 5672", "Bruce Shaw", cal(2023, 11, 6),
707707
"CA high res; dynamic, bdeep=.014, bshallow=.003, alpha=0.25, hload=hst=3.0, fractionLow=.10, blow=.003",
708-
FaultModels.FM3_1, DeformationModels.GEOLOGIC);
708+
FaultModels.FM3_1, DeformationModels.GEOLOGIC),
709+
BRUCE_5684("rundir5684", "Bruce 5684", "Bruce Shaw", cal(2023, 12, 7),
710+
"NZ dynamic, bdeep=.010, bshallow=.003, alpha=0.25, hload=hst=3.0",
711+
59, 'G'),
712+
BRUCE_5684_SUB("rundir5684_subduction", "Bruce 5684 (Subduction Only)", "Bruce Shaw", cal(2023, 12, 7),
713+
"NZ dynamic, bdeep=.010, bshallow=.003, alpha=0.25, hload=hst=3.0; Filtered for slip on subduction patches only;",
714+
59, 'G'),
715+
BRUCE_5684_CRUSTAL("rundir5684_crustal", "Bruce 5684 (Crustal Only)", "Bruce Shaw", cal(2023, 12, 7),
716+
"NZ dynamic, bdeep=.010, bshallow=.003, alpha=0.25, hload=hst=3.0; Filtered for slip on crustal patches only;",
717+
59, 'G'),
718+
BRUCE_5685("rundir5685", "Bruce 5685", "Bruce Shaw", cal(2023, 12, 7),
719+
"NZ dynamic, bdeep=.010, bshallow=.003, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.015",
720+
59, 'G'),
721+
BRUCE_5685_SUB("rundir5685_subduction", "Bruce 5685 (Subduction Only)", "Bruce Shaw", cal(2023, 12, 7),
722+
"NZ dynamic, bdeep=.010, bshallow=.003, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.015; Filtered for slip on subduction patches only;",
723+
59, 'G'),
724+
BRUCE_5685_CRUSTAL("rundir5685_crustal", "Bruce 5685 (Crustal Only)", "Bruce Shaw", cal(2023, 12, 7),
725+
"NZ dynamic, bdeep=.010, bshallow=.003, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.015; Filtered for slip on crustal patches only;",
726+
59, 'G'),
727+
BRUCE_5687("rundir5687", "Bruce 5687", "Bruce Shaw", cal(2023, 12, 26),
728+
"NZ dynamic, bdeep=.009, bshallow=.003, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.018",
729+
59, 'G'),
730+
BRUCE_5687_SUB("rundir5687_subduction", "Bruce 5687 (Subduction Only)", "Bruce Shaw", cal(2023, 12, 26),
731+
"NZ dynamic, bdeep=.009, bshallow=.003, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.018; Filtered for slip on subduction patches only;",
732+
59, 'G'),
733+
BRUCE_5687_CRUSTAL("rundir5687_crustal", "Bruce 5687 (Crustal Only)", "Bruce Shaw", cal(2023, 12, 26),
734+
"NZ dynamic, bdeep=.009, bshallow=.003, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.018; Filtered for slip on crustal patches only;",
735+
59, 'G'),
736+
BRUCE_5689("rundir5689", "Bruce 5689", "Bruce Shaw", cal(2023, 12, 26),
737+
"NZ dynamic, bdeep=.009, bshallow=.002, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.018",
738+
59, 'G'),
739+
BRUCE_5689_SUB("rundir5689_subduction", "Bruce 5689 (Subduction Only)", "Bruce Shaw", cal(2023, 12, 26),
740+
"NZ dynamic, bdeep=.009, bshallow=.002, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.018; Filtered for slip on subduction patches only;",
741+
59, 'G'),
742+
BRUCE_5689_CRUSTAL("rundir5689_crustal", "Bruce 5689 (Crustal Only)", "Bruce Shaw", cal(2023, 12, 26),
743+
"NZ dynamic, bdeep=.009, bshallow=.002, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.018; Filtered for slip on crustal patches only;",
744+
59, 'G'),
745+
BRUCE_5691("rundir5691", "Bruce 5691", "Bruce Shaw", cal(2024, 1, 5),
746+
"NZ dynamic, bdeep=.009, bshallow=.002, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.019",
747+
59, 'G'),
748+
BRUCE_5691_SUB("rundir5691_subduction", "Bruce 5691 (Subduction Only)", "Bruce Shaw", cal(2024, 1, 5),
749+
"5691, but filtered for slip on subduction patches only;",
750+
59, 'G'),
751+
BRUCE_5691_CRUSTAL("rundir5691_crustal", "Bruce 5691 (Crustal Only)", "Bruce Shaw", cal(2024, 1, 5),
752+
"5691, but filtered for slip on crustal patches only;",
753+
59, 'G'),
754+
BRUCE_5696("rundir5696", "Bruce 5696", "Bruce Shaw", cal(2024, 1, 19),
755+
"NZ dynamic, bdeep=.010, bshallow=.002, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.018",
756+
59, 'G'),
757+
BRUCE_5696_SUB("rundir5696_subduction", "Bruce 5696 (Subduction Only)", "Bruce Shaw", cal(2024, 1, 19),
758+
"5696, but filtered for slip on subduction patches only;",
759+
59, 'G'),
760+
BRUCE_5696_CRUSTAL("rundir5696_crustal", "Bruce 5696 (Crustal Only)", "Bruce Shaw", cal(2024, 1, 19),
761+
"5696, but filtered for slip on crustal patches only;",
762+
59, 'G'),
763+
BRUCE_5697("rundir5697", "Bruce 5697", "Bruce Shaw", cal(2024, 1, 19),
764+
"NZ dynamic, bdeep=.010, bshallow=.0015, alpha=0.25, hload=hst=3.0, fractionLow=.10, bhigh=.018",
765+
59, 'G'),
766+
BRUCE_5697_SUB("rundir5697_subduction", "Bruce 5697 (Subduction Only)", "Bruce Shaw", cal(2024, 1, 19),
767+
"5697, but filtered for slip on subduction patches only;",
768+
59, 'G'),
769+
BRUCE_5697_CRUSTAL("rundir5697_crustal", "Bruce 5697 (Crustal Only)", "Bruce Shaw", cal(2024, 1, 19),
770+
"5697, but filtered for slip on crustal patches only;",
771+
59, 'G');
709772

710773
private String dirName;
711774
private RSQSimCatalog catalog;
@@ -1066,6 +1129,7 @@ public void writeMarkdownSummary(File dir, boolean plots, boolean replot, double
10661129
List<String> multiFaultNames = new ArrayList<>();
10671130

10681131
String partBSummaryLink = null;
1132+
String crustalSubductionGMsLink = null;
10691133
String vmCompareRotRupLink = null;
10701134
String extremeEventLink = null;
10711135
String parentMFDLink = null;
@@ -1146,6 +1210,8 @@ public void writeMarkdownSummary(File dir, boolean plots, boolean replot, double
11461210
vmCompareRotRupLink = name;
11471211
} else if (name.equals("bbp_part_b_summary")) {
11481212
partBSummaryLink = name;
1213+
} else if (name.equals("crustal_subduction_gms")) {
1214+
crustalSubductionGMsLink = name;
11491215
} else if (name.equals("parent_sect_mfds")) {
11501216
parentMFDLink = name;
11511217
} else if (name.equals("dist_method_comparisons")) {
@@ -1498,6 +1564,14 @@ public void writeMarkdownSummary(File dir, boolean plots, boolean replot, double
14981564
lines.add("[BBP PartB Summary Here]("+partBSummaryLink+"/)");
14991565
}
15001566

1567+
if (crustalSubductionGMsLink != null) {
1568+
lines.add("");
1569+
lines.add("## BBP Crustal + Subduction Combined GMs");
1570+
lines.add(topLink);
1571+
lines.add("");
1572+
lines.add("[BBP Crustal + Subduction Combined GMs Here]("+crustalSubductionGMsLink+"/)");
1573+
}
1574+
15011575
if (vmCompareRotRupLink != null) {
15021576
lines.add("");
15031577
lines.add("## BBP Velocity Model Comparisons");
@@ -3306,7 +3380,7 @@ public static void main(String args[]) throws IOException, DocumentException {
33063380
Arrays.sort(cats, new CatEnumDateComparator());
33073381
// new catalogs
33083382
// GregorianCalendar minDate = cal(2021, 10, 1);
3309-
GregorianCalendar minDate = cal(2023, 1, 1);
3383+
GregorianCalendar minDate = cal(2024, 1, 1);
33103384
for (Catalogs cat : cats) {
33113385
// specific catalog
33123386
// GregorianCalendar minDate = cal(2000, 1, 1);

src/main/java/scratch/kevin/simulators/nz/NZ_CompModels.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ public synchronized List<? extends FaultSection> build(RupSetFaultModel faultMod
9494
}
9595
return subSects;
9696
}
97+
98+
@Override
99+
public List<? extends FaultSection> build(RupSetFaultModel faultModel, int minPerFault, double ddwFract,
100+
double fixedLen) throws IOException {
101+
Preconditions.checkState(minPerFault == 2, "minPerFault must be 2 for this NZ Test");
102+
Preconditions.checkState(ddwFract == 0.5, "ddwFract must be 0.5 for this NZ Test");
103+
Preconditions.checkState(!(fixedLen > 0d), "fixedLen must be NaN for this NZ Test");
104+
return build(faultModel);
105+
}
106+
107+
@Override
108+
public List<? extends FaultSection> buildForSubsects(RupSetFaultModel faultModel,
109+
List<? extends FaultSection> subSects) throws IOException {
110+
throw new UnsupportedOperationException("Not supported, NZ must build the subsections");
111+
}
97112

98113
}
99114

src/main/java/scratch/kevin/simulators/ruptures/CatalogGMPE_Compare.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,8 @@ public static void main(String[] args) throws ZipException, IOException {
572572
// RSQSimCatalog catalog = Catalogs.BRUCE_4983_STITCHED.instance();
573573
// RSQSimCatalog catalog = Catalogs.BRUCE_5413.instance();
574574
// RSQSimCatalog catalog = Catalogs.BRUCE_5652.instance();
575-
RSQSimCatalog catalog = Catalogs.BRUCE_5597_CRUSTAL.instance();
576-
// RSQSimCatalog catalog = Catalogs.BRUCE_5597_SUB.instance();
575+
RSQSimCatalog catalog = Catalogs.BRUCE_5566_CRUSTAL.instance();
576+
// RSQSimCatalog catalog = Catalogs.BRUCE_5566_SUB.instance();
577577

578578
boolean doGMPE = true;
579579
boolean doRotD = false;
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package scratch.kevin.simulators.ruptures;
2+
3+
import java.io.IOException;
4+
import java.text.DecimalFormat;
5+
import java.util.HashMap;
6+
import java.util.List;
7+
import java.util.Map;
8+
import java.util.Set;
9+
10+
import org.opensha.commons.calc.FaultMomentCalc;
11+
import org.opensha.sha.simulators.RSQSimEvent;
12+
import org.opensha.sha.simulators.SimulatorElement;
13+
import org.opensha.sha.simulators.srf.RSQSimEventSlipTimeFunc;
14+
15+
import scratch.kevin.simulators.RSQSimCatalog;
16+
import scratch.kevin.simulators.RSQSimCatalog.Catalogs;
17+
18+
public class EventDurationSearch {
19+
20+
public static void main(String[] args) throws IOException {
21+
RSQSimCatalog catalog = Catalogs.BRUCE_5685_SUB.instance();
22+
double minMag = 8.5;
23+
24+
double minPrintSecs = 400;
25+
26+
List<RSQSimEvent> events = catalog.loader().skipYears(2000).minMag(minMag).load();
27+
28+
catalog.getTransitions().setQuiet(true);
29+
30+
RSQSimEvent longest = null;
31+
double longestDuration = 0d;
32+
RSQSimEventSlipTimeFunc longestSlipTime = null;
33+
34+
double[] thresholds = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
35+
int[] threshCounts = new int[thresholds.length];
36+
37+
for (RSQSimEvent event : events) {
38+
RSQSimEventSlipTimeFunc slipTimeFunc = catalog.getSlipTimeFunc(event);
39+
40+
double firstSlip = slipTimeFunc.getStartTime();
41+
double lastSlip = slipTimeFunc.getEndTime();
42+
double duration = lastSlip - firstSlip;
43+
if (duration > minPrintSecs)
44+
System.out.println(eventDurStr(event, duration, slipTimeFunc));
45+
for (int i=0; i<thresholds.length; i++)
46+
if (duration > thresholds[i])
47+
threshCounts[i]++;
48+
if (duration > longestDuration) {
49+
longestDuration = duration;
50+
longest = event;
51+
longestSlipTime = slipTimeFunc;
52+
}
53+
}
54+
System.out.println("Longest event:\n"+eventDurStr(longest, longestDuration, longestSlipTime));
55+
for (int i=0; i<threshCounts.length; i++) {
56+
if (thresholds[i] > longestDuration)
57+
break;
58+
System.out.println("Events over "+(int)thresholds[i]+" s ("+twoDigits.format(thresholds[i]/60d)+" m):\t"+threshCounts[i]);
59+
}
60+
}
61+
62+
private static final DecimalFormat twoDigits = new DecimalFormat("0.00");
63+
private static String eventDurStr(RSQSimEvent event, double duration, RSQSimEventSlipTimeFunc slipTimeFunc) {
64+
String str = "event "+event.getID()+", M"+twoDigits.format(event.getMagnitude())+", "
65+
+twoDigits.format(duration)+" s = "+twoDigits.format(duration/60d)+" m";
66+
67+
Set<Integer> patches = slipTimeFunc.getPatchIDs();
68+
Map<Integer, Double> areas = new HashMap<>(patches.size());
69+
for (SimulatorElement elem : event.getAllElements())
70+
areas.put(elem.getID(), elem.getArea());
71+
double totMoment = 0d;
72+
double minTime = slipTimeFunc.getStartTime();
73+
double maxTime = slipTimeFunc.getEndTime();
74+
for (int patchID : patches)
75+
totMoment += FaultMomentCalc.getMoment(areas.get(patchID), slipTimeFunc.getCumulativeEventSlip(patchID, maxTime));
76+
77+
String timeLine = "";
78+
String fractLine = "";
79+
for (double thresh=50d; thresh<duration; thresh += 50d) {
80+
double time = minTime + thresh;
81+
double timeMoment = 0;
82+
for (int patchID : patches)
83+
timeMoment += FaultMomentCalc.getMoment(areas.get(patchID), slipTimeFunc.getCumulativeEventSlip(patchID, time));
84+
double fract = timeMoment/totMoment;
85+
timeLine += "\t"+(int)(thresh+0.5)+" s";
86+
fractLine += "\t"+twoDigits.format(fract);
87+
}
88+
str += ";\tMoment Fractions:\n"+timeLine+"\n"+fractLine;
89+
return str;
90+
}
91+
92+
}

src/main/java/scratch/kevin/simulators/ruptures/MPJ_BBP_CatalogSimScriptGen.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ public static void main(String[] args) throws IOException {
3333
// String catalogDirName = "rundir4860_multi_combine";
3434
// String catalogDirName = "rundir5450";
3535
// String catalogDirName = "rundir4983_stitched";
36-
// String catalogDirName = "rundir5566";
37-
// String catalogDirName = "rundir5597";
36+
String catalogDirName = "rundir5566";
37+
// String catalogDirName = "rundir5697";
3838
// String catalogDirName = "rundir5413_multifault_separate";
3939
// String catalogDirName = "rundir5597_subduction_corupture";
4040
// String catalogDirName = "rundir5597_crustal_corupture";
41-
String catalogDirName = "rundir5597_subduction";
42-
// String catalogDirName = "rundir5597_crustal";
41+
// String catalogDirName = "rundir5566_subduction";
42+
// String catalogDirName = "rundir5566_crustal";
4343

4444
// int skipYears = 20000;
4545
// int skipYears = 5000;
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package scratch.kevin.simulators.ruptures;
2+
3+
import java.io.IOException;
4+
import java.util.ArrayList;
5+
import java.util.Comparator;
6+
import java.util.List;
7+
8+
import org.opensha.commons.data.function.DiscretizedFunc;
9+
import org.opensha.sha.simulators.RSQSimEvent;
10+
import org.opensha.sha.simulators.srf.RSQSimEventSlipTimeFunc;
11+
import org.opensha.sha.simulators.srf.RSQSimState;
12+
import org.opensha.sha.simulators.srf.RSQSimStateTime;
13+
14+
import scratch.kevin.simulators.RSQSimCatalog;
15+
import scratch.kevin.simulators.RSQSimCatalog.Catalogs;
16+
17+
public class SlipTimeDebug {
18+
19+
public static void main(String[] args) throws IOException {
20+
RSQSimCatalog catalog = Catalogs.BRUCE_5597_CRUSTAL.instance();
21+
int eventID = 99110;
22+
23+
RSQSimEvent event = catalog.loader().byID(eventID);
24+
25+
System.out.println("Event "+eventID+" is an M"+(float)event.getMagnitude()+" at "+(float)event.getTimeInYears()+" yrs");
26+
27+
RSQSimEventSlipTimeFunc origSlipTimeFunc = catalog.getSlipTimeFunc(event);
28+
RSQSimEventSlipTimeFunc slipTimeFunc = origSlipTimeFunc.asRelativeTimeFunc();
29+
30+
List<Integer> patchIDs = new ArrayList<>(slipTimeFunc.getPatchIDs());
31+
patchIDs.sort(new Comparator<Integer>() {
32+
33+
@Override
34+
public int compare(Integer p1, Integer p2) {
35+
return Double.compare(slipTimeFunc.getTimeOfFirstSlip(p1), slipTimeFunc.getTimeOfFirstSlip(p2));
36+
}
37+
});
38+
39+
int maxSlipPatch = -1;
40+
double overallMaxSlip = 0d;
41+
boolean firstDebug = true;
42+
43+
for (int p=0; p<patchIDs.size(); p++) {
44+
boolean print = p < 50 || patchIDs.size() <= 200 || p >= patchIDs.size()-52;
45+
if (p == 50 && patchIDs.size() > 200) {
46+
int newP = patchIDs.size()-52;
47+
System.out.println("(...skipping "+(newP-(p+1))+" patches...)");
48+
p = newP;
49+
}
50+
int patchID = patchIDs.get(p);
51+
double timeFirst = slipTimeFunc.getTimeOfFirstSlip(patchID);
52+
double timeLast = slipTimeFunc.getTimeOfLastSlip(patchID);
53+
double maxSlip = slipTimeFunc.getCumulativeEventSlip(patchID, timeLast);
54+
if (maxSlip > overallMaxSlip) {
55+
overallMaxSlip = maxSlip;
56+
maxSlipPatch = patchID;
57+
}
58+
if (print) {
59+
double duration = timeLast - timeFirst;
60+
List<RSQSimStateTime> states = slipTimeFunc.getTransitions(patchID);
61+
int numSlipStates = 0;
62+
for (RSQSimStateTime state : states)
63+
if (state.state == RSQSimState.EARTHQUAKE_SLIP)
64+
numSlipStates++;
65+
System.out.println("Patch "+patchID+" at "+(float)+timeFirst+"s => "+(float)timeLast+"s");
66+
System.out.println("\t"+(float)maxSlip+" m in "+(float)duration+" s");
67+
System.out.println("\t"+states.size()+" states, "+numSlipStates+" eq slip");
68+
if (maxSlip == 0d && numSlipStates > 0 && firstDebug) {
69+
System.out.println("\tDebugging zero slip with "+numSlipStates+" slip states");
70+
firstDebug = false;
71+
for (RSQSimStateTime state : states) {
72+
if (state.state == RSQSimState.EARTHQUAKE_SLIP) {
73+
System.out.println("\t\t"+state);
74+
}
75+
}
76+
DiscretizedFunc slipTime = slipTimeFunc.getSlipFunc(patchID);
77+
System.out.println(slipTime);
78+
}
79+
}
80+
}
81+
if (maxSlipPatch == -1) {
82+
System.out.println("No slip!");
83+
} else {
84+
System.out.println("Max slip was on "+maxSlipPatch+": "+(float)overallMaxSlip
85+
+" m starting at "+(float)slipTimeFunc.getTimeOfFirstSlip(maxSlipPatch)+" s");
86+
}
87+
}
88+
89+
}

0 commit comments

Comments
 (0)