Пример #1
0
def test_bray_and_macedo_settlement():
    # Load ground motion
    fpath = TEST_DATA_DIR + "input_acc.his"
    acc_file = np.loadtxt(fpath, skiprows=4)
    acc = acc_file[:, 1]
    acc = acc / 9.81

    time = acc_file[:, 0]
    dt = time[1] - time[0]

    models = sfsi_files.load_json(TEST_DATA_DIR + "test_ecp_models.json")
    soil_profile = models["soil_profiles"][0]
    building = models["buildings"][0]

    q_f = 80000

    # building.mass_eff = 10000 * length  # kg
    building.mass_ratio = 1.
    fd = models["foundations"][0]
    # fd = gm.create_foundation(length=length, width=foundations.width, depth=foundations.depth)

    zliq = soil_profile.layer_depth(2) - soil_profile.layer_depth(1)
    sett_dyn_bray = lqs.bray_and_macedo_settlement(
        acc=acc,
        dt=dt,
        z_liq=zliq,
        q=(float(building.mass_eff) / 1000),
        fd=fd,
        soil_profile=soil_profile,
    )
    assert ct.isclose(sett_dyn_bray, 70.537,
                      rel_tol=0.001)  # 70.537 Not validated, liquepy 0.1.0
Пример #2
0
def test_bray_and_macedo_settlement():
    # Load ground motion
    fpath = TEST_DATA_DIR + "input_acc.his"
    acc_file = np.loadtxt(fpath, skiprows=4)
    acc = acc_file[:, 1]
    time = acc_file[:, 0]
    dt = time[1] - time[0]
    asig = eqsig.AccSignal(acc, dt)

    models = sfsi_files.load_json(TEST_DATA_DIR + "test_ecp_models.json")
    soil_profile = models["soil_profiles"][0]
    building = models["buildings"][0]
    building.mass_ratio = 1.
    fd = models["foundations"][0]
    fd.vertical_load = building.mass_eff * 9.8
    q_c1ncs = 106
    soil_profile.layer(2).q_c1ncs = q_c1ncs
    asig.magnitude = 6.6

    liq_layers = [2]
    sett_dyn_bray = lqs.bray_and_macedo_settlement_time_series(
        soil_profile, fd, asig, liq_layers)[-1]
    assert np.isclose(
        sett_dyn_bray, 0.077205675,
        rtol=0.001), sett_dyn_bray  # 0.077205675 Not validated, liquepy 0.5.5+
Пример #3
0
def test_load_json():
    fp = test_dir + "/unit_test_data/ecp_models.json"
    objs = files.load_json(fp, verbose=0)
    assert np.isclose(objs["soils"][1].unit_dry_weight, 15564.70588)
    assert np.isclose(objs["foundations"][1].length, 1.0)
    assert np.isclose(objs["soil_profiles"][1].layers[0].unit_dry_weight,
                      15564.70588)
    rel_density = objs["soil_profiles"][1].layer(2).relative_density
    assert np.isclose(objs["soil_profiles"][1].layer(2).relative_density,
                      0.7299999994277497), rel_density
Пример #4
0
def test_can_compute_layer_depth():
    test_dir = os.path.dirname(__file__)
    fp = test_dir + "/unit_test_data/ecp_models.json"
    objs = files.load_json(fp)
    soil_profile = objs["soil_profiles"][1]
    assert isinstance(soil_profile, models.SoilProfile)

    assert np.isclose(soil_profile.layers[0].unit_dry_weight, 15564.70588)
    rel_density = soil_profile.layer(2).relative_density
    assert np.isclose(rel_density, 0.7299999994277497), rel_density
    assert soil_profile.layer(1).id == 1
    assert soil_profile.get_layer_depth(2) == 4.0
    assert soil_profile.get_layer_height(2) == 4.0
    assert soil_profile.get_layer_mid_depth(2) == 6.0
Пример #5
0
def test_load_old_file_w_frame_w_hinges():
    # Define special class for section
    class CustomBeamSection(sfsimodels.models.sections.Section):
        diametertop = None
        fylong = None
        filongtop = None

        def __init__(self):
            super(CustomBeamSection, self).__init__()
            self._extra_class_variables = [
                "diametertop", "fylong", "filongtop", "myplus_section"
            ]
            self.inputs += self._extra_class_variables

    # Attach the section class as the default for the building
    class CustomBuildingFrame2D(sm.FrameBuilding2D):
        _custom_beam_section = CustomBeamSection
        _custom_column_section = None

    fp = test_dir + "/unit_test_data/building_1011_ecp_old.json"

    # Override the base_type-type for building-building_frame2D with the custom model
    objs = files.load_json(
        fp,
        verbose=0,
        custom={"building-building_frame2D": CustomBuildingFrame2D})
    bd = objs["building"][1]
    assert np.isclose(bd.floor_length, 13.05)
    assert np.isclose(bd.beams[0][0].s[0].myplus_section, 97.03)
    assert np.isclose(bd.beams[1][1].s[0].myplus_section,
                      127.85), bd.beams[1][1].s[0].myplus_section
    assert bd.beams[1][0].s[0].diametertop is None
    assert np.isclose(bd.columns[1][0].s[0].nbar_hplusx, 2)
    assert "diametertop" in bd.beams[0][0].s[0].inputs
    ecp_output = files.Output()
    ecp_output.add_to_dict(bd)
    p_str = json.dumps(ecp_output.to_dict(), skipkeys=["__repr__"], indent=4)
    assert '"filongtop"' in p_str
    objs = files.loads_json(p_str)
    bd = objs["building"][1]
    assert np.isclose(bd.beams[0][0].s[0].myplus_section, 97.03)
    assert np.isclose(bd.beams[1][1].s[0].myplus_section,
                      127.85), bd.beams[1][1].s[0].myplus_section