A geotechnical engineering command-line tool that determines the minimum required embedment depth for a laterally loaded pile, based on applied horizontal load and soil properties.
Built for structural and geotechnical engineers who need fast, reliable pile depth estimates grounded in established design methods.
Given two primary inputs — a lateral load and a soil characteristic — the program calculates how deep a pile must be embedded to resist that load with an adequate factor of safety.
The program automatically selects the appropriate method based on your soil input:
| Soil Input | Method Used | Soil Type |
|---|---|---|
Friction angle phi (degrees) |
Broms (1964) — Cohesionless | Sand, gravel |
Undrained shear strength c (ksf or kPa) |
Broms (1964) — Cohesive | Clay, silt |
Subgrade modulus k_h (lb/in³ or kN/m³) |
Elastic Subgrade Reaction | Any |
Uses passive earth pressure to determine ultimate lateral pile resistance:
H_ult = 0.5 * gamma * Kp * B * D^2
where:
Kp = tan^2(45 + phi/2) (passive pressure coefficient)
gamma = effective soil unit weight
B = pile diameter
D = embedment depth (solved)
Uses undrained shear strength along the pile shaft:
H_ult = 9 * c * B * (D - 1.5*B)
Uses pile-soil relative stiffness to determine required flexible pile length:
T = (EI / (k_h * B))^(1/5) D_required >= 4T (granular)
R = (EI / (k_h * B))^(1/4) D_required >= 4R (cohesive)
pip install -r requirements.txtRequirements: Python 3.8+, NumPy, Matplotlib (optional, for plots), pytest (for tests)
python3 -m pile_depth_calc.mainThe program prompts step by step for unit system, lateral load, soil parameter, and optional secondary inputs (pile diameter, unit weight, factor of safety). Defaults are applied when you press Enter.
==================================================
LATERALLY LOADED PILE DEPTH CALCULATOR
==================================================
Select unit system:
1. imperial
2. si
Selection: 1
Lateral load H (kips): 10
Select soil parameter:
1. phi (friction angle)
2. cohesion (undrained shear strength)
3. k_h (subgrade modulus)
Selection: 1
Friction angle phi (degrees): 32
Optional parameters (press Enter for defaults):
Pile diameter B (ft) [1.0]:
Soil unit weight (pcf) [110.0]:
Factor of safety FS [2.0]:
from pile_depth_calc.main import run_calculation
result = run_calculation({
"units": "imperial",
"H": 10.0,
"phi": 32.0,
})
print(result["table"])╔==============================================╗
║ LATERALLY LOADED PILE DEPTH ANALYSIS ║
╠==============================================╣
║ Method: Broms (Cohesionless) ║
║ Lateral Load: 10.0 kips ║
║ Phi: 32° ║
║ Kp: 3.25 ║
║ Pile Diameter: 1.0 ft ║
║ Unit Weight: 110.0 pcf ║
║ Factor of Safety: 2.0 ║
╠==============================================╣
║ ➤ Required Depth: 11.0 ft ║
║ ➤ Passive Resist.: 20.0 kips ║
║ ➤ Achieved FS: 2.00 ║
║ ➤ Pile Regime: Flexible (D/B = 10.6 >= 10)║
╚==============================================╝
An optional depth vs. resistance plot is available when matplotlib is installed.
Both Imperial and SI unit systems are supported. SI defaults: B=0.3 m, gamma=17.3 kN/m³.
╔==============================================╗
║ LATERALLY LOADED PILE DEPTH ANALYSIS ║
╠==============================================╣
║ Method: Broms (Cohesionless) ║
║ Lateral Load: 44.5 kN ║
║ Phi: 32° ║
║ Kp: 3.25 ║
║ Pile Diameter: 0.3 m ║
║ Unit Weight: 17.3 kN/m³ ║
║ Factor of Safety: 2.0 ║
╠==============================================╣
║ ➤ Required Depth: 3.3 m ║
║ ➤ Passive Resist.: 89.0 kN ║
║ ➤ Achieved FS: 2.00 ║
║ ➤ Pile Regime: Flexible (D/B = 10.8 >= 10)║
╚==============================================╝
pile_depth_calc/
├── __init__.py
├── main.py # CLI entry point and programmatic API
├── inputs.py # Input parsing, validation, unit conversion
├── broms.py # Broms (1964) method — sand and clay
├── elastic.py # Elastic subgrade reaction method
├── results.py # Output formatting and matplotlib plot
├── constants.py # Engineering defaults and unit labels
└── tests/
├── __init__.py
└── test_calculations.py # 32 unit tests
python3 -m pytest pile_depth_calc/tests/test_calculations.py -v32 tests covering:
- Broms sand formula against hand-calculated values
- Broms clay formula convergence
- Elastic method D >= 4T verification
- Input validation (negative loads, phi > 45, missing/duplicate soil params)
- Unit conversion accuracy and round-trip consistency
- Depth rounding (0.5 ft imperial, 0.1 m SI)
- Method auto-selection logic
- Broms method is most reliable for simple, uniform soil profiles with piles under pure lateral loading
- Factor of safety defaults to 2.0 (ASD); adjustable per site conditions
- Pile regime is classified as rigid (D/B < 10) or flexible (D/B >= 10)
- Inputs outside typical validity ranges trigger warnings (phi > 42, H > 100 kips)
- Pile group effects are not accounted for — use group reduction factors per AASHTO/FHWA
- Not a substitute for a full geotechnical analysis by a licensed engineer
- Broms, B.B. (1964). "Lateral resistance of piles in cohesionless soils." ASCE JSMFD, 90(3), 123-156.
- Broms, B.B. (1964). "Lateral resistance of piles in cohesive soils." ASCE JSMFD, 90(2), 27-63.
- Reese, L.C. & Van Impe, W.F. (2001). Single Piles and Pile Groups Under Lateral Loading. Balkema.
- AASHTO LRFD Bridge Design Specifications, 9th Ed., Section 10.
MIT License. Free for engineering and educational use. Not a substitute for professional engineering judgment.