示例#1
0
def save_input_motion(ffp, name, values, dt):
    """
    Exports acceleration values to the FLAC input format.

    :param ffp: str, full file path to output file
    :param name: str, name of records
    :param values: array, acceleration values
    :param dt: float, time step
    :return: None
    """
    deprecation("liquepy.num.flac.save_input_motion is deprecated, use liquepy.num.flac.save_input_motion_and_dt")
    para = [name, "%i %.4f" % (len(values), dt)]
    for i in range(len(values)):
        para.append("%.6f" % values[i])
    ofile = open(ffp, "w")
    ofile.write("\n".join(para))
    ofile.close()
示例#2
0
def load_cpt_from_file(ffp, delimiter=";"):
    deprecation('Use load_mpa_cpt_file() where file is all in MPa')
    # import data from csv file
    folder_path, file_name = ntpath.split(ffp)
    ncols = 4
    try:
        data = np.loadtxt(ffp,
                          skiprows=24,
                          delimiter=delimiter,
                          usecols=(0, 1, 2, 3))
    except:
        ncols = 3
        data = np.loadtxt(ffp,
                          skiprows=24,
                          delimiter=delimiter,
                          usecols=(0, 1, 2))
    depth = data[:, 0]
    q_c = data[:, 1] * 1e3  # should be in kPa
    f_s = data[:, 2]
    if ncols == 4:
        u_2 = data[:, 3]
    else:
        u_2 = np.zeros_like(depth)
    gwl = None
    a_ratio = None
    infile = open(ffp)
    lines = infile.readlines()
    for line in lines:
        if "Assumed GWL:" in line:
            gwl = float(line.split(delimiter)[1])
        if "aratio" in line:
            try:
                a_ratio = float(line.split(delimiter)[1])
            except ValueError:
                pass
    return CPT(depth,
               q_c,
               f_s,
               u_2,
               gwl,
               a_ratio,
               folder_path=folder_path,
               file_name=file_name,
               delimiter=delimiter)
def calculate_qc_1ncs_from_crr_7p5(crr_7p5):
    deprecation("Use calc_q_c1n_cs_from_crr_m7p5")
    return calc_qc_1ncs_from_crr_m7p5(crr_7p5)
def calc_qc_1ncs_from_crr_m7p5(crr_7p5, c_0=2.8):
    deprecation("Use calc_q_c1n_cs_from_crr_m7p5")
    return calc_q_c1n_cs_from_crr_m7p5(crr_7p5, c_0)
 def magnitude(self):
     deprecation('Deprecated "BoulangerIdriss2014.magnitude", should use "BoulangerIdriss2014.m_w"')
     return self.m_w
 def gammas(self):
     deprecation('Deprecated "BoulangerIdriss2014.gammas", should use "BoulangerIdriss2014.unit_wt"')
     return self.unit_wt
    def __init__(self, cpt, gwl=None, pga=0.25, m_w=None, cfc=0.0, **kwargs):
        """
        Performs the Boulanger and Idriss triggering procedure for a CPT profile

        ref: Boulanger:2014id

        Parameters
        ----------

        gwl: float, m,
            ground water level below the surface
        pga: float, g,
            peak ground acceleration
        m_w: float, -,
            Earthquake magnitude
        a_ratio: float, -, default=0.8
            Area ratio
        cfc: float, -, default=0.0
            Fines content correction factor for Eq 2.29
        magnitude: float, -,
            Earthquake magnitude (deprecated)
        i_c_limit: float, -, default=2.6
            Limit of liquefiable material
        s_g: float or array_like, -, default=2.65
            Specific gravity
        s_g_water: float, -, default=1.0
            Specific gravity of water
        p_a: float, -, kPa, default=101
            Atmospheric pressure
        """

        magnitude = kwargs.get("magnitude", None)
        i_c_limit = kwargs.get("i_c_limit", 2.6)
        self.s_g = kwargs.get("s_g", 2.65)
        self.s_g_water = kwargs.get("s_g_water", 1.0)
        self.p_a = kwargs.get("p_a", 101.)  # kPa
        self.c_0 = kwargs.get("c_0", 2.8)
        self.unit_wt_clips = kwargs.get("unit_wt_clips", (None, None))
        saturation = kwargs.get("saturation", None)
        unit_wt_method = kwargs.get("unit_wt_method", "robertson2009")
        gamma_predrill = kwargs.get("gamma_predrill", 17.0)
        if gwl is None and cpt.gwl is not None:
            gwl = cpt.gwl

        if m_w is None:
            if magnitude is None:
                self.m_w = 7.5
            else:
                deprecation('Deprecated input "magnitude" in BoulangerIdriss2014(), should use "m_w"')
                self.m_w = magnitude
        else:
            self.m_w = m_w

        unit_water_wt = self.s_g_water * 9.8
        self.npts = len(cpt.depth)
        self.depth = cpt.depth
        self.cpt = cpt
        # self.q_c = cpt.q_c
        # self.f_s = cpt.f_s
        # self.u_2 = cpt.u_2
        self.gwl = gwl
        self.pga = pga
        self.a_ratio = cpt.a_ratio
        if cpt.a_ratio is None:
            self.a_ratio = 0.8
        self.i_c_limit = i_c_limit

        self.cfc = cfc  # parameter of fines content, eq 2.29
        self.q_t = calc_qt(self.cpt.q_c, self.a_ratio, self.cpt.u_2)  # kPa

        if saturation is None:
            self.saturation = np.where(self.depth < self.gwl, 0, 1)
        else:
            self.saturation = saturation
        if unit_wt_method == "robertson2009":
            self.unit_wt = calc_unit_dry_weight(self.cpt.f_s, self.q_t, self.p_a, unit_water_wt)
        elif unit_wt_method == 'void_ratio':
            uncorr_unit_dry_wt = calc_unit_dry_weight(self.cpt.f_s, self.q_t, self.p_a, unit_water_wt)
            self.e_curr = calc_void_ratio(uncorr_unit_dry_wt, self.s_g, pw=unit_water_wt)
            self.unit_wt = calc_unit_weight(self.e_curr, self.s_g, self.saturation, pw=unit_water_wt)
        else:
            raise ValueError("unit_wt_method should be either: 'robertson2009' or 'void_ratio' not: %s" % unit_wt_method)
        if self.unit_wt_clips[0] is not None or self.unit_wt_clips[1] is not None:
            self.unit_wt = np.clip(self.unit_wt, self.unit_wt_clips[0], self.unit_wt_clips[1])
        self.sigma_v = calc_sigma_v(self.depth, self.unit_wt, gamma_predrill)
        self.pore_pressure = calc_pore_pressure(self.depth, self.gwl, unit_water_wt)
        self.sigma_veff = calc_sigma_veff(self.sigma_v, self.pore_pressure)
        if self.sigma_veff[0] == 0.0:
            self.sigma_veff[0] = 1.0e-10
        self.rd = calc_rd(self.depth, self.m_w)

        self.q_c1n_cs, self.q_c1n, self.fines_content, self.i_c, self.big_q, self.big_f = _calc_dependent_variables(self.sigma_v,
                                                                                                        self.sigma_veff,
                                                                                                        self.cpt.q_c,
                                                                                            self.cpt.f_s, self.p_a,
                                                                                            self.q_t,
                                                                                            self.cfc)


        self.k_sigma = calc_k_sigma(self.sigma_veff, self.q_c1n_cs)
        self.msf = calc_msf(self.m_w, self.q_c1n_cs)
        self.csr = calc_csr(self.sigma_veff, self.sigma_v, pga, self.rd, gwl, self.depth)
        self.crr_m7p5 = calc_crr_m7p5_from_qc1ncs_capped(self.q_c1n_cs, gwl, self.depth, self.i_c, self.i_c_limit, self.c_0)
        self.crr = crr_m(self.k_sigma, self.msf, self.crr_m7p5)  # CRR at set magnitude
        fs_unlimited = self.crr / self.csr
        # fs_fines_limited = np.where(self.fines_content > 71, 2.0, fs_unlimited)  # based on I_c=2.6
        fos = np.where(fs_unlimited > 2, 2, fs_unlimited)
        self.factor_of_safety = np.where(self.i_c <= self.i_c_limit, fos, 2.25)
示例#8
0
def calculate_cav_dp_series(asig):
    deprecation(
        "calculate_cav_dp_series is deprecated - use calc_cav_dp_series")
    return calc_cav_dp_series(asig)
示例#9
0
 def hp0(self):
     deprecation('hp0 is deprecated, used h_po')
     return self._h_po
示例#10
0
def save_input_motion(ffp, name, values, dt):
    deprecation(
        "liquepy.loader.save_input_motion is deprecated, use save_input_motion_and_dt"
    )
    return flac.save_input_motion_and_dt(ffp, values, dt, label=name)
示例#11
0
def calculate_shear_strain(fos, relative_density):
    deprecation("Use calc_shear_strain")
    return calculate_shear_strain(fos, relative_density)
示例#12
0
def calc_shear_strain(fs, d_r):
    deprecation(
        "Use calc_shear_strain_zhang_2004, note that new function returns strain not in percentage!"
    )
    return None
示例#13
0
def calculate_volumetric_strain(factor_of_safety, q_c1n_cs):
    deprecation(
        "Use calc_volumetric_strain_zhang_2004, note that new function returns strain not in percentage!"
    )
    return None