Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new parameters to site.py and adding a new gsim #7020

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions debian/changelog
Expand Up @@ -21,6 +21,7 @@
* Fixed a bug in `get_available_gsims`: GSIM aliases were not considered
* Optimized the single site case by splitting the sources less
* Restricted the acceptable methods in GMPE subclasses
>>>>>>> 87bbf3a54686bf2b7ec6310ebad212934a17e70c
Prajakta-Jadhav-25 marked this conversation as resolved.
Show resolved Hide resolved

[Claudia Mascandola]
* Added the Lanzano et al. (2020) GMPE
Expand Down
8 changes: 8 additions & 0 deletions doc/sphinx/openquake.hazardlib.gsim.rst
Expand Up @@ -1162,6 +1162,14 @@ yenier_atkinson_2015
:undoc-members:
:show-inheritance:

youd_etal_2002
-------------------------------------------

.. automodule:: openquake.hazardlib.gsim.youd_etal_2002
:members:
:undoc-members:
:show-inheritance:

youngs_1997
-------------------------------------------

Expand Down
48 changes: 24 additions & 24 deletions openquake/hazardlib/gsim/kuehn_2020_coeffs.csv

Large diffs are not rendered by default.

598 changes: 299 additions & 299 deletions openquake/hazardlib/gsim/lanzano_2019.py

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions openquake/hazardlib/gsim/youd_etal_2002.py
@@ -0,0 +1,131 @@
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2020 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
:mod:`openquake.hazardlib.gsim.youd_etal_2002`
exports
:class:`YoudEtAl2002`
"""
import warnings
import numpy as np

from openquake.hazardlib import const, site
from openquake.hazardlib.imt import PGD
from openquake.hazardlib.gsim.base import GMPE, CoeffsTable


def _compute_magnitude_term(rup, C):
"""
Returns the magnitude scaling term
"""
return C["c0"] + (C["c1"] * rup.mag)


def _compute_distance_term(dists, R, C):
"""
Returns the distance scaling term
"""
return (C["c3"] * dists.repi) + (C["c2"] * np.log10(R))


def _compute_site_term(sites, C):
"""
Returns the distance scaling term
"""
return (C["c4"] * np.log10(sites.slope)) + \
(C["c5"] * np.log10(sites.T_15)) + \
(C["c6"] * np.log10(100 - sites.F_15)) + \
(C["c7"] * np.log10(sites.D50_15 + 0.1))


class YoudEtAl2002(GMPE):
"""
Implements the GMPE of Youd et al. (2002) for calculating Permanent
ground defomation(m) from lateral spread

Youd, T. L., Hansen, C. M., & Bartlett, S. F. (2002). Revised
multilinear regression equations for prediction of lateral spread
displacement. Journal of Geotechnical and Geoenvironmental Engineering,
128(12), 1007-1017.
"""
#: This GMPE is based on non-subduction earthquakes with M<8
DEFINED_FOR_TECTONIC_REGION_TYPE = const.TRT.ACTIVE_SHALLOW_CRUST

#: Supported intensity measure types are Permanent ground deformation (m)
#: from lateral spread
DEFINED_FOR_INTENSITY_MEASURE_TYPES = set([
PGD,
])

#: Supported intensity measure component is the horizontal
DEFINED_FOR_INTENSITY_MEASURE_COMPONENT = const.IMC.HORIZONTAL

#: Supported standard deviation types is total.
DEFINED_FOR_STANDARD_DEVIATION_TYPES = set([
const.StdDev.TOTAL,
])

#: Required site parameters
REQUIRES_SITES_PARAMETERS = {
'slope',
'freeface_ratio',
'T_15',
'F_15',
'D50_15'}

#: Required rupture parameters are magnitude (ML is used)
REQUIRES_RUPTURE_PARAMETERS = {'mag', 'hypo_depth'}

#: Required distance measure is epicentral distance
REQUIRES_DISTANCES = {'repi'}

#: GMPE not tested against independent implementation so raise
#: not verified warning
non_verified = True

def compute(self, ctx, imts, mean, sig, tau, phi):
for m, imt in enumerate(imts):

if ctx.hypo_depth >= 50.0:
ctx.repi.setflags(write=1)
ctx.repi[ctx.repi < 5.0] = 5.0

R = (10 ** ((0.89 * ctx.mag) - 5.64)) + ctx.repi

if ctx.freeface_ratio.all() == 0.0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand what this part of the code does. The freeface ratio is a site-specific coefficient. So depending on the value of this param for each site C and ctx.slope should be defined accordingly. However, with ctx.freeface_ratio.all() you check if all the sites have a value of this parameter == 0 and then apply a correction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Marco,

PFA herewith the response to this query. Let us know, if any modifications further are to be incorporated or if we are missing something.

Thanks,
Explanation for the following lines of the code_sept 12 2021.pdf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Marco,

May we know the next steps to be taken in this pull request.

Thanks,
Prajakta

C = self.COEFFS_SLOPE[imt]
else:
C = self.COEFFS_FREEFACE[imt]
ctx.slope = ctx.freeface_ratio

mean[m] = (
_compute_magnitude_term(ctx, C) +
_compute_distance_term(ctx, R, C) +
_compute_site_term(ctx, C))
mean[m] = np.log(10.0 ** mean[m])
sig[m] = np.log(10.0 ** C["sigma"])

COEFFS_SLOPE = CoeffsTable(table="""\
IMT c0 c1 c2 c3 c4 c5 c6 c7 sigma
PGD -16.213 1.532 -1.406 -0.012 0.338 0.54 3.413 -0.795 0.464
""")
COEFFS_FREEFACE = CoeffsTable(table="""\
IMT c0 c1 c2 c3 c4 c5 c6 c7 sigma
PGD -16.713 1.532 -1.406 -0.012 0.592 0.54 3.413 -0.795 0.464
""")
7 changes: 6 additions & 1 deletion openquake/hazardlib/site.py
Expand Up @@ -162,7 +162,12 @@ def _extract(array_or_float, indices):
'hwater': numpy.float64,
'precip': numpy.float64,
'fpeak': numpy.float64,

'freeface_ratio': numpy.float64,
'T_15': numpy.float64,
'D50_15': numpy.float64,
'F_15': numpy.float64,
'T_eq': numpy.float64,

# other parameters
'custom_site_id': numpy.uint32,
'region': numpy.uint32
Expand Down