def test_iter_variations(): m = motion.SourceTheoryRvtMotion(6.0, 30, 'wna') m.calc_fourier_amps() profile = site.Profile([ site.Layer( site.DarendeliSoilType(18., plas_index=0, ocr=1, stress_mean=200), 10, 400), site.Layer( site.DarendeliSoilType(18., plas_index=0, ocr=1, stress_mean=200), 20, 600), site.Layer(site.SoilType('Rock', 24., None, 0.01), 0, 1200), ]) calc = propagation.EquivalentLinearCalculator() var_thickness = variation.ToroThicknessVariation() var_velocity = variation.ToroVelocityVariation.generic_model('USGS C') var_soiltypes = variation.SpidVariation(-0.5, std_mod_reduc=0.15, std_damping=0.0030) freqs = np.logspace(-1, 2, num=500) outputs = output.OutputCollection( output.ResponseSpectrumOutput( # Frequency freqs, # Location of the output output.OutputLocation('outcrop', index=0), # Damping 0.05), output.ResponseSpectrumRatioOutput( # Frequency freqs, # Location in (denominator), output.OutputLocation('outcrop', index=-1), # Location out (numerator) output.OutputLocation('outcrop', index=0), # Damping 0.05), ) for profile in variation.iter_varied_profiles(profile, 3, var_thickness=var_thickness, var_velocity=var_velocity, var_soiltypes=var_soiltypes): calc(m, profile, profile.location('outcrop', index=-1)) outputs(calc)
def soil_type_darendeli(): """Create an example DarendeliSoilType.""" stress_mean = 0.25 / site.KPA_TO_ATM return site.DarendeliSoilType( plas_index=30, ocr=1.0, stress_mean=stress_mean, freq=1, num_cycles=10, strains=[1E-7, 2.2E-5, 1E-2], )
def setup_class(cls): cls.st = site.DarendeliSoilType( unit_wt=16, plas_index=0, ocr=1, stress_mean=1 / site.KPA_TO_ATM, freq=1, num_cycles=10, strains=[1e-7, 2.2e-5, 1e-2], ) cls.dvar = variation.DarendeliVariation( -0.7, limits_mod_reduc=[-np.inf, np.inf], limits_damping=[-np.inf, np.inf] ) n = 1000 realizations = [cls.dvar(cls.st) for _ in range(n)] cls.mod_reducs = np.array([r.mod_reduc.values for r in realizations]) cls.dampings = np.array([r.damping.values for r in realizations])