Source code for openquake.hazardlib.gsim.abrahamson_silva_1997
# -*- 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:`AbrahamsonSilva1997` class:`AbrahamsonSilva1997Vertical`."""importnumpyasnpfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,SAdef_compute_mean_on_rock(C,mag,rrup,F,HW):""" Compute mean value on rock (that is eq.1, page 105 with S = 0) """f1=_compute_f1(C,mag,rrup)f3=_compute_f3(C,mag)f4=_compute_f4(C,mag,rrup)returnf1+F*f3+HW*f4def_get_fault_type_hanging_wall(rake):""" Return fault type (F) and hanging wall (HW) flags depending on rake angle. The method assumes 'reverse' (F = 1) if 45 <= rake <= 135, 'other' (F = 0) if otherwise. Hanging-wall flag is set to 1 if 'reverse', and 0 if 'other'. """F,HW=np.zeros_like(rake),np.zeros_like(rake)within=(45<=rake)&(rake<=135)F[within]=1.HW[within]=1.returnF,HWdef_get_site_class(vs30):""" Return site class flag (0 if vs30 > 600, that is rock, or 1 if vs30 < 600, that is deep soil) """S=np.zeros_like(vs30)S[vs30<600]=1returnSdef_compute_f1(C,mag,rrup):""" Compute f1 term (eq.4, page 105) """r=np.sqrt(rrup**2+C['c4']**2)f1=(C['a1']+C['a12']*(8.5-mag)**C['n']+(C['a3']+C['a13']*(mag-C['c1']))*np.log(r))f1[mag<=C['c1']]+=C['a2']*(mag[mag<=C['c1']]-C['c1'])f1[mag>C['c1']]+=C['a4']*(mag[mag>C['c1']]-C['c1'])returnf1def_compute_f3(C,mag):""" Compute f3 term (eq.6, page 106) NOTE: In the original manuscript, for the case 5.8 < mag < c1, the term in the numerator '(mag - 5.8)' is missing, while is present in the software used for creating the verification tables """f3=C['a5']+(C['a6']-C['a5'])*(mag-5.8)/(C['c1']-5.8)f3[mag<=5.8]=C['a5']f3[mag>=C['c1']]=C['a6']returnf3def_compute_f4(C,mag,rrup):""" Compute f4 term (eq. 7, 8, and 9, page 106) """fhw_m=0fhw_r=np.zeros_like(rrup)fhw_m=np.clip(mag-5.5,0.,1.)idx=(rrup>4)&(rrup<=8)fhw_r[idx]=C['a9']*(rrup[idx]-4.)/4.idx=(rrup>8)&(rrup<=18)fhw_r[idx]=C['a9']idx=(rrup>18)&(rrup<=24)fhw_r[idx]=C['a9']*(1-(rrup[idx]-18.)/7.)returnfhw_m*fhw_rdef_compute_f5(C,pga_rock):""" Compute f5 term (non-linear soil response) """returnC['a10']+C['a11']*np.log(pga_rock+C['c5'])
[docs]classAbrahamsonSilva1997(GMPE):""" Implements GMPE developed by N. A. Abrahamson and W. J. Silva and published as "Empirical Response Spectral Attenuation Relations for Shallow Crustal Earthquakes", Seismological Research Letters, v.68, no. 1, p. 94-127, 1997. The GMPE distinguishes between rock (vs30 >= 600) and deep soil (vs30 < 600). The rake angle is also taken into account to distinguish between 'reverse' (45 <= rake < 135) and 'other'. If an earthquake rupture is classified as 'reverse', then the hanging-wall term is included in the mean calculation. """#: Supported tectonic region type is 'active shallow crust' (see#: Introduction, page 94)DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Supported intensity measure types are PGA and SA. PGA is assumed to#: have same coefficients as SA(0.01)DEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,SA}#: Supported intensity measure component is the geometric mean of two#: horizontal components (see paragraph 'Regression Model', page 105)DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation type is Total (see equations 13 pp. 106#: and table 4, page 109).DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL}#: The only site parameter is vs30 used to distinguish between rock#: (vs30 > 600 m/s) and deep soil (see table 2, page 95)REQUIRES_SITES_PARAMETERS={'vs30'}#: Required rupture parameters are magnitude, and rake (eq. 3, page 105).#: Rake is used to distinguish between 'reverse' (45 <= rake <= 135) and#: 'other' (i.e. strike-slip and normal). If an earthquake is classified#: as 'reverse' than the hanging-wall term is taken into account.REQUIRES_RUPTURE_PARAMETERS={'mag','rake'}#: Required distance measure is RRup (eq. 3, page 105).REQUIRES_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. """F,HW=_get_fault_type_hanging_wall(ctx.rake)S=_get_site_class(ctx.vs30)# compute pga on rock (used then to compute site amplification factor)C=self.COEFFS[PGA()]pga_rock=np.exp(_compute_mean_on_rock(C,ctx.mag,ctx.rrup,F,HW))form,imtinenumerate(imts):# compute mean for the given imt (do not repeat the calculation if# imt is PGA, just add the site amplification term)ifimt.period==0:mean[m]=np.log(pga_rock)+S*_compute_f5(C,pga_rock)else:C=self.COEFFS[imt]mean[m]=(_compute_mean_on_rock(C,ctx.mag,ctx.rrup,F,HW)+S*_compute_f5(C,pga_rock))C_STD=self.COEFFS_STD[imt]# standard deviation as defined in eq.13 page 106.sigma=C_STD['b5']-C_STD['b6']*(ctx.mag-5)sigma[ctx.mag<=5.]=C_STD['b5']sigma[ctx.mag>=7.]=C_STD['b5']-2*C_STD['b6']sig[m]+=sigma