# -*- 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:`SiEtAl2020SInter` :class:`SiEtAl2020SSlab`"""importnumpyasnpfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,PGV,SA
[docs]defget_base_term(trt,C):""" Returns the constant term of the GMM. Depends on tectonic type """returnC["e"]+(C["d0"]iftrt==const.TRT.SUBDUCTION_INTERFACEelseC["d1"])
[docs]defget_magnitude_scaling_term(C,imt,mag):""" Returns the magnitude scaling term (Equation 3.16) """ifimt.stringin("PGA","PGV"):m_ref=8.3else:ifimt.period<2.0:m_ref=8.3else:m_ref=7.5fmag=np.where(mag<m_ref,C["a1"]*mag,C["a1"]*mag+(C["a2"]-C["a1"])*(mag-m_ref))returnfmag
[docs]defget_depth_scaling_term(C,hypo_depth):""" Returns the depth scaling term (Eqation 3.16) """returnC["h"]*hypo_depth
[docs]defget_anelastic_attenuation_term(C,rrup):""" Returns the anelastic attenuation term (Eq. 3.15) The period dependent coefficients are calculated and added to the coefficients table. """returnC["c_attn"]*rrup
[docs]defget_moho_depth(ctx):""" get Moho depth dependent on hypocenter location for now, return 30km everywhere """return30.0
[docs]defget_geometric_attenuation_term(C,ctx):""" Returns the geometric attenuation term (Eq. 3.13/3.14) Period dependent coefficients are calculated and added to the coefficients table. """mref=np.where(ctx.mag<8.3,ctx.mag,8.3)c=C["c_gs"]*10.0**(0.5*mref)zmoho=get_moho_depth(ctx)fgs=-1.0*np.log10(ctx.rrup+c)idx=(ctx.hypo_depth>zmoho)&(ctx.rrup>=(1.7*ctx.hypo_depth))fgs[idx]=(0.6*np.log10(1.7*ctx.hypo_depth[idx]+c[idx])-1.6*np.log10(ctx.rrup[idx]+c[idx]))returnfgs
[docs]defget_shallow_site_response_term(C,vs30,pga760):""" Returns the shallow site response term (Eq. 3.2 tp 3.4) """vs30_comp=np.clip(vs30,-np.inf,760.0)# Nonlinear site scaling termf2=0.5*C["f4"]*(np.exp(C["f5"]*(vs30_comp-360.0))-np.exp(C["f5"]*(760.0-360.0)))# Linear site termf_site_lin=np.where(vs30<=C["Vc"],C["c"]*np.log(vs30/C["Vref"]),C["c"]*np.log(C["Vc"]/C["Vref"]))f_site_nl=np.full_like(vs30,C["f1"])idx=f2!=0f_site_nl[idx]=f_site_nl[idx]+f2[idx]*np.log((pga760[idx]+C["f3"])/C["f3"])return(f_site_lin+f_site_nl)/np.log(10.0)
def_get_basin_term(C,ctx,region=None):""" Returns the basin response term (Eq. 3.10) """returnC["Cd"]+C["Dd"]*ctx.z2pt5def_get_pga_rock(C,trt,imt,ctx):""" Returns the PGA on rock for site response """mean=(get_base_term(trt,C)+get_magnitude_scaling_term(C,imt,ctx.mag)+get_geometric_attenuation_term(C,ctx)+_get_basin_term(C,ctx)+get_depth_scaling_term(C,ctx.hypo_depth)+get_anelastic_attenuation_term(C,ctx.rrup))return10.0**mean
[docs]defget_mean_values(C,trt,imt,ctx,a760):""" Returns the mean values for a specific IMT """mean=np.log(10.0)*(get_base_term(trt,C)+get_magnitude_scaling_term(C,imt,ctx.mag)+get_depth_scaling_term(C,ctx.hypo_depth)+get_geometric_attenuation_term(C,ctx)+get_anelastic_attenuation_term(C,ctx.rrup)+_get_basin_term(C,ctx)+get_shallow_site_response_term(C,ctx.vs30,a760))returnmean
[docs]classSiEtAl2020SInter(GMPE):""" Implements NGA Subduction model of Si, Midorikawa, Kishida (2020) for interface events Si H, Midorikawa S, Kishida T (2020) "Development of NGA-Sub Ground-Motion Model of 5%-Damped Psuedo-Spectral Acceleration Based on Database for Subduction Earthquakes in Japan" PEER Report No. 2020/06 Implementation is based on preliminary PEER report and R implementation obtained from T. Kishida on 09/16/2020 """#: Supported tectonic region type is subduction interfaceDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.SUBDUCTION_INTERFACE#: Supported intensity measure types are spectral acceleration,#: and peak ground accelerationDEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGV,SA}#: Supported intensity measure component is orientation-independent#: average horizontal :attr:`~openquake.hazardlib.const.IMC.GMRotI50`DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.RotD50#: Supported standard deviation types are inter-event, intra-event#: and total, see section "Aleatory Variability Model", page 1094.DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: Required site parameters are Vs30 and Z2.5REQUIRES_SITES_PARAMETERS={'vs30','z2pt5'}#: Required rupture parameters are magnitude and hypocentral dephREQUIRES_RUPTURE_PARAMETERS={'mag','hypo_depth'}#: Required distance measure is RrupREQUIRES_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. """trt=self.DEFINED_FOR_TECTONIC_REGION_TYPE# extract dictionaries of coefficients specific to PGA# intensity measure type and for PGAC_PGA=self.COEFFS[PGA()]# Get mean PGA on rock (Vs30 760 m/s)pga760=_get_pga_rock(C_PGA,trt,PGA(),ctx)form,imtinenumerate(imts):# Get the coefficients for the IMTC=self.COEFFS[imt]# Get mean and standard deviations for IMTmean[m]=get_mean_values(C,trt,imt,ctx,pga760)tau[m]=C["tau"]phi[m]=C["phi"]sig[:]=np.sqrt(tau**2.0+phi**2.0)
[docs]classSiEtAl2020SSlab(SiEtAl2020SInter):""" Implements NGA Subduction model of Si, Midorikawa, Kishida (2020) For Intraslab events. """#: Supported tectonic region type is subduction interfaceDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.SUBDUCTION_INTRASLAB