Source code for openquake.hazardlib.gsim.afshari_stewart_2016
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2013-2023 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:`AfshariStewart2016`, :class:`AfshariStewart2016Japan`"""importnumpyasnpfromopenquake.baselib.generalimportCallableDictfromopenquake.hazardlib.gsim.baseimportCoeffsTable,GMPEfromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportRSD595,RSD575,RSD2080CONSTANTS={"mstar":6.0,"r1":10.0,"r2":50.0,"v1":600.0,"dz1ref":200.0}_get_lnmu_z1=CallableDict()@_get_lnmu_z1.add("CAL")def_get_lnmu_z1_1(region,vs30):""" Returns the z1.0 normalisation term for California (equation 11) """return(-7.15/4.)*np.log((vs30**4.+570.94**4)/(1360.0**4.+570.94**4.))-\
np.log(1000.0)@_get_lnmu_z1.add("JPN")def_get_lnmu_z1_2(region,vs30):""" Returns the z1.0 normalisation term for Japan (equation 12) """return(-5.23/2.)*np.log((vs30**2.+412.39**2)/(1360.0**2.+412.39**2.))-\
np.log(1000.0)def_get_phi(C,mag):""" Returns the magnitude dependent intra-event standard deviation (phi) (equation 15) """phi=C["phi1"]+(C["phi2"]-C["phi1"])*((mag-5.5)/0.25)phi[mag<5.5]=C["phi1"]phi[mag>=5.75]=C["phi2"]returnphidef_get_sof_terms(C,rake):""" Returns the style-of-faulting scaling parameters """# Strike-slip faultingb0=np.full_like(rake,C["b0SS"])b1=np.full_like(rake,C["b1SS"])# Reverse faultingrev=(rake>=45.)&(rake<=135.)b0[rev]=C["b0R"]b1[rev]=C["b1R"]# Normal faultingnor=(rake<=-45.)&(rake>=-135.)b0[nor]=C["b0N"]b1[nor]=C["b1N"]returnb0,b1def_get_tau(C,mag):""" Returns magnitude dependent inter-event standard deviation (tau) (equation 14) """tau=C["tau1"]+(C["tau2"]-C["tau1"])*((mag-6.5)/0.5)tau[mag<6.5]=C["tau1"]tau[mag>=7.]=C["tau2"]returntau
[docs]defget_distance_term(C,rrup):""" Returns the distance scaling term in equation 7 """f_p=C["c1"]*rrupidx=np.logical_and(rrup>CONSTANTS["r1"],rrup<=CONSTANTS["r2"])f_p[idx]=(C["c1"]*CONSTANTS["r1"])+\
C["c2"]*(rrup[idx]-CONSTANTS["r1"])idx=rrup>CONSTANTS["r2"]f_p[idx]=C["c1"]*CONSTANTS["r1"]+\
C["c2"]*(CONSTANTS["r2"]-CONSTANTS["r1"])+\
C["c3"]*(rrup[idx]-CONSTANTS["r2"])returnf_p
[docs]defget_magnitude_term(C,ctx):""" Returns the magnitude scaling term in equation 3 """b0,b1=_get_sof_terms(C,ctx.rake)# Calculate moment (equation 5)m_0=10.0**(1.5*ctx.mag+16.05)# Get stress-drop scaling (equation 6)idx1=ctx.mag>C["m2"]b1[idx1]+=(C["b2"]*(C["m2"]-CONSTANTS["mstar"])+(C["b3"]*(ctx.mag[idx1]-C["m2"])))idx2=ctx.mag<=C["m2"]b1[idx2]+=C["b2"]*(ctx.mag[idx2]-CONSTANTS["mstar"])stress_drop=np.exp(b1)# Get corner frequency (equation 4)f0=4.9*1.0E6*3.2*(stress_drop/m_0)**(1./3.)term=1./f0term[ctx.mag<=C["m1"]]=b0[ctx.mag<=C["m1"]]returnterm
[docs]defget_site_amplification(region,C,ctx):""" Returns the site amplification term """# Gets delta normalised z1dz1=ctx.z1pt0-np.exp(_get_lnmu_z1(region,ctx.vs30))f_s=C["c5"]*dz1# Calculates site amplification termf_s[dz1>CONSTANTS["dz1ref"]]=(C["c5"]*CONSTANTS["dz1ref"])idx=ctx.vs30>CONSTANTS["v1"]f_s[idx]+=(C["c4"]*np.log(CONSTANTS["v1"]/C["vref"]))idx=np.logical_not(idx)f_s[idx]+=(C["c4"]*np.log(ctx.vs30[idx]/C["vref"]))returnf_s
[docs]defget_stddevs(C,mag):""" Returns the standard deviations """tau=_get_tau(C,mag)phi=_get_phi(C,mag)return[np.sqrt(tau**2.+phi**2.),tau,phi]
[docs]classAfshariStewart2016(GMPE):""" Implements the GMPE of Afshari & Stewart (2016) for relative significant duration for 5 - 75 %, 5 - 95 % and 20 - 80 % Arias Intensity. Afshari, K. and Stewart, J. P. (2016) "Physically Parameterized Prediction Equations for Signficant Duration in Active Crustal Regions", Earthquake Spectra, 32(4), 2057 - 2081 """region="CAL"#: Supported tectonic region type is active shallow crustDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Supported intensity measure types are 5 - 95 % Arias and 5 - 75 % Arias#: significant durationDEFINED_FOR_INTENSITY_MEASURE_TYPES={RSD595,RSD575,RSD2080}#: Supported intensity measure component is the geometric mean horizontal#: componentDEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation type is only total, see table 7, page 35DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: Requires vs30REQUIRES_SITES_PARAMETERS={'vs30','z1pt0'}#: Required rupture parameters are magnitude and top of rupture depthREQUIRES_RUPTURE_PARAMETERS={'mag','rake'}#: Required distance measure is closest distance to ruptureREQUIRES_DISTANCES={'rrup'}
[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. """form,imtinenumerate(imts):C=self.COEFFS[imt]mean[m]=(np.log(get_magnitude_term(C,ctx)+get_distance_term(C,ctx.rrup))+get_site_amplification(self.region,C,ctx))sig[m],tau[m],phi[m]=get_stddevs(C,ctx.mag)
[docs]classAfshariStewart2016Japan(AfshariStewart2016):""" Adaption of the Afshari & Stewart (2016) GMPE for relative significant duration for the case when the Japan basin model is preferred """region="JPN"