MoonGeo

    Download zip
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    10 months ago
    Downloads
    45

    No dependencies

    #MoonGeo - Geotechnical Engineering Calculation Library

    MoonGeo is a comprehensive geotechnical engineering calculation library written in Moonbit, providing functions for soil mechanics, foundation engineering, and earth pressure analysis.


    #Features

    #Earth Pressure Theory

    • Rankine Theory: Active and passive earth pressure coefficients and forces
    • Coulomb Theory: Earth pressure analysis for inclined walls and backfill
    • At-Rest Pressure: Earth pressure under no lateral deformation conditions


    #Foundation Engineering

    • Bearing Capacity: Ultimate and allowable bearing capacity calculations (Terzaghi theory)
    • Settlement Analysis: Immediate and consolidation settlement calculations
    • Consolidation: Time-dependent settlement and degree of consolidation


    #Soil Mechanics

    • Soil Properties: Void ratio, porosity, degree of saturation, density calculations
    • Effective Stress: Stress analysis in saturated and unsaturated soils
    • Seepage Analysis: Darcy flow, hydraulic gradient, and piping analysis


    #Usage

    #Rankine Earth Pressure

    test "rankine earth pressure" {
    // Rankine active earth pressure coefficient: φ=30°
    // K_a = tan²(45° - 30°/2) = tan²(30°) = 0.333
    let ka = rankine_active_coefficient(30.0)
    assert_eq(approx_equal(ka, 0.333, 0.01), true)

    // Rankine passive earth pressure coefficient: φ=30°
    // K_p = tan²(45° + 30°/2) = tan²(60°) = 3.0
    let kp = rankine_passive_coefficient(30.0)
    assert_eq(approx_equal(kp, 3.0, 0.1), true)

    // Active earth pressure: K_a=0.333, γ=18kN/m³, z=3m
    // σ_a = 0.333*18*3 = 18 kPa
    let pa = rankine_active_pressure(0.333, 18.0, 3.0)
    assert_eq(approx_equal(pa, 18.0, 0.5), true)

    // Active earth pressure resultant force: H=5m
    // E_a = 0.5*0.333*18*5² = 75 kN/m
    let ea = rankine_active_force(0.333, 18.0, 5.0)
    assert_eq(approx_equal(ea, 75.0, 1.0), true)
    }


    #Bearing Capacity

    test "bearing capacity" {
    // Terzaghi bearing capacity factors: φ=30°
    let nc = terzaghi_nc(30.0)
    assert_eq(nc > 0.0, true)
    let nq = terzaghi_nq(30.0)
    assert_eq(nq > 1.0, true)
    let ngamma = terzaghi_ngamma(30.0)
    assert_eq(ngamma > 0.0, true)

    // Terzaghi ultimate bearing capacity: c=10kPa, q=20kPa, γ=18kN/m³, B=2m, φ=30°
    let qu = terzaghi_bearing_capacity(10.0, 20.0, 18.0, 2.0, 30.0)
    assert_eq(qu > 0.0, true)

    // Allowable bearing capacity: F_s=3.0
    let fd = bearing_capacity_design(qu, 3.0)
    assert_eq(approx_equal(fd, qu / 3.0, 0.1), true)
    }


    #Settlement Analysis

    test "settlement" {
    // Single layer settlement: a_v=0.5MPa⁻¹, e_0=0.8, σ_z=100kPa, H_i=2m
    // s_i = 0.5*100*2/(1+0.8) = 55.6 mm
    let si = settlement_layer(0.5, 0.8, 100.0, 2.0)
    assert_eq(approx_equal(si * 1000.0, 55.6, 1.0), true)

    // Settlement using compression modulus: E_s=5MPa, σ_z=100kPa, H_i=2m
    // s_i = (100/1000)*2/5 = 0.1*2/5 = 0.04 m = 40 mm
    let si2 = settlement_layer_es(5.0, 100.0, 2.0)
    assert_eq(approx_equal(si2 * 1000.0, 40.0, 1.0), true)
    }


    #Seepage Analysis

    test "seepage" {
    // Darcy velocity: k=1e-5 m/s, i=0.1
    // v = 1e-5*0.1 = 1e-6 m/s
    let v = darcy_velocity(1.0e-5, 0.1)
    assert_eq(approx_equal(v, 1.0e-6, 1.0e-8), true)

    // Darcy flow rate: k=1e-4, i=0.2, A=10m²
    // Q = 1e-4*0.2*10 = 0.0002 m³/s
    let q = darcy_flow_rate(1.0e-4, 0.2, 10.0)
    assert_eq(approx_equal(q, 0.0002, 0.00001), true)

    // Hydraulic gradient: Δh=2m, L=10m
    // i = 2/10 = 0.2
    let i = hydraulic_gradient(2.0, 10.0)
    assert_eq(i, 0.2)

    // Critical hydraulic gradient: G_s=2.65, e=0.8
    // i_cr = (2.65-1)/(1+0.8) = 0.917
    let icr = critical_hydraulic_gradient(2.65, 0.8)
    assert_eq(approx_equal(icr, 0.917, 0.01), true)

    // Check for piping
    assert_eq(is_piping(1.0, 0.917), true)
    assert_eq(is_piping(0.5, 0.917), false)
    }


    #Consolidation

    test "consolidation" {
    // Time factor: C_v=1e-8 m²/s, t=1年=3.15e7s, H=5m
    // T_v = 1e-8*3.15e7/25 = 0.0126
    let tv = time_factor(1.0e-8, 3.15e7, 5.0)
    assert_eq(approx_equal(tv, 0.0126, 0.001), true)

    // Degree of consolidation: T_v=0.1
    // U ≈ 2√(0.1/π) = 0.357
    let u1 = consolidation_degree(0.1)
    assert_eq(approx_equal(u1, 0.357, 0.05), true)

    // Final consolidation settlement: m_v=0.5MPa⁻¹, σ_z=100kPa, H=3m
    // s_f = m_v * (σ_z/1000) * H = 0.5 * 0.1 * 3 = 0.15 m = 150 mm
    let sf = consolidation_settlement_final(0.5, 100.0, 3.0)
    assert_eq(approx_equal(sf * 1000.0, 150.0, 1.0), true)
    }


    #Soil Properties

    test "soil properties" {
    // Void ratio: n=0.5
    // e = 0.5/(1-0.5) = 1.0
    let e = void_ratio(0.5)
    assert_eq(e, 1.0)

    // Porosity: e=0.8
    // n = 0.8/(1+0.8) = 0.444
    let n = porosity(0.8)
    assert_eq(approx_equal(n, 0.444, 0.01), true)

    // Degree of saturation: V_w=0.4, V_v=0.5
    // S_r = 0.4/0.5*100 = 80%
    let sr = degree_of_saturation(0.4, 0.5)
    assert_eq(approx_equal(sr, 80.0, 1.0), true)

    // Dry density: ρ=1800kg/m³, w=20%
    // ρ_d = 1800/(1+0.2) = 1500 kg/m³
    let rho_d = dry_density(1800.0, 20.0)
    assert_eq(approx_equal(rho_d, 1500.0, 10.0), true)
    }


    #Parameter Ranges

    #Valid Input Ranges

    • Friction Angle: 0–50° (soil friction angles)
    • Cohesion: 0–500 kPa (soil cohesion)
    • Unit Weight: 10–25 kN/m³ (soil unit weights)
    • Depth: 0–50 m (foundation depths)
    • Width: 0.1–20 m (foundation widths)
    • Permeability: 10⁻¹⁰–10⁻² m/s (soil permeability)
    • Void Ratio: 0.1–2.0 (soil void ratios)


    #Typical Soil Properties

    • Sand: φ = 30–40°, γ = 17–20 kN/m³, k = 10⁻⁴–10⁻² m/s
    • Clay: φ = 0–25°, γ = 16–19 kN/m³, k = 10⁻¹⁰–10⁻⁶ m/s
    • Silt: φ = 25–35°, γ = 16–20 kN/m³, k = 10⁻⁶–10⁻³ m/s
    • Gravel: φ = 35–45°, γ = 18–22 kN/m³, k = 10⁻²–10⁰ m/s


    #Testing

    The project includes a comprehensive test suite covering all major functionalities:

    moon test

    #Test Coverage

    • Earth pressure analysis (Rankine, Coulomb, at-rest conditions)
    • Bearing capacity calculations (ultimate and allowable)
    • Settlement analysis (immediate and consolidation)
    • Seepage and groundwater flow
    • Soil property calculations
    • Effective stress analysis
    • Mathematical utility functions


    #Technical Details

    #Engineering Standards

    • Terzaghi Bearing Capacity Theory: Ultimate bearing capacity calculations
    • Rankine Earth Pressure Theory: Lateral earth pressure coefficients
    • Darcy Law: Groundwater flow and seepage analysis
    • Consolidation Theory: Time-dependent settlement calculations
    • SI Units: Consistent use of International System of Units


    #Applications

    • Foundation Design: Bearing capacity and settlement analysis
    • Retaining Walls: Earth pressure and stability calculations
    • Slope Stability: Factor of safety and critical slip surface analysis
    • Geotechnical Investigations: Soil property interpretation
    • Groundwater Engineering: Seepage and drainage design
    • Earth Structures: Dams, embankments, and landfills design


    #Notes

    1. Units: All calculations use SI units (meters, kilograms, seconds, Pascals)
    2. Soil Parameters: Default values provided for typical soil types
    3. Safety Factors: Engineering calculations include appropriate safety margins
    4. Boundary Conditions: Physical limits enforced to prevent unrealistic results
    5. Standards Compliance: Functions follow geotechnical engineering standards
    6. Validation: Results should be verified against established geotechnical methods


    #Version Information

    The current version (0.1.0) implements core geotechnical engineering calculation functions including:

    • Earth pressure analysis (Rankine and Coulomb theories)
    • Bearing capacity calculations (Terzaghi theory)
    • Settlement analysis (immediate and consolidation)
    • Seepage analysis (Darcy flow, hydraulic gradient)
    • Soil property calculations (void ratio, porosity, density)
    • Effective stress analysis
    • Mathematical utilities and tools

    The library is actively developed and aims to provide comprehensive coverage of geotechnical engineering calculations while being optimized for MoonBit.

    AV_HIGH

    let AV_HIGH : Double

    压缩系数 a_v (MPa⁻¹) - 高压缩性土

    AV_LOW

    let AV_LOW : Double

    压缩系数 a_v (MPa⁻¹) - 低压缩性土

    AV_MEDIUM

    let AV_MEDIUM : Double

    压缩系数 a_v (MPa⁻¹) - 中压缩性土

    CM_TO_M

    let CM_TO_M : Double

    cm 转 m

    CV_CLAY

    let CV_CLAY : Double

    固结系数 C_v (m²/s) - 粘土

    CV_SAND

    let CV_SAND : Double

    固结系数 C_v (m²/s) - 砂土

    CV_SILT

    let CV_SILT : Double

    固结系数 C_v (m²/s) - 粉土

    C_CLAY

    let C_CLAY : Double

    粘聚力 (kPa) - 一般粘土

    C_HARD_CLAY

    let C_HARD_CLAY : Double

    粘聚力 (kPa) - 硬粘土

    C_SOFT_CLAY

    let C_SOFT_CLAY : Double

    粘聚力 (kPa) - 软粘土

    DEG_TO_RAD

    let DEG_TO_RAD : Double

    度转弧度

    EPSILON

    let EPSILON : Double

    浮点数比较精度

    ES_HIGH

    let ES_HIGH : Double

    压缩模量 E_s (MPa) - 高压缩性土

    ES_LOW

    let ES_LOW : Double

    压缩模量 E_s (MPa) - 低压缩性土

    ES_MEDIUM

    let ES_MEDIUM : Double

    压缩模量 E_s (MPa) - 中压缩性土

    FS_IMPORTANT

    let FS_IMPORTANT : Double

    安全系数 - 重要工程

    FS_NORMAL

    let FS_NORMAL : Double

    安全系数 - 一般要求

    FS_TEMPORARY

    let FS_TEMPORARY : Double

    安全系数 - 临时工程
    let G : Double

    标准重力加速度 (m/s²)

    GAMMA_CLAY

    let GAMMA_CLAY : Double

    粘性土容重 (kN/m³) - 一般值

    GAMMA_SAND

    let GAMMA_SAND : Double

    砂土容重 (kN/m³) - 一般值

    GAMMA_SAT

    let GAMMA_SAT : Double

    饱和土容重 (kN/m³) - 一般值

    GAMMA_SUB

    let GAMMA_SUB : Double

    浮容重 (kN/m³) - 一般值

    GAMMA_WATER

    let GAMMA_WATER : Double

    水的容重 (kN/m³)

    K0_NORMAL

    let K0_NORMAL : Double

    静止土压力系数 (一般值)

    K0_OVERCONSOLIDATED

    let K0_OVERCONSOLIDATED : Double

    静止土压力系数 (超固结土)

    KPA_TO_PA

    let KPA_TO_PA : Double

    kPa 转 Pa

    K_CLAY

    let K_CLAY : Double

    渗透系数 (m/s) - 粘土

    K_COARSE_SAND

    let K_COARSE_SAND : Double

    渗透系数 (m/s) - 粗砂

    K_FINE_SAND

    let K_FINE_SAND : Double

    渗透系数 (m/s) - 细砂

    K_GRAVEL

    let K_GRAVEL : Double

    渗透系数 (m/s) - 砾石

    K_MEDIUM_SAND

    let K_MEDIUM_SAND : Double

    渗透系数 (m/s) - 中砂

    K_SILT

    let K_SILT : Double

    渗透系数 (m/s) - 粉土

    MPA_TO_PA

    let MPA_TO_PA : Double

    MPa 转 Pa

    M_TO_CM

    let M_TO_CM : Double

    m 转 cm

    NC_PHI0

    let NC_PHI0 : Double

    太沙基承载力系数 N_c (φ=0)

    NGAMMA_PHI0

    let NGAMMA_PHI0 : Double

    太沙基承载力系数 N_γ (φ=0)

    NQ_PHI0

    let NQ_PHI0 : Double

    太沙基承载力系数 N_q (φ=0)

    PHI_CLAY

    let PHI_CLAY : Double

    粘性土内摩擦角 (度) - 一般粘土

    PHI_DENSE_SAND

    let PHI_DENSE_SAND : Double

    砂土内摩擦角 (度) - 密砂

    PHI_HARD_CLAY

    let PHI_HARD_CLAY : Double

    粘性土内摩擦角 (度) - 硬粘土

    PHI_LOOSE_SAND

    let PHI_LOOSE_SAND : Double

    砂土内摩擦角 (度) - 松砂

    PHI_MEDIUM_SAND

    let PHI_MEDIUM_SAND : Double

    砂土内摩擦角 (度) - 中密砂

    PHI_SOFT_CLAY

    let PHI_SOFT_CLAY : Double

    粘性土内摩擦角 (度) - 软粘土
    let PI : Double

    圆周率

    RAD_TO_DEG

    let RAD_TO_DEG : Double

    弧度转度

    RHO_WATER

    let RHO_WATER : Double

    水的密度 (kg/m³)

    abs

    fn abs(x : Double) -> Double

    计算绝对值

    additional_stress_center

    fn additional_stress_center(p : Double, ic : Double) -> Double

    基础中心点下附加应力 (均布荷载) σ_z = p * I_c 参数: p - 基底压力 (kPa), ic - 应力影响系数

    approx_equal

    fn approx_equal(a : Double, b : Double, tolerance : Double) -> Bool

    判断两个浮点数是否近似相等

    at_rest_coefficient

    fn at_rest_coefficient(phi_deg : Double) -> Double

    静止土压力系数 (经验公式) K_0 = 1 - sin(φ)

    at_rest_pressure

    fn at_rest_pressure(k0 : Double, gamma : Double, z : Double) -> Double

    静止土压力 σ_0 = K_0 * γ * z 参数: k0 - 静止土压力系数, gamma - 土容重, z - 深度

    bearing_capacity_design

    fn bearing_capacity_design(qu : Double, fs : Double) -> Double

    地基承载力设计值 f = q_u / F_s 参数: qu - 极限承载力 (kPa), fs - 安全系数

    bishop_safety_factor_iteration

    fn bishop_safety_factor_iteration(c : Double, phi_deg : Double, slices : Array[(Double, Double, Double)], fs_initial : Double) -> Double

    简化Bishop法 - 安全系数 (迭代求解,这里提供单次计算) F_s = Σ[(cb + Wtan(φ)) / m_α] / Σ(W*sin(α)) 其中 m_α = cos(α) + sin(α)*tan(φ)/F_s

    clamp

    fn clamp(value : Double, min_val : Double, max_val : Double) -> Double

    限制值在范围内

    consolidation_coefficient

    fn consolidation_coefficient(k : Double, mv : Double, gamma_w : Double) -> Double

    固结系数 C_v = k / (m_v * γ_w) 参数: k - 渗透系数 (m/s), mv - 体积压缩系数 (MPa⁻¹), gamma_w - 水容重 (kN/m³)

    consolidation_degree

    fn consolidation_degree(tv : Double) -> Double

    固结度 (一维固结,时间因子法) U = 1 - (8/π²) * Σ[1/(2n-1)² * exp(-(2n-1)²π²T_v/4)] 简化: U ≈ 2√(T_v/π) (当 T_v < 0.2) U ≈ 1 - (8/π²) * exp(-π²T_v/4) (当 T_v > 0.2)

    consolidation_settlement_final

    fn consolidation_settlement_final(mv : Double, sigma_z : Double, h : Double) -> Double

    固结沉降 (最终沉降) s_f = m_v * σ_z * H 参数: mv - 体积压缩系数 (MPa⁻¹), sigma_z - 附加应力 (kPa), h - 层厚 (m) 注意: 需要单位统一,σ_z(kPa) 转 MPa

    consolidation_settlement_time

    fn consolidation_settlement_time(u : Double, sf : Double) -> Double

    固结沉降 (任意时刻) s_t = U * s_f

    cos_approx

    fn cos_approx(x : Double) -> Double

    余弦函数近似 (泰勒级数)

    coulomb_active_coefficient

    fn coulomb_active_coefficient(phi_deg : Double, alpha_deg : Double, beta_deg : Double, delta_deg : Double) -> Double

    库仑主动土压力系数 K_a = cos²(φ - α) / [cos²α * cos(α + δ) * (1 + √(sin(φ+δ)sin(φ-β)/(cos(α+δ)cos(α-β)))²)] 简化公式(α=0, β=0, δ=0时退化为朗肯) 参数: phi_deg - 内摩擦角, alpha_deg - 墙背倾角, beta_deg - 填土坡角, delta_deg - 墙土摩擦角

    coulomb_active_force

    fn coulomb_active_force(ka : Double, gamma : Double, h : Double) -> Double

    库仑主动土压力合力 E_a = 0.5 * K_a * γ * H²

    critical_hydraulic_gradient

    fn critical_hydraulic_gradient(gs : Double, e : Double) -> Double

    临界水力梯度 (流土) i_cr = (γ_sat - γ_w) / γ_w = (G_s - 1) / (1 + e) 参数: gs - 土粒比重, e - 孔隙比

    cube

    fn cube(x : Double) -> Double

    计算立方

    darcy_flow_rate

    fn darcy_flow_rate(k : Double, i : Double, a : Double) -> Double

    达西定律 - 渗流量 Q = k * i * A 参数: k - 渗透系数, i - 水力梯度, a - 过流面积 (m²)

    darcy_velocity

    fn darcy_velocity(k : Double, i : Double) -> Double

    达西定律 - 渗流速度 v = k * i 参数: k - 渗透系数 (m/s), i - 水力梯度

    deg_to_rad

    fn deg_to_rad(deg : Double) -> Double

    角度转弧度

    degree_of_saturation

    fn degree_of_saturation(vw : Double, vv : Double) -> Double

    饱和度 S_r = V_w / V_v * 100% 参数: vw - 水的体积, vv - 孔隙体积

    dry_density

    fn dry_density(rho : Double, w : Double) -> Double

    干密度 ρ_d = ρ / (1 + w) 参数: rho - 湿密度 (kg/m³), w - 含水量 (%)

    earth_pressure_force_position_with_surcharge

    fn earth_pressure_force_position_with_surcharge(h : Double, q : Double, gamma : Double) -> Double

    计算土压力合力作用点 (考虑超载)

    earth_pressure_type

    fn earth_pressure_type(ka : Double, kp : Double, k0 : Double, k_actual : Double) -> String

    判断土压力分布类型 返回: "active", "passive", "at_rest"

    effective_stress

    fn effective_stress(sigma : Double, u : Double) -> Double

    有效应力 σ' = σ - u 参数: sigma - 总应力 (kPa), u - 孔隙水压力 (kPa)

    exp_approx

    fn exp_approx(x : Double) -> Double

    指数函数近似 (e^x)

    hansen_nc

    fn hansen_nc(phi_deg : Double) -> Double

    汉森承载力系数 N_c

    hansen_ngamma

    fn hansen_ngamma(phi_deg : Double) -> Double

    汉森承载力系数 N_γ N_γ = 1.5(N_q - 1)tan(φ)

    hansen_nq

    fn hansen_nq(phi_deg : Double) -> Double

    汉森承载力系数 N_q

    hydraulic_gradient

    fn hydraulic_gradient(delta_h : Double, l : Double) -> Double

    水力梯度 i = Δh / L 参数: delta_h - 水头差 (m), l - 渗流路径长度 (m)

    is_piping

    fn is_piping(i : Double, i_cr : Double) -> Bool

    判断是否发生流土 i > i_cr

    ln_approx

    fn ln_approx(x : Double) -> Double

    自然对数近似

    max

    fn max(a : Double, b : Double) -> Double

    计算最大值

    min

    fn min(a : Double, b : Double) -> Double

    计算最小值

    permeability_from_d10

    fn permeability_from_d10(d10 : Double, c : Double) -> Double

    渗透系数 (经验公式,根据有效粒径) k ≈ C * d₁₀² 参数: d10 - 有效粒径 (mm), c - 经验系数

    pore_water_pressure

    fn pore_water_pressure(gamma_w : Double, hw : Double) -> Double

    孔隙水压力 (静水压力) u = γ_w * h_w

    porosity

    fn porosity(e : Double) -> Double

    孔隙率 n = V_v / V = e / (1 + e)

    rad_to_deg

    fn rad_to_deg(rad : Double) -> Double

    弧度转角度

    rankine_active_coefficient

    fn rankine_active_coefficient(phi_deg : Double) -> Double

    朗肯主动土压力系数 K_a = tan²(45° - φ/2) 参数: phi_deg - 内摩擦角 (度)

    rankine_active_force

    fn rankine_active_force(ka : Double, gamma : Double, h : Double) -> Double

    朗肯主动土压力合力 (无粘性土,矩形分布) E_a = 0.5 * K_a * γ * H² 参数: ka, gamma, h - 墙高 (m)

    rankine_active_force_position

    fn rankine_active_force_position(h : Double) -> Double

    朗肯主动土压力合力作用点 (距墙底) y = H / 3

    rankine_active_pressure

    fn rankine_active_pressure(ka : Double, gamma : Double, z : Double) -> Double

    朗肯主动土压力 (无粘性土) σ_a = K_a * γ * z 参数: ka - 主动土压力系数, gamma - 土容重 (kN/m³), z - 深度 (m)

    rankine_active_pressure_cohesive

    fn rankine_active_pressure_cohesive(ka : Double, gamma : Double, z : Double, c : Double) -> Double

    朗肯主动土压力 (粘性土) σ_a = K_a * γ * z - 2c√K_a 参数: ka, gamma, z, c - 粘聚力 (kPa)

    rankine_active_pressure_surcharge

    fn rankine_active_pressure_surcharge(ka : Double, gamma : Double, z : Double, q : Double) -> Double

    朗肯主动土压力 (有超载) σ_a = K_a * (γ * z + q) 参数: ka, gamma, z, q - 超载 (kPa)

    rankine_passive_coefficient

    fn rankine_passive_coefficient(phi_deg : Double) -> Double

    朗肯被动土压力系数 K_p = tan²(45° + φ/2)

    rankine_passive_pressure

    fn rankine_passive_pressure(kp : Double, gamma : Double, z : Double) -> Double

    朗肯被动土压力 (无粘性土) σ_p = K_p * γ * z

    rankine_passive_pressure_cohesive

    fn rankine_passive_pressure_cohesive(kp : Double, gamma : Double, z : Double, c : Double) -> Double

    朗肯被动土压力 (粘性土) σ_p = K_p * γ * z + 2c√K_p

    safe_div

    fn safe_div(num : Double, den : Double, fallback : Double) -> Double

    安全除法,分母为零时返回默认值

    saturated_density

    fn saturated_density(gs : Double, e : Double, rho_w : Double) -> Double

    饱和密度 ρ_sat = (G_s + e) * ρ_w / (1 + e) 参数: gs - 土粒比重, e - 孔隙比, rho_w - 水的密度

    settlement_layer

    fn settlement_layer(av : Double, e0 : Double, sigma_z : Double, hi : Double) -> Double

    分层总和法 - 单层压缩量 s_i = (a_v / (1 + e_0)) * σ_z * H_i 参数: av - 压缩系数 (MPa⁻¹), e0 - 初始孔隙比, sigma_z - 附加应力 (kPa), hi - 层厚 (m) 注意: 需要单位统一,σ_z(kPa) 转 MPa

    settlement_layer_es

    fn settlement_layer_es(es : Double, sigma_z : Double, hi : Double) -> Double

    分层总和法 - 使用压缩模量 s_i = σ_z * H_i / E_s 参数: es - 压缩模量 (MPa), sigma_z - 附加应力 (kPa), hi - 层厚 (m) 注意: 需要单位统一,σ_z(kPa) 转 MPa

    sin_approx

    fn sin_approx(x : Double) -> Double

    正弦函数近似 (泰勒级数)

    square

    fn square(x : Double) -> Double

    计算平方

    stress_influence_coefficient_simplified

    fn stress_influence_coefficient_simplified(z : Double, b : Double) -> Double

    基础角点下附加应力系数 (Boussinesq解,简化) I_c = 1 / (2π) * [z³/(r²+z²)^(5/2)] 这里使用简化公式

    submerged_unit_weight

    fn submerged_unit_weight(gamma_sat : Double, gamma_w : Double) -> Double

    浮容重 γ' = γ_sat - γ_w

    swedish_circle_safety_factor

    fn swedish_circle_safety_factor(c : Double, phi_deg : Double, slices : Array[(Double, Double, Double)]) -> Double

    瑞典圆弧法 - 安全系数 F_s = Σ(cl + Wcos(α)tan(φ)) / Σ(Wsin(α)) 参数: c - 粘聚力, phi_deg - 内摩擦角, slices - 条块数组 [(l, w, alpha_deg), ...]

    tan_approx

    fn tan_approx(x : Double) -> Double

    正切函数近似

    terzaghi_bearing_capacity

    fn terzaghi_bearing_capacity(c : Double, q : Double, gamma : Double, b : Double, phi_deg : Double) -> Double

    太沙基极限承载力 (条形基础) q_u = cN_c + qN_q + 0.5γB*N_γ 参数: c - 粘聚力 (kPa), q - 基础埋深处超载 (kPa), gamma - 土容重 (kN/m³), b - 基础宽度 (m), phi_deg - 内摩擦角

    terzaghi_bearing_capacity_shape

    fn terzaghi_bearing_capacity_shape(c : Double, q : Double, gamma : Double, b : Double, phi_deg : Double, sc : Double, sq : Double, sgamma : Double) -> Double

    太沙基承载力 (考虑基础形状修正) 矩形基础: q_u = cN_cs_c + qN_qs_q + 0.5γBN_γs_γ 参数: sc, sq, sgamma - 形状系数

    terzaghi_nc

    fn terzaghi_nc(phi_deg : Double) -> Double

    太沙基承载力系数 N_c N_c = (N_q - 1) * cot(φ) (当 φ > 0) N_c = 5.7 (当 φ = 0)

    terzaghi_ngamma

    fn terzaghi_ngamma(phi_deg : Double) -> Double

    太沙基承载力系数 N_γ N_γ ≈ 2(N_q + 1)tan(φ) (简化)

    terzaghi_nq

    fn terzaghi_nq(phi_deg : Double) -> Double

    太沙基承载力系数 N_q N_q = e^(πtanφ) * tan²(45° + φ/2)

    time_factor

    fn time_factor(cv : Double, t : Double, h : Double) -> Double

    时间因子 T_v = C_v * t / H² 参数: cv - 固结系数 (m²/s), t - 时间 (s), h - 排水距离 (m)

    total_settlement

    fn total_settlement(settlements : Array[Double]) -> Double

    总沉降量 (分层总和法) s = Σ s_i

    total_stress

    fn total_stress(gamma : Double, z : Double) -> Double

    总应力 (自重应力) σ = γ * z

    void_ratio

    fn void_ratio(n : Double) -> Double

    孔隙比 e = V_v / V_s = (n / (1 - n)) 参数: n - 孔隙率