def test_calculate_q_c1n(): qc = 0.58 CN = 1.7 qc1n = bim14.calculate_q_c1n(qc, CN) # expected_qc1n = 9.73 expected_qc1n = 9.8 assert ct.isclose(qc1n, expected_qc1n, rel_tol=0.1)
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
def test_calculate_k_sigma(): sigma_eff = 42.6*np.ones(1) qc1ncs = 9.73*np.ones(1) expected_ksigma = bim14.calculate_k_sigma(sigma_eff, qc1ncs) ksigma = 1.07 * np.ones(1) ksigma = 1.038 * np.ones(1) assert ct.isclose(expected_ksigma, ksigma, rel_tol=0.001)
def test_calculate_big_q_values(): qt = 20. sigmav = 15. CN = 0.8 qq = bim14.calculate_big_q_values(CN, qt, sigmav) print(qq) assert ct.isclose(qq, 0.04, rel_tol=0.011)
def test_crr_7p5_from_cpt(): q_c1n_cs = 62.1 gwl = 1.6 depth = 5.35 expected_crr_7p5 = 0.1 crr = bim14.crr_7p5_from_cpt(q_c1n_cs, gwl, depth, i_c=1.8) assert ct.isclose(crr, expected_crr_7p5, rel_tol=0.011)
def test_can_calculate_fos(): depths, q_c, f_s, u_2, gwl = trigger.load_cpt_data(TEST_DATA_DIR + "standard_1.csv") bi2014 = trigger.BoulangerIdriss2014(depths, q_c, f_s, u_2, gwl=gwl, pga=0.25, magnitude=7.5, ar=0.8) factor_safety_values = bi2014.factor_of_safety expected_fos_at_40 = 2.0 expected_fos_at_500 = 0.541205215 assert factor_safety_values[40] == expected_fos_at_40 assert ct.isclose(factor_safety_values[500], expected_fos_at_500, rel_tol=0.0001)
def test_karamitros(): # Load ground motion fpath = TEST_DATA_DIR + "input_acc.his" acc_file = np.loadtxt(fpath, skiprows=4) acc = acc_file[:, 1] # define the soils and soil profile sl_0 = sm.Soil() sl_0.phi = 0 sl_0.cohesion = 50000 sl_0.unit_dry_weight = 19600 sl_0.unit_sat_weight = 21000 sl_1 = sm.Soil() sl_1.phi = 33. sl_1.cohesion = 0 sl_1.unit_dry_weight = 19700 sl_1.unit_sat_weight = 21000 soil_profile = sm.SoilProfile() soil_profile.add_layer(0, sl_0) soil_profile.add_layer(4.0, sl_1) soil_profile.gwl = 2. # Define a foundation length = 1000000. fd = sm.Foundation() fd.length = length fd.width = 10.0 fd.depth = 0.0 q = 80000 # applied load z_c = lqs.cal_z_c(fd, z_liq=4, h0=2) vertical_effective_stress = soil_profile.vertical_effective_stress(z_c) sl_1.phi = lqs.calc_degraded_phi(sl_1.phi, vertical_effective_stress, q=q) q_ult = gf.capacity_meyerhof_and_hanna_1978(sl_0, sl_1, h0=2, fd=fd, verbose=0) dt = 0.005 sett_dyn = lqs.karamitros_settlement(fd, z_liq=4, q=80000, q_ult=q_ult, acc=acc, dt=dt) assert ct.isclose(sett_dyn, 0.034615, rel_tol=0.001) # 0.034615 Not validated, liquepy 0.1.0
def test_cavdp(): 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] cav_dp = settlements.calculate_cav_dp(acc, dt) # 1.4598176 from liquepy 0.1.0 tested with several motions assert ct.isclose(cav_dp, 1.4598176, rel_tol=0.001), cav_dp
def test_lu_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 # TODO: confirm should be in m/s2 # Define a foundation length = 1000000. fd = sm.Foundation() fd.length = length fd.width = 10.0 fd.depth = 0.0 sett_dyn = lqs.lu_settlements(q=80, fd=fd, Dr=55, acc=acc) assert ct.isclose(sett_dyn, 0.366247, rel_tol=0.001) # 0.366247 Not validated, liquepy 0.1.0 # if __name__ == '__main__': # test_bray_and_macedo_settlement()
def test_calc_degraded_phi(): phi_deg = lqs.calc_degraded_phi(33., 800, q=800) assert ct.isclose(phi_deg, 10.12554, rel_tol=0.001)
def test_calculate_m(): q_c1ncs = 62.1 m = bim14.calculate_m(q_c1ncs) expected_m = 0.6 assert ct.isclose(m, expected_m, rel_tol=0.01)
def test_calculate_cn_values(): m = 0.58 sigma_veff = 42.6 cn = bim14.calculate_cn_values(m, sigma_veff) expected_cn = 1.7 assert ct.isclose(cn, expected_cn, rel_tol=0.04)
def test_calculate_ic(): big_q = 0.04 big_f = 300. expected_ic = bim14.calculate_ic(big_q, big_f) assert ct.isclose(expected_ic , 5.07, rel_tol=0.09)
def test_calculate_q_c1ncs(): q_c1n = 9.73 delta_q_c1n = 63.26 expected_qc1ncs = 9.73 qc1ncs = bim14.calculate_q_c1ncs(q_c1n, delta_q_c1n) assert ct.isclose(qc1ncs, expected_qc1ncs, rel_tol=0.9)
def test_calculate_delta_q_c1n(): q_c1n = 9.73 fc = 64.21 delta_q = bim14.calculate_delta_q_c1n(q_c1n, fc) expected_delta_q = 52.37 assert ct.isclose(delta_q, expected_delta_q, rel_tol=0.02)