Source code for openquake.hazardlib.gsim.bozorgnia_campbell_2016
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2014-2025 GEM Foundation## OpenQuake is free software: you can redistribute it and/or modify it# under the terms of the GNU Affero General Public License as published# by the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## OpenQuake is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Affero General Public License for more details.## You should have received a copy of the GNU Affero General Public License# along with OpenQuake. If not, see <http://www.gnu.org/licenses/>."""Module exports :class:`BozorgniaCampbell2016` :class:`BozorgniaCampbell2016HighQ` :class:`BozorgniaCampbell2016LowQ` :class:`BozorgniaCampbell2016AveQJapanSite` :class:`BozorgniaCampbell2016HighQJapanSite` :class:`BozorgniaCampbell2016LowQJapanSite`"""importnumpyasnpfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTable,add_aliasfromopenquake.hazardlib.gsim.campbell_bozorgnia_2014import(_select_basin_model,_get_magnitude_term,_get_geometric_attenuation_term,_get_hanging_wall_term,_get_fault_dip_term,_get_hypocentral_depth_term,_get_taulny,_get_philny)fromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,PGV,SAdef_get_anelastic_attenuation_term(sgn,C,rrup):""" Returns the anelastic attenuation term, f_atn, defined in equation 25 """Dc20=_get_delta_c20(sgn,C)f_atn=np.zeros(len(rrup))idx=rrup>80.0f_atn[idx]=(C["c20"]+Dc20)*(rrup[idx]-80.0)returnf_atndef_get_basin_term(C,ctx,region,SJ):""" Returns the basin response term, f_sed, defined in equation 20 The deep basin response (z2.5 > 1km) is not included in this model """ifisinstance(ctx.z2pt5,np.ndarray):# Site model definedz2pt5=ctx.z2pt5else:# Estimate unspecified sediment depth according to# equations 33 and 34 of CB14z2pt5=_select_basin_model(SJ,ctx.vs30)f_sed=np.zeros_like(z2pt5)idx=z2pt5<1.0f_sed[idx]=(C["c14"]+C["c15"]*SJ)*(z2pt5[idx]-1.0)returnf_seddef_get_delta_c20(sgn,C):""" Retrieve regional-dependent coefficient accounting for differences in anelastic attenuation in path scaling This is to derive a reference/base-case c20 that includes California, Taiwan, the Middle East, and other similar active tectonic regions to represent a typical or average Q region. """ifsgn==0:return0.elifsgn==1:returnC['Dc20_CH']elifsgn==-1:returnC['Dc20_JP']def_get_shallow_site_response_term(SJ,C,vs30):""" Returns the shallow site response term, f_site, defined in equations 17, 18, and 19 Note that the effects of nonlinear soil response for the vertical component were not included in this model """vs_mod=vs30/C["k1"]# Get linear global site response termf_site_g=C["c11"]*np.log(vs_mod)# For Japan ctx (SJ = 1) further scaling is needed (equation 19)ifSJ:fsite_j=C["c13"]*np.log(vs_mod)# additional term activated for soft ctx (Vs30 <= 200m/s)# in Japan dataidx=vs30<=200.0add_soft=C["c12"]*(np.log(vs_mod)-np.log(200.0/C["k1"]))# combine termsfsite_j[idx]+=add_soft[idx]returnf_site_g+fsite_jelse:returnf_site_gdef_get_stddevs(C,ctx):""" Returns the inter-event, intra-event, and total standard deviations Note that it is assumed here that the soil response of the vertical component is linear (i.e. nonlinear site response effects not included). Thus, the expressions for the aleatory std devs for the vertical component is much simpler than in the horizontal component, since the site response- and IMT-correlation functions are neglected. """# Evaluate tau according to equation 27tau=_get_taulny(C,ctx.mag)# Evaluate phi according to equation 28phi=_get_philny(C,ctx.mag)return[np.sqrt(tau**2+phi**2),tau,phi]def_get_style_of_faulting_term(C,ctx):""" Returns the style-of-faulting scaling term, f_flt, defined in equations 4 to 6 """frv=np.zeros_like(ctx.rake)fnm=np.zeros_like(ctx.rake)frv[(ctx.rake>30.)&(ctx.rake<150.)]=1.fnm[(ctx.rake>-150.)&(ctx.rake<-30.0)]=1.# Re-defined this method to replace c8, which is now# IMT-dependent in BC15fflt_f=C["c8"]*frv+C["c9"]*fnmfflt_m=np.clip(ctx.mag-4.5,0.,1.)returnfflt_f*fflt_m
[docs]defget_mean_values(SJ,sgn,C,ctx):""" Returns the mean values for a specific IMT """return(_get_magnitude_term(C,ctx.mag)+_get_geometric_attenuation_term(C,ctx.mag,ctx.rrup)+_get_style_of_faulting_term(C,ctx)+_get_hanging_wall_term(C,ctx)+_get_shallow_site_response_term(SJ,C,ctx.vs30)+_get_basin_term(C,ctx,None,SJ)+_get_hypocentral_depth_term(C,ctx)+_get_fault_dip_term(C,ctx)+_get_anelastic_attenuation_term(sgn,C,ctx.rrup))
[docs]classBozorgniaCampbell2016(GMPE):""" Implements the BC15 GMPE by Bozorgnia & Campbell (2016) for vertical-component ground motions from the PEER NGA-West2 Project This model follows the same functional form as in CB14 by Campbell & Bozorgnia (2014) with minor modifications to the underlying parameters. Note that this is a more updated version than the GMPE described in the original PEER Report 2013/24. **Reference:** Bozorgnia, Y. & Campbell, K. (2016). Vertical Ground Motion Model for PGA, PGV, and Linear Response Spectra Using the NGA-West2 Database. *Earthquake Spectra*, 32(2), 979-1004. Implements the global model that uses datasets from California, Taiwan, the Middle East, and other similar active tectonic regions to represent a typical or average Q region. Applies the average attenuation case (Dc20=0) """#: Supported tectonic region type is active shallow crustDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Supported intensity measure types are spectral acceleration, peak#: ground velocity and peak ground accelerationDEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGV,SA}#: Supported intensity measure component is the#: :attr:`~openquake.hazardlib.const.IMC.Vertical` direction componentDEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.VERTICAL#: Supported standard deviation types are inter-event, intra-event#: and total; see the section for "Aleatory Variability Model".DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: Required site parameters are Vs30, Vs30 type (measured or inferred),#: and depth (km) to the 2.5 km/s shear wave velocity layer (z2pt5)REQUIRES_SITES_PARAMETERS={'vs30','z2pt5'}#: Required rupture parameters are magnitude, rake, dip, ztor, rupture#: width and hypocentral depthREQUIRES_RUPTURE_PARAMETERS={'mag','rake','dip','ztor','width','hypo_depth'}#: Required distance measures are Rrup, Rjb and RxREQUIRES_DISTANCES={'rrup','rjb','rx'}def__init__(self,SJ=0,sgn=0):self.SJ=SJself.sgn=sgn
[docs]defcompute(self,ctx:np.recarray,imts,mean,sig,tau,phi):""" See :meth:`superclass method <.base.GroundShakingIntensityModel.compute>` for spec of input and result values. """# Extract dictionary of coefficients specific to required IMT and PGAC_PGA=self.COEFFS[PGA()]# Get PGA on given ctxpga=get_mean_values(self.SJ,self.sgn,C_PGA,ctx)form,imtinenumerate(imts):C=self.COEFFS[imt]# Get mean and standard deviations for IMTmean[m]=get_mean_values(self.SJ,self.sgn,C,ctx)ifimt.string[:2]=="SA"andimt.period<0.25:# If Sa (T) < PGA for T < 0.25 then set mean Sa(T) to mean PGAidx=mean[m]<pgamean[m,idx]=pga[idx]# Get standard deviationssig[m],tau[m],phi[m]=_get_stddevs(C,ctx)