Skip to content
Snippets Groups Projects
Commit 3e75f826 authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

restructuring prvi class

parent bf6b2fc7
No related branches found
No related tags found
1 merge request!419rough framework for PRVI background GMC models based on CombinedGmm....
package gov.usgs.earthquake.nshmp.gmm;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.AG_20_GLOBAL_INTERFACE;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.AG_20_GLOBAL_SLAB;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.ASK_14;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.BSSA_14;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.CB_14;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.CY_14;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.KBCG_20_GLOBAL_INTERFACE;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.KBCG_20_GLOBAL_SLAB;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.PSBAH_20_GLOBAL_INTERFACE;
import static gov.usgs.earthquake.nshmp.gmm.Gmm.PSBAH_20_GLOBAL_SLAB;
import static gov.usgs.earthquake.nshmp.gmm.SubductionZone.Type.INTERFACE;
import static gov.usgs.earthquake.nshmp.gmm.SubductionZone.Type.SLAB;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import gov.usgs.earthquake.nshmp.data.DoubleData;
import gov.usgs.earthquake.nshmp.gmm.GmmInput.Constraints;
import gov.usgs.earthquake.nshmp.tree.LogicTree;
/**
* PRVI GMC class for backbone GMM implementations.
*
* Copied from CombinedGmm:
*
* Convenience class for combined GMM implementations that compute weight
* averaged ground motions and sigmas for a logic tree of ground motion models.
* These are NOT intended for use in hazard calculations, but are made available
* to support comparative deterministic analysis of GMM logic trees.
*/
class UsgsPrviBackbone2025 implements GroundMotionModel {
private static final String NAME = "USGS PRVI Backbone (2025)";
static final CoefficientContainer COEFFS_PHIS2S_ACTIVE_CRUST =
new CoefficientContainer("prvi-25-backbone-phiS2S_crustal.csv");
static final CoefficientContainer COEFFS_PHISS_ACTIVE_CRUST =
new CoefficientContainer("prvi-25-backbone-phiSS_crustal.csv");
static final CoefficientContainer COEFFS_SIGMA_SUBDUCTION =
new CoefficientContainer("prvi-25-backbone-sigma_subduction.csv");
static final CoefficientContainer COEFFS_TAU_ACTIVE_CRUST =
new CoefficientContainer("prvi-25-backbone-tau_crustal.csv");
/*
* Bias adjustment coefficients from https://github.com/gem/oq-engine/blob/
* 576bf0c6853ca896aae84e68ad848d39de09a396/openquake/hazardlib/gsim/usgs_prvi
* .py last updated Jun 25, 2024
*/
static final CoefficientContainer COEFFS_DATA_ADJUSTMENT =
new CoefficientContainer("prvi-25-data-adjustments.csv");
private final double ACTIVE_CRUSTAL_MEAN_ADJUSTMENT = -0.371;
private final double SUBDUCTION_INTERFACE_MEAN_ADJUSTMENT = -1.098;
private final double SUBDUCTION_INTRASLAB_MEAN_ADJUSTMENT = -0.405;
private final Map<Gmm, Double> gmms;
private final Imt imt;
/* Supply map of ground motion models initialized to the required IMT. */
private UsgsPrviBackbone2025(Imt imt, Map<Gmm, Double> gmms) {
this.gmms = gmms;
this.imt = imt;
double[] weights = gmms.values().stream()
.mapToDouble(Double::doubleValue)
.toArray();
DoubleData.checkWeightSum(weights);
}
@Override
public Imt imt() {
return imt;
}
@Override
public LogicTree<GroundMotion> calc(GmmInput in) {
LogicTree.Builder<GroundMotion> builder = LogicTree.builder(NAME);
gmms.keySet().forEach(key -> builder.addBranch(
key.name(),
GroundMotions.combine(key.instance(imt).calc(in)),
gmms.get(key)));
return builder.build();
}
static Map<Gmm, GroundMotionModel> instancesForImt(
Imt imt,
Map<Gmm, Double> gmms) {
return gmms.entrySet().stream()
.collect(Collectors.toMap(
Entry::getKey,
entry -> entry.getKey().instance(imt)));
}
/*
* Implementations. For each, coefficients are only used to get the set of
* supported IMTs and therefore reference a model that supports the
* intersection of all support IMTs.
*/
/* PRVI 2025 Active Crust */
static final class ActiveCrust extends UsgsPrviBackbone2025 {
static final String NAME = UsgsPrviBackbone2025.NAME + ": Active Crust";
static final Constraints CONSTRAINTS = AbrahamsonEtAl_2014.CONSTRAINTS;
static final CoefficientContainer COEFFS = AbrahamsonEtAl_2014.COEFFS;
static final Map<Gmm, Double> GMM_MAP = Map.of(
ASK_14, 0.25,
BSSA_14, 0.25,
CB_14, 0.25,
CY_14, 0.25);
ActiveCrust(Imt imt) {
super(imt, GMM_MAP);
}
}
/* PRVI 2025 Subduction Interface */
static final class Interface extends UsgsPrviBackbone2025 {
static final String NAME = UsgsPrviBackbone2025.NAME + ":" + INTERFACE;
static final Constraints CONSTRAINTS = AbrahamsonGulerce_2020.CONSTRAINTS_INTERFACE;
static final CoefficientContainer COEFFS = AbrahamsonGulerce_2020.COEFFS;
static final Map<Gmm, Double> GMM_MAP = Map.of(
AG_20_GLOBAL_INTERFACE, 0.3333,
KBCG_20_GLOBAL_INTERFACE, 0.3333,
PSBAH_20_GLOBAL_INTERFACE, 0.3334);
Interface(Imt imt) {
super(imt, GMM_MAP);
}
}
/* PRVI 2025 Subduction Intraslab */
static class Slab extends UsgsPrviBackbone2025 {
static final String NAME = UsgsPrviBackbone2025.NAME + ":" + SLAB;
static final Constraints CONSTRAINTS = AbrahamsonGulerce_2020.CONSTRAINTS_SLAB;
static final CoefficientContainer COEFFS = AbrahamsonGulerce_2020.COEFFS;
static final Map<Gmm, Double> GMM_MAP = Map.of(
AG_20_GLOBAL_SLAB, 0.3333,
KBCG_20_GLOBAL_SLAB, 0.3333,
PSBAH_20_GLOBAL_SLAB, 0.3334);
Slab(Imt imt) {
super(imt, GMM_MAP);
}
}
static final class SlabAdjusted extends Slab {
SlabAdjusted(Imt imt) {
super(imt);
// TODO Auto-generated constructor stub
}
}
// TODO consider separating calc method in NGA models so that we can get the
// mean directly instead of unwrapping from singleton ground motion logic tree
// static final Map<Gmm, Double> STABLE_CRUST_2014 = Map.of(
// AB_06_PRIME, 0.22,
// ATKINSON_08_PRIME, 0.08,
// CAMPBELL_03, 0.11,
// FRANKEL_96, 0.06,
// PEZESHK_11, 0.15,
// SILVA_02, 0.06,
// SOMERVILLE_01, 0.1,
// TP_05, 0.11,
// TORO_97_MW, 0.11);
//
// /* Need to allow Vs30=3000 through for comparison plots. */
// private static final Constraints STABLE_2014_CONSTRAINTS =
// Constraints.builder()
// .withDefaults()
// .build();
//
// /* 4.0 Fault variant that includes Somerville. */
// static final class StableCrust2014 extends PrviBackbone {
//
// static final String NAME = PrviBackbone.NAME + "Stable crust 2014 (4.*)";
// static final Constraints CONSTRAINTS = STABLE_2014_CONSTRAINTS;
// static final CoefficientContainer COEFFS = FrankelEtAl_1996.COEFFS;
//
// StableCrust2014(Imt imt) {
// super(imt, STABLE_CRUST_2014);
// }
//
// @Override
// public LogicTree<GroundMotion> calc(GmmInput in) {
// GmmInput.Builder b = GmmInput.builder().fromCopy(in);
// b.vs30(in.vs30 <= 760.0 ? 760.0 : 2000.0);
// return super.calc(b.build());
// }
// }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment