A reproducible Nelder–Mead framework for inverse identification of Mohr–Coulomb shear-strength parameters from triaxial failure data
MohrCoulomb-SimplexFit is a research-oriented command-line application and Python library for
estimating cohesion,
The software is designed around four principles: a mathematically explicit objective, physically admissible parameters, deterministic computation, and auditable outputs. SciPy is used only as a development-time reference and is not required at runtime.
Given
the program identifies the linear Mohr–Coulomb envelope
Version 0.1 adopts the following assumptions:
- compression is positive and
$0\leq\sigma_{3i}\leq\sigma_{1i}$ ; - every input value uses one consistent stress unit;
- at least three observations and two distinct stress states are available;
- the failure envelope is linear over the investigated stress range;
- all observations receive equal weight;
- the admissible parameter domain is
$c\geq0$ and$0\leq\varphi<90^\circ$ .
Here,
For observation
Defining
and eliminating
Thus each triaxial test is represented by a circle centered at
The strength envelope can be written in implicit line form as
The perpendicular distance from the center
For the adopted physical domain,
Exact tangency requires the center-to-line distance to equal the circle radius:
The signed geometric tangency residual used by the software is consequently
A positive residual means that the candidate line intersects the ideal tangency distance of that circle; a negative residual means that the line lies farther from the center than the radius.
Substituting the definitions of
After collecting the principal-stress terms,
and hence
Using the half-angle identities yields the familiar form
This establishes the equivalence between Mohr-circle tangency and the standard triaxial
Mohr–Coulomb failure relationship. The implementation minimizes geometric tangency residuals in
the
For imperfect experimental data, one line will not generally be tangent to every circle. The unweighted inverse problem is
subject to
The reported objective has squared-stress units. A directly interpretable summary is
which has the same unit as the input stresses. Residual signs and magnitudes remain available for
every observation in residuals.csv; RMSE should be interpreted together with the stress scale and
the residual pattern, not as a universal goodness-of-fit threshold.
The tangency equation is linear after introducing
The program first solves the auxiliary least-squares system
The estimate is projected onto
This deterministic initializer reduces sensitivity to a poor arbitrary starting simplex. To limit scale imbalance between cohesion and angle, the optimization coordinates are
and the minimized internal objective is
For the two-parameter vector
and the centroid excluding the worst vertex is
The implementation applies the standard operations:
| Operation | Trial point | Coefficient |
|---|---|---|
| Reflection | ||
| Expansion | ||
| Outside contraction | ||
| Inside contraction | ||
| Shrink |
Every trial vertex is projected onto the admissible domain. Convergence requires both the maximum simplex coordinate span and maximum objective-value span to fall below their configured tolerances. The default iteration limit is 2000; the result records the iteration count, function-evaluation count, convergence state, and termination reason.
The repository includes three triaxial failure observations in examples/triaxial_example.csv:
| Test |
|
|
|---|---|---|
| test_1 | 100.1 | 594.9357 |
| test_2 | 200.3 | 1147.3320 |
| test_3 | 301.2 | 1574.3210 |
The deterministic v0.1 analysis gives
with
Regenerate both scientific figures with
python scripts/generate_readme_figures.pyPython 3.10 or newer is required. For a conventional installation:
python -m venv .venv
python -m pip install .Install development tools, including the SciPy reference implementation, with
python -m pip install -e ".[dev]"Place custom CSV files in data/input/, then run the launcher for your platform.
Windows PowerShell:
.\run_fit.ps1Linux, macOS, or Git Bash:
chmod +x run_fit.sh
./run_fit.shThe launcher creates .venv when required, installs the project, lists available CSV files, asks
for a stress unit, and writes a timestamped analysis under results/. Non-interactive execution is
also available:
.\run_fit.ps1 -InputFile data\input\triaxial_example.csv -StressUnit kPa -OutputName my-run./run_fit.sh --input data/input/triaxial_example.csv --unit kPa --output-name my-runmohrcoulomb-simplexfit fit examples/triaxial_example.csv \
--stress-unit kPa \
--output-dir results/exampleSmall datasets may be entered without creating a file:
mohrcoulomb-simplexfit fit \
--pair 100.1 594.9357 \
--pair 200.3 1147.332 \
--pair 301.2 1574.321 \
--stress-unit kPa \
--output-dir results/inline-exampleUse mohrcoulomb-simplexfit fit --help for initial-value and tolerance controls. Non-empty output
directories are protected; --overwrite replaces only the three standard result files and
preserves unrelated files.
CSV input requires sigma3 and sigma1; label is optional and additional columns are ignored.
label,sigma3,sigma1
specimen_01,100,500
specimen_02,200,800
specimen_03,300,1100The --stress-unit value is metadata, not a conversion instruction. Each successful analysis
creates:
| Artifact | Purpose |
|---|---|
result.json |
Versioned machine-readable parameters, input metadata, and optimizer diagnostics |
residuals.csv |
Observation-level circles, distances, signed residuals, and squared residuals |
mohr_coulomb_fit.png |
Equal-axis Mohr circles and fitted upper failure envelope |
Validation errors return process exit code 2; numerical convergence or output failures return
1; successful analyses return 0.
from mohrcoulomb_simplexfit import FitOptions, StressPair, fit
observations = [
StressPair(100.1, 594.9357, "test_1"),
StressPair(200.3, 1147.332, "test_2"),
StressPair(301.2, 1574.321, "test_3"),
]
result = fit(observations, options=FitOptions(max_iterations=2000))
print(result.cohesion)
print(result.friction_angle_degrees)
print(result.rmse)Invalid data or controls raise ValidationError; failure to meet numerical convergence criteria
raises ConvergenceError.
The automated suite covers analytical circle geometry, residual evaluation, synthetic exact
parameter recovery, stress scaling, noisy data, physical boundaries, optimizer failure modes, CSV
validation, CLI exit codes, and output artifacts. The native result is cross-validated against
scipy.optimize.minimize(method="Nelder-Mead") on deterministic datasets.
ruff check .
ruff format --check .
pytest
python -m buildThe present suite contains 24 tests and runs on Python 3.10 and 3.12 in CI.
- The model is deterministic and does not produce confidence or prediction intervals.
- The objective is unweighted; heteroscedastic measurement uncertainty is not represented.
- Linear Mohr–Coulomb behavior is assumed over the supplied confining-stress range.
- Pore-pressure corrections and effective-stress conversion must be completed before fitting.
- Correlated replicates, censored tests, tensile states, nonlinear envelopes, and model-selection diagnostics are outside the v0.1 scope.
- A converged numerical optimum is not, by itself, evidence that the constitutive model is adequate. Inspect the residual table, fitted plot, test quality, drainage condition, and stress convention.
MohrCoulomb-SimplexFit/
├── src/mohrcoulomb_simplexfit/ # numerical core, CLI, I/O, and plotting
├── tests/ # analytical, numerical, and CLI verification
├── data/input/ # local CSV entry point for interactive launchers
├── examples/ # tracked reproducible datasets
├── docs/ # method notes and README figures
├── scripts/ # reproducible documentation-figure generation
├── run_fit.ps1 # Windows interactive launcher
└── run_fit.sh # Bash interactive launcher
See the numerical method note, input-data guide, and contribution guide for further details.
- Nelder, J. A., and Mead, R. (1965). “A simplex method for function minimization.” The Computer Journal, 7(4), 308–313. doi:10.1093/comjnl/7.4.308.
- Labuz, J. F., and Zang, A. (2012). “Mohr–Coulomb Failure Criterion.” Rock Mechanics and Rock Engineering, 45, 975–979. doi:10.1007/s00603-012-0281-7.
If this software contributes to published work, report the version, input stress convention and unit, exact CSV data, fitted parameters, objective/RMSE, and convergence diagnostics. A formal software citation file can be added once project authorship and repository URL are finalized.
MohrCoulomb-SimplexFit is released under the MIT License.