Source code for openquake.hazardlib.gsim.allen_2012_ipe
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2015-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:'AllenEtAl2012', 'AllenEtAl2012Rhypo'"""importnumpyasnpfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportMMIfromopenquake.baselib.generalimportCallableDict_compute_distance_term=CallableDict()@_compute_distance_term.add('rrup')def_compute_distance_term_rrup(kind,C,rrup,mag):""" Returns the distance scaling term """exponent_term=(1.0+C["c3"]*np.exp(mag-5.))**2.returnC["c2"]*np.log(np.sqrt(rrup**2.+exponent_term))@_compute_distance_term.add('rhypo')def_compute_distance_term_rhypo(kind,C,rhypo,mag):""" Returns the distance scaling term """r_m=C["m1"]+C["m2"]*np.exp(mag-5.)f_r=C["c2"]*np.log(np.sqrt(rhypo**2.+r_m**2.))# For distances greater than 50 km an anelastic term is addedidx=rhypo>50.0f_r[idx]+=C["c4"]*np.log(rhypo[idx]/50.)returnf_rdef_compute_magnitude_term(C,mag):""" Returns the magnitude scaling term """returnC["c0"]+C["c1"]*mag
[docs]classAllenEtAl2012(GMPE):""" Implements the Intensity Prediction Equation of Allen, Wald and Worden (2012) for Modified Mercalli Intensity in Active Crustal Regions Allen, T. I., Wald, D. J. and Worden, C. B. (2012) Intensity attenuation in active crustal regions, J. Seismology, 16: 409 - 433 This class implements the version using rupture distance, neglecting site amplification """#: The GMPE is derived from induced earthquakesDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Supported intensity measure types are peak ground acceleration#: and peak ground velocityDEFINED_FOR_INTENSITY_MEASURE_TYPES={MMI}#: Supported intensity measure component is not considered for IPEs, so#: we assume equivalent to 'average horizontal'DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation types is total.DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL}#: No required site parameters (in the present version)REQUIRES_SITES_PARAMETERS=set()#: Required rupture parameters are magnitude (ML is used)REQUIRES_RUPTURE_PARAMETERS={'mag'}#: Required distance measure is rupture distanceREQUIRES_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][dist_type]=self.REQUIRES_DISTANCESdist=getattr(ctx,dist_type)mean[m]=(_compute_magnitude_term(C,ctx.mag)+_compute_distance_term(dist_type,C,dist,ctx.mag))# the total standard deviation, which is a function of distancesig[m]=C["s1"]+C["s2"]/(1.0+(dist/C["s3"])**2.)