Example 13: Impact of strain limit on EQL

Show the impact of the strain limit on the EQL calculation.


In [1]:
import matplotlib.pyplot as plt
import numpy as np

import pysra

%matplotlib inline

In [2]:
# Increased figure sizes
plt.rcParams['figure.dpi'] = 120

Create the inputs


In [3]:
ts = pysra.motion.TimeSeriesMotion.load_at2_file(
    'data/NIS090.AT2', scale=3)
ts.pga


Out[3]:
1.5082470000000001

In [4]:
profile = pysra.site.Profile([
    pysra.site.Layer(
        pysra.site.DarendeliSoilType(
            18., plas_index=30, ocr=1, stress_mean=150),
        15, 150
    ),
    pysra.site.Layer(
        pysra.site.DarendeliSoilType(
            20., plas_index=0, ocr=1, stress_mean=400),
        15, 700
    ),
    pysra.site.Layer(
        pysra.site.SoilType(
            'Rock', 24., None, 0.01
        ),
        0, 1200
    ),
]).auto_discretize()

Create the calculators


In [5]:
calcs = [
    pysra.propagation.EquivalentLinearCalculator(strain_limit=sl)
    for sl in [0.01, 0.02, 0.05]
]

In [6]:
freqs = np.logspace(-1, 2, num=500)

outputs = pysra.output.OutputCollection([
    pysra.output.ResponseSpectrumOutput(
        # Frequency
        freqs,
        # Location of the output
        pysra.output.OutputLocation('outcrop', index=0),
        # Damping
        0.05),
    pysra.output.ResponseSpectrumRatioOutput(
        # Frequency
        freqs,
        # Location in (denominator),
        pysra.output.OutputLocation('outcrop', index=-1),
        # Location out (numerator)
        pysra.output.OutputLocation('outcrop', index=0),
        # Damping
        0.05),
    pysra.output.MaxStrainProfile()
])

Perform calculation


In [7]:
for c in calcs:
    c(ts, profile, profile.location('outcrop', index=-1))
    outputs(c, f'{c.strain_limit:0.2f}')

Plot the results


In [8]:
for o in outputs[:2]:
    fig, ax = plt.subplots()
    for name, refs, values in o.iter_results():
        ax.plot(refs, values, label=name)
    ax.set(xlabel=o.xlabel, xscale='log', ylabel=o.ylabel)
    ax.legend(title='Strain Limit')
    fig.tight_layout();



In [9]:
for o in outputs[2:]:
    fig, ax = plt.subplots()

    for name, refs, values in o.iter_results():
        if name == 'LE':
            # No strain results for LE analyses
            continue
        ax.plot(values, refs, label=name)

    ax.set(xlabel=o.xlabel, xscale='log', ylabel=o.ylabel)
    ax.invert_yaxis()
    ax.legend()
    fig.tight_layout();



In [ ]: