Source code for openquake.hazardlib.gsim.rietbrock_2013
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2014-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:`RietbrockEtAl2013SelfSimilar`, :class:`RietbrockEtAl2013MagDependent`"""importnumpyasnp# standard acceleration of gravity in m/s**2fromscipy.constantsimportgfromopenquake.hazardlib.gsim.baseimportCoeffsTable,GMPEfromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,PGV,SACONSTS={"r0":10.0,"r1":50.0,"r2":100.0}def_get_distance_scaling_term(C,rjb,mag):""" Returns the distance scaling component of the model Equation 10, Page 63 """# Depth adjusted distance, equation 11 (Page 63)rval=np.sqrt(rjb**2.0+C["c11"]**2.0)f_0,f_1,f_2=_get_distance_segment_coefficients(rval)return((C["c4"]+C["c5"]*mag)*f_0+(C["c6"]+C["c7"]*mag)*f_1+(C["c8"]+C["c9"]*mag)*f_2+(C["c10"]*rval))def_get_distance_segment_coefficients(rval):""" Returns the coefficients describing the distance attenuation shape for three different distance bins, equations 12a - 12c """# Equation 12af_0=np.log10(CONSTS["r0"]/rval)f_0[rval>CONSTS["r0"]]=0.0# Equation 12bf_1=np.log10(rval)f_1[rval>CONSTS["r1"]]=np.log10(CONSTS["r1"])# Equation 12cf_2=np.log10(rval/CONSTS["r2"])f_2[rval<=CONSTS["r2"]]=0.0returnf_0,f_1,f_2def_get_magnitude_scaling_term(C,mag):""" Returns the magnitude scaling component of the model Equation 10, Page 63 """returnC["c1"]+C["c2"]*mag+C["c3"]*mag**2
[docs]classRietbrockEtAl2013SelfSimilar(GMPE):""" Implements the ground motion prediction equation of Rietbrock et al (2013): Rietbrock, A., Strasser, F., Edwards, B. (2013) A Stochastic Earthquake Ground-Motion Prediction Model for the United Kingdom. Bulletin of the Seismological Society of America, 103(1), 57 -77 The GMPE is derived for the United Kingdom, a low seismicity region. Consequently ground motions are generated via numerical simulations using a stochastic point-source model, calibrated with parameters derived from local weak-motion data. This implementation applies to the case when stress drop is considered to be self-similar (i.e. independent of magnitude). """#: Supported tectonic region type is stabe continental crust,DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.STABLE_CONTINENTAL#: Supported intensity measure types are spectral acceleration, peak#: ground acceleration and peak ground velocity.DEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGV,SA}#: Supported intensity measure component is the geometric mean of two#: horizontal componentsDEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation types are inter-event, intra-event and#: totalDEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT,const.StdDev.TOTAL}#: No site parameter is requiredREQUIRES_SITES_PARAMETERS=set()#: Required rupture parameters are magnitudeREQUIRES_RUPTURE_PARAMETERS={'mag'}#: Required distance measure is RjbREQUIRES_DISTANCES={'rjb'}
[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]imean=(_get_magnitude_scaling_term(C,ctx.mag)+_get_distance_scaling_term(C,ctx.rjb,ctx.mag))# convert from cm/s**2 to g for SA and# from cm/s**2 to g for PGA (PGV is already in cm/s) and# also convert from base 10 to base eifimt.string.startswith(('PGA','SA')):mean[m]=np.log((10.0**(imean-2.0))/g)else:mean[m]=np.log(10**imean)# Original standard deviations are in# logarithms of base 10. Converts to natural logarithm.sig[m]=np.log(10.0**np.sqrt(C["tau"]**2+C["phi"]**2))tau[m]=np.log(10.0**C["tau"])phi[m]=np.log(10.0**C["phi"])