Source code for openquake.hazardlib.gsim.atkinson_boore_2006
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2012-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:`BooreAtkinson2008`,:class:`AtkinsonBoore2006`,:class:`AtkinsonBoore2006Modified2011`.:class:`AtkinsonBoore2006SGS`."""importnumpyasnpfromscipy.constantsimportgfrommathimportlog10fromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTable,add_aliasfromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,PGV,SAfromopenquake.hazardlib.gsim.utilsimport(mblg_to_mw_atkinson_boore_87,mblg_to_mw_johnston_96,clip_mean,get_fault_type_dummy_variables)#: IMT-independent coefficients. std_total is the total standard deviation,#: see Table 6, pag 2192 and Table 9, pag 2202. R0, R1, R2 are coefficients#: required for mean calculation - see equation (5) pag 2191. v1, v2, Vref#: are coefficients required for soil response calculation, see table 8,#: p. 2201# the std is converted from base 10 to base estd_total=np.log(10**0.30),R0=10.0R1=70.0R2=140.0# v1 = 180.0# v2 = 300.0# Vref = 760.0def_clip_distances(rrup):""" Return array of distances with values clipped to 1. See end of paragraph 'Methodology and Model Parameters', p. 2182. The equations have a singularity for distance = 0, so that's why distances are clipped to 1. """rrup=rrup.copy()rrup[rrup<1]=1returnrrupdef_compute_distance_scaling(ctx,C):""" Compute distance-scaling term, equations (3) and (4), pag 107. """Mref=4.5Rref=1.0R=np.sqrt(ctx.rjb**2+C['h']**2)return(C['c1']+C['c2']*(ctx.mag-Mref))*np.log(R/Rref)+ \
C['c3']*(R-Rref)def_compute_f0_factor(rrup):""" Compute and return factor f0 - see equation (5), 6th term, p. 2191. """f0=np.log10(R0/rrup)f0[f0<0]=0.0returnf0def_compute_f1_factor(rrup):""" Compute and return factor f1 - see equation (5), 4th term, p. 2191 """f1=np.log10(rrup)logR1=np.log10(R1)f1[f1>logR1]=logR1returnf1def_compute_f2_factor(rrup):""" Compute and return factor f2, see equation (5), 5th term, pag 2191 """f2=np.log10(rrup/R2)f2[f2<0]=0.0returnf2def_compute_magnitude_scaling(ctx,C):""" Compute magnitude-scaling term, equations (5a) and (5b), pag 107. """return_compute_ms(ctx,C)def_compute_mean(C,f0,f1,f2,SC,mag,rrup,idxs,mean,scale_fac):""" Compute mean value (for a set of indexes) without site amplification terms. This is equation (5), p. 2191, without S term. """ifidxs.sum()==0:# no effectreturnifisinstance(scale_fac,np.ndarray):scale_fac=scale_fac[idxs]mag=mag[idxs]sda=_compute_stress_drop_adjustment(SC,mag,scale_fac)mean[idxs]=(C['c1']+C['c2']*mag+C['c3']*(mag**2)+(C['c4']+C['c5']*mag)*f1[idxs]+(C['c6']+C['c7']*mag)*f2[idxs]+(C['c8']+C['c9']*mag)*f0[idxs]+C['c10']*rrup[idxs]+sda)def_compute_ms(ctx,C):SS,NS,RS=get_fault_type_dummy_variables(ctx)res=C['e2']*SS+C['e3']*NS+C['e4']*RS+C['e7']*(ctx.mag-C['Mh'])less=ctx.mag<=C['Mh']res[less]=(C['e2']*SS[less]+C['e3']*NS[less]+C['e4']*RS[less]+C['e5']*(ctx.mag[less]-C['Mh'])+C['e6']*(ctx.mag[less]-C['Mh'])**2)returnresdef_compute_non_linear_slope(vs30,C):""" Compute non-linear slope factor, equations (13a) to (13d), pag 108-109. """V1=180.0V2=300.0Vref=760.0# equation (13d), values are zero for vs30 >= Vref = 760.0bnl=np.zeros(vs30.shape)# equation (13a)bnl[vs30<=V1]=C['b1']# equation (13b)idx=np.where((vs30>V1)&(vs30<=V2))bnl[idx]=(C['b1']-C['b2'])* \
np.log(vs30[idx]/V2)/np.log(V1/V2)+C['b2']# equation (13c)idx=np.where((vs30>V2)&(vs30<Vref))bnl[idx]=C['b2']*np.log(vs30[idx]/Vref)/np.log(V2/Vref)returnbnldef_compute_non_linear_term(pga4nl,bnl):""" Compute non-linear term, equation (8a) to (8c), pag 108. """fnl=np.zeros(pga4nl.shape)iflen(bnl)<len(fnl):# single site case, fix shapebnl=np.repeat(bnl,len(fnl))a1=0.03a2=0.09pga_low=0.06# equation (8a)idx=pga4nl<=a1fnl[idx]=bnl[idx]*np.log(pga_low/0.1)# equation (8b)idx=np.where((pga4nl>a1)&(pga4nl<=a2))delta_x=np.log(a2/a1)delta_y=bnl[idx]*np.log(a2/pga_low)c=(3*delta_y-bnl[idx]*delta_x)/delta_x**2d=-(2*delta_y-bnl[idx]*delta_x)/delta_x**3fnl[idx]=bnl[idx]*np.log(pga_low/0.1)+\
c*(np.log(pga4nl[idx]/a1)**2)+ \
d*(np.log(pga4nl[idx]/a1)**3)# equation (8c)idx=pga4nl>a2fnl[idx]=np.squeeze(bnl[idx])*np.log(pga4nl[idx]/0.1)returnfnldef_compute_soil_amplification(C,vs30,pga_bc,mean):""" Compute soil amplification, that is S term in equation (5), p. 2191, and add to mean values for non hard rock sites. """# convert from base e (as defined in BA2008) to base 10 (as used in# AB2006)sal=np.log10(np.exp(_get_site_amplification_linear(vs30,C)))sanl=np.log10(np.exp(_get_site_amplification_non_linear(vs30,pga_bc,C)))idxs=vs30<2000.0mean[idxs]=mean[idxs]+sal[idxs]+sanl[idxs]def_compute_stress_drop_adjustment(SC,mag,scale_fac):""" Compute equation (6) p. 2200 """clipped_mag=np.clip(mag-SC['M1'],0,None)returnscale_fac*np.clip(0.05+SC['delta']*clipped_mag/(SC['Mh']-SC['M1']),None,SC['delta']+0.05)def_convert_magnitude(mag_eq,mag):""" Convert magnitude from Mblg to Mw using various equations equation """ifmag_eq=='Mblg87':returnmblg_to_mw_atkinson_boore_87(mag)elifmag_eq=='Mblg96':returnmblg_to_mw_johnston_96(mag)elifmag_eq=='Mw':returnmagdef_extract_coeffs(self,imt):""" Extract dictionaries of coefficients specific to required intensity measure type. """C_HR=self.COEFFS_HARD_ROCK[imt]C_BC=self.COEFFS_BC[imt]C_SR=self.COEFFS_SOIL_RESPONSE[imt]SC=self.COEFFS_STRESS[imt]returnC_HR,C_BC,C_SR,SCdef_get_mean(self,vs30,mag,rrup,imt,scale_fac):""" Compute and return mean """C_HR,C_BC,C_SR,SC=_extract_coeffs(self,imt)rrup=_clip_distances(rrup)f0=_compute_f0_factor(rrup)f1=_compute_f1_factor(rrup)f2=_compute_f2_factor(rrup)pga_bc=_get_pga_bc(self.COEFFS_BC[PGA()],f0,f1,f2,SC,mag,rrup,vs30,scale_fac)# compute mean values for hard-rock sites (vs30 >= 2000),# and non-hard-rock sites (vs30 < 2000) and add soil amplification# termmean=np.zeros_like(vs30)_compute_mean(C_HR,f0,f1,f2,SC,mag,rrup,vs30>=2000.0,mean,scale_fac)_compute_mean(C_BC,f0,f1,f2,SC,mag,rrup,vs30<2000.0,mean,scale_fac)_compute_soil_amplification(C_SR,vs30,pga_bc,mean)# convert from base 10 to base eifimt==PGV():mean=np.log(10**mean)else:# convert from cm/s**2 to gmean=np.log((10**mean)*1e-2/g)returnmeandef_get_pga_bc(C_pga_bc,f0,f1,f2,SC,mag,rrup,vs30,scale_fac):""" Compute and return PGA on BC boundary """pga_bc=np.zeros_like(vs30)_compute_mean(C_pga_bc,f0,f1,f2,SC,mag,rrup,vs30<2000.0,pga_bc,scale_fac)return(10**pga_bc)*1e-2/gdef_get_pga_on_rock(C_pga,ctx):""" Compute and return PGA on rock conditions (that is vs30 = 760.0 m/s). This is needed to compute non-linear site amplification term """# Median PGA in g for Vref = 760.0, without site amplification,# that is equation (1) pag 106, without the third and fourth terms# Mref and Rref values are given in the caption to table 6, pag 119# Note that in the original paper, the caption reads:# "Distance-scaling coefficients (Mref=4.5 and Rref=1.0 km for all# periods, except Rref=5.0 km for pga4nl)". However this is a mistake# as reported in http://www.daveboore.com/pubs_online.php:# ERRATUM: 27 August 2008. Tom Blake pointed out that the caption to# Table 6 should read "Distance-scaling coefficients (Mref=4.5 and# Rref=1.0 km for all periods)".pga4nl=np.exp(_compute_magnitude_scaling(ctx,C_pga)+_compute_distance_scaling(ctx,C_pga))returnpga4nldef_get_site_amplification_linear(vs30,C):""" Compute site amplification linear term, equation (7), pag 107. """returnC['blin']*np.log(vs30/760.0)def_get_site_amplification_non_linear(vs30,pga4nl,C):""" Compute site amplification non-linear term, equations (8a) to (13d), pag 108-109. """# non linear slopebnl=_compute_non_linear_slope(vs30,C)# compute the actual non-linear termreturn_compute_non_linear_term(pga4nl,bnl)
[docs]defset_sig(kind,C,sig,tau,phi):""" Set standard deviations as defined in table 8, pag 121. """ifkind=='hawaii':# Using a frequency independent value of sigma as recommended# in the caption of Table 2 of Atkinson (2010)sig[:]=0.26/np.log10(np.e)elifkind=='2006':sig[:]=std_totalelse:sig[:]=C['std']tau[:]=C['tau']phi[:]=C['sigma']
def_get_stress_drop_scaling_factor(magnitude):""" Returns the magnitude dependent stress drop scaling factor defined in equation 6 (page 1128) of Atkinson & Boore (2011) """stress_drop=10.0**(3.45-0.2*magnitude)cap=10.0**(3.45-0.2*5.0)stress_drop[stress_drop>cap]=capreturnnp.log10(stress_drop/140.0)/log10(2.0)
[docs]classAtkinsonBoore2006(GMPE):""" Implements GMPE developed by Gail M. Atkinson and David M. Boore and published as "Earthquake Ground-Motion Prediction Equations for Eastern North America" (2006, Bulletin of the Seismological Society of America, Volume 96, No. 6, pages 2181-2205). This class implements only the equations for stress parameter of 140 bars. The correction described in 'Adjustment of Equations to Consider Alternative Stress Parameters', p. 2198, is not implemented. This class uses the same soil amplification function as the BooreAtkinson2008. Note that in the paper, the reported soil amplification function is the one used in a preliminary version of the Boore and Atkinson 2008 GMPE, while the one that should be used is the one described in the final paper. See comment in: http://www.daveboore.com/pubs_online/ab06_gmpes_programs_and_tables.pdf """#: Supported tectonic region type is stable continental, given#: that the equations have been derived for Eastern North AmericaDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.STABLE_CONTINENTAL#: Supported intensity measure types are spectral acceleration,#: peak ground velocity and peak ground acceleration, see paragraph#: 'Methodology and Model Parameters', p. 2182DEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGV,SA}#: Supported intensity measure component is horizontal#: :attr:`~openquake.hazardlib.const.IMC.GEOMETRIC_MEAN`,#: personal communication with Gail AtkinsonDEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation type is total, see table 6#: and 9, p. 2192 and 2202, respectively.DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL}#: Required site parameters is Vs30.#: See paragraph 'Equations for soil sites', p. 2200REQUIRES_SITES_PARAMETERS={'vs30'}#: Required rupture parameter is magnitude (see#: paragraph 'Methodology and Model Parameters', p. 2182)REQUIRES_RUPTURE_PARAMETERS={'mag'}#: Required distance measure is Rrup.#: See paragraph 'Methodology and Model Parameters', p. 2182REQUIRES_DISTANCES={'rrup'}REQUIRES_ATTRIBUTES={'mag_eq','scale_fac'}CUTOFF_RRUP=0.kind='2006'def__init__(self,mag_eq="NA",scale_fac=0):assertmag_eqin"Mblg87 Mblg96 Mw NA",mag_eqself.mag_eq=mag_eqself.scale_fac=scale_fac# used in the "Modified" version
[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. """ifself.CUTOFF_RRUP:# for SGS subclassctx=ctx.copy()ctx.rrup[ctx.rrup<=self.CUTOFF_RRUP]=self.CUTOFF_RRUPform,imtinenumerate(imts):ifself.mag_eq=="NA":if'Modified'inself.__class__.__name__:# stress drop scaling factor is now a property of magnitudescale_fac=_get_stress_drop_scaling_factor(ctx.mag)else:scale_fac=0mean[m]=_get_mean(self,ctx.vs30,ctx.mag,ctx.rrup,imt,scale_fac=scale_fac)set_sig(self.kind,None,sig[m],tau[m],phi[m])else:mag=_convert_magnitude(self.mag_eq,ctx.mag)# stress drop scaling factor defined in subroutine getAB06mean[m]=_get_mean(self,ctx.vs30,mag,ctx.rrup,imt,scale_fac=self.scale_fac)mean[m]=clip_mean(imt,mean[m])set_sig(self.kind,None,sig[m],tau[m],phi[m])
[docs]classAtkinsonBoore2006Modified2011(AtkinsonBoore2006):""" This GMPE modifies the original implementation of :class: `AtkinsonBoore2006` with the magnitude dependent stress-drop scaling factor proposed in Atkinson & Boore (2011) Atkinson, G. A. and Boore D. M. (2011) Modifications to Existing Ground-Motion Prediciton Equations in Light of New Data. Bulletin of the Seismological Society of America, 101(3), 1121 - 1135 """
[docs]classAtkinsonBoore2006SGS(AtkinsonBoore2006):""" This class extends the original base class :class:`openquake.hazardlib.gsim.atkinson_boore_2006.AtkinsonBoore2006` by introducing a distance filter for the near field, as implemented by SGS for the national PSHA model for Saudi Arabia. """CUTOFF_RRUP=5.