<jupyter_start><jupyter_text>Inputs<jupyter_code>D = 0.1731
soil = "dense sand"
psi = math.radians(32)
c = 0
gamma_bar = 18000
W_tot = 214.78
burial_depths = np.arange(0.25, 1.25, 0.25)
f = 0.6
shear_factor = 0.3
el_lengths = [0.3, 1.5, 15]<jupyter_output><empty_output><jupyter_text>General<jupyter_code>def soil_weight(gamma, D, H):
    return gamma * D * H

soil_weights = [soil_weight(gamma_bar, D, burial_depth) for burial_depth in burial_depths]
soil_weights<jupyter_output><empty_output><jupyter_text>Vertical Uplift<jupyter_code>def vertical_uplift_mobilisation(soil, H, D):
    if "sand" in soil:
        return min(0.02 * H, 0.1 * D)

    elif "clay" in soil:
        return min(0.2 * H, 0.2 * D)

    else:
        raise ValueError("Unknown soil type.")

delta_qus = [vertical_uplift_mobilisation(soil, burial_depth, D) for burial_depth in burial_depths]
delta_qus
def N_cv(c, H, D):

    if c == 0:
        return 0
    
    return min(2 * H / D, 10)
        
N_cvs = [N_cv(c, burial_depth, D) for burial_depth in burial_depths]
N_cvs
def N_q(psi):
    return math.exp(math.pi * math.tan(psi)) * math.tan((math.pi / 4) + 0.5 * psi) ** 2

N_q(psi)
def N_qv(psi, H, D):
    
    if psi == 0:
        return 0
    
    return min(math.degrees(psi) * H / 44 / D, N_q(psi))

N_qvs = [N_qv(psi, burial_depth, D) for burial_depth in burial_depths]
N_qvs
def uplift_resistance(shear_factor, H, D, gamma):
    """DNV-RP-F110 2007
    """
    if "sand" in soil:
        return (1 + shear_factor * H / D) * (gamma * H * D)

    elif "clay" in soil:
        return gamma * H * D + 2 * H * c

    else:
        raise ValueError("Unknown soil type.")
  
R_maxs = [uplift_resistance(shear_factor, burial_depth, D, gamma_bar) for burial_depth in burial_depths]
R_maxs<jupyter_output><empty_output><jupyter_text>RC 1<jupyter_code>vertical_uplifts = [(R_max - soil_weight) for R_max, soil_weight in zip(R_maxs, soil_weights)]
vertical_uplifts<jupyter_output><empty_output><jupyter_text>RC 5<jupyter_code>element_length = el_lengths[0]
vertical_uplifts_imp = [element_length * (R_max - soil_weight) for R_max, soil_weight in zip(R_maxs, soil_weights)]
vertical_uplifts_imp
negative_resists = [-element_length * soil_weight for soil_weight in soil_weights]
negative_resists<jupyter_output><empty_output><jupyter_text>Axial<jupyter_code>def axial_soil_force(D, c, H, f, gamma_bar, psi):
    alpha = 0.608 - 0.123 * c - 0.274 / (c ** 2 + 1) + 0.695 / (c ** 3 + 1)
    K_0 = 1 - (math.sin(psi))
    return math.pi * D * alpha * c + math.pi * D * H * gamma_bar * (
        0.5 * (1 + K_0)
    ) * math.tan(f * psi)
def axial_mobilisation(soil):
    delta_ts = {
        "dense sand": 0.003, "loose sand": 0.005, "stiff clay": 0.008, "soft clay": 0.01
    }
    return delta_ts.get(soil, ValueError("Unknown soil type."))

delta_t = axial_mobilisation(soil)
delta_t<jupyter_output><empty_output><jupyter_text>RC 7<jupyter_code>element_length = el_lengths[0]
T_us = [
    element_length * axial_soil_force(D, c, burial_depth, f, gamma_bar, psi)
    for burial_depth in burial_depths
]

T_us<jupyter_output><empty_output><jupyter_text>RC 8<jupyter_code>element_length = el_lengths[1]
T_us = [
    element_length * axial_soil_force(D, c, burial_depth, f, gamma_bar, psi)
    for burial_depth in burial_depths
]

T_us<jupyter_output><empty_output><jupyter_text>RC 9<jupyter_code>element_length = el_lengths[2]
T_us = [
    element_length * axial_soil_force(D, c, burial_depth, f, gamma_bar, psi)
    for burial_depth in burial_depths
]

T_us<jupyter_output><empty_output><jupyter_text>Lateral<jupyter_code>def lateral_mobilisation(H, D, bound='mid'):
    
    mob = {
        'lower': 0.1 * D,
        'mid': 0.125 * D,
        'upper': 1.15 * D,
    }
    
    return mob.get(bound, ValueError("Unknown bound."))

delta_ls = [lateral_mobilisation(burial_depth, D, bound='mid') for burial_depth in burial_depths]
delta_ls
def N_ch(c, H, D):

    if c == 0:
        return 0
    x = H / D
    
    return min(6.752 + 0.065 * x - 11.063 / (x + 1) ** 2 + 7.119 / (x + 1) ** 3, 9)

N_chs = [N_ch(c, burial_depth, D) for burial_depth in burial_depths]
N_chs
def N_qh(psi, H, D):
    
    if psi == 0:
        return 0

    if psi < 20:
        psi = 20
    elif psi > 45:
        psi = 45
        
    psi_range = [20, 25, 30, 35, 40, 45]
    a = [2.399, 3.332, 4.565, 6.816, 10.959, 17.658]
    b = [0.439, 0.839, 1.234, 2.019, 1.783, 3.309]
    c = [-0.03, -0.09, -0.089, -0.146, 0.045, 0.048]
    d = [
        1.059 * 10 ** -3,
        5.606 * 10 ** -3,
        4.275 * 10 ** -3,
        7.651 * 10 ** -3,
        -5.425 * 10 ** -3,
        -6.443 * 10 ** -3
    ]
    e = [
        -1.754 * 10 ** -5,
        -1.319 * 10 ** -4,
        -9.159 * 10 ** -5,
        -1.683 * 10 ** -4,
        -1.153 * 10 ** -4,
        -1.299 * 10 ** -4
    ]
    x = H / D
    def par(case):
        return interp1d(psi_range, case)(psi)

    return (
        par(a) + par(b) * x + par(c) * x ** 2 + par(d) * x ** 3 + par(e) * x ** 4
    )

N_qhs = [N_qh(psi, burial_depth, D) for burial_depth in burial_depths]
N_qhs

N_qh(psi, burial_depth, D)<jupyter_output><empty_output><jupyter_text>RC 2 and RC 4<jupyter_code>Hs = [(burial_depth + D/2) for burial_depth in burial_depths]

def lateral_soil_force(c, H, D, psi, gamma):
    return N_ch(c, H, D) * c * D + N_qh(psi, H, D) * gamma * H * D

P_us = [lateral_soil_force(c, H, D, 32, gamma_bar) for H in Hs]
P_us<jupyter_output><empty_output><jupyter_text>Vertical Bearing<jupyter_code>def vertical_downward_mobilisation(soil, D):
    
    if "sand" in soil:
        return 0.1 * D

    elif "clay" in soil:
        return 0.2 * D

    else:
        raise ValueError("Unknown soil type.")

delta_qd = vertical_downward_mobilisation(soil, D)
delta_qd
def cot(psi):
    return 1 / math.tan(psi)
def N_c(psi):
    return (N_q(psi) - 1)*cot(psi)

N_c(psi)
def N_gamma(psi):
    return 2*(N_q(psi) + 1)*math.tan(psi)

N_gamma(psi)<jupyter_output><empty_output><jupyter_text>RC 3<jupyter_code>def vertical_bearing_force(psi, c, D, gamma, H):

    return (
        N_c(psi) * c * D + N_q(psi) * gamma * H * D + 0.5 * N_gamma(psi) * (gamma + (1025 * 9.81)) * D ** 2
    )

Q_ds = [vertical_bearing_force(psi, c, D, gamma_bar, burial_depth) for burial_depth in burial_depths]
Q_ds<jupyter_output><empty_output><jupyter_text>RC 6<jupyter_code>element_length = el_lengths[0]
Q_ds = [element_length * Q_d for Q_d in Q_ds]
Q_ds<jupyter_output><empty_output><jupyter_text>RC 10<jupyter_code>Q_ds = [10 * Q_d for Q_d in Q_ds]
Q_ds<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1421164989326014, 'fraction_numerical': 0.05535224153705398, 'mean_word_length': 3.1883780332056193, 'pattern_counts': {'":': 4, '<': 62, '<?xml version=': 0, '>': 62, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '15', 'dir': 'jupyter-structured-clean-dedup', 'id': '327582', 'license': 'MIT', 'n_tokens_mistral': 3108, 'n_tokens_neox': 2778, 'n_words': 624, 'path': 'notebooks/FS2000 Springs.ipynb', 'repo_name': 'benranderson/uhb', 'size': '6558'}