Complete V5 acceptance milestone
This commit is contained in:
@@ -1,10 +1,41 @@
|
||||
# Strength Reduction Slope Smoke Case
|
||||
# Mohr-Coulomb Strength Reduction Benchmark
|
||||
|
||||
The reference document in this folder describes a geomechanical slope stability
|
||||
strength-reduction benchmark. The current executable input is still a compact
|
||||
slope wedge derived from the documented geometry and material scale; it is kept
|
||||
as a parser/solver regression case until the final Mohr-Coulomb
|
||||
strength-reduction benchmark input and acceptance checks are added.
|
||||
This case is a compact slope-wedge benchmark for the V5 Mohr-Coulomb strength
|
||||
reduction workflow. The structural input uses a real `*MOHR COULOMB` material
|
||||
with friction angle, cohesion, dilation angle, tensile cutoff, residual
|
||||
parameters and an initial reduction factor.
|
||||
|
||||
Run `run_case.bat` to execute the static case and write VTK output under
|
||||
`results\auto_run`.
|
||||
Files:
|
||||
|
||||
- `strength_reduction_slope_static.inp`: C3D4 slope wedge with `MC_SOIL`.
|
||||
- `check_strength_reduction_results.py`: CTest checker for the benchmark
|
||||
report.
|
||||
- `run_case.bat`: double-click runner that executes FemLite and then generates
|
||||
strength-reduction reports.
|
||||
|
||||
Generated benchmark outputs:
|
||||
|
||||
- `strength_reduction_history.csv`: trial factor, residual, displacement
|
||||
probe, plastic share, metric and bracket status.
|
||||
- `strength_reduction_summary.csv`: final bracket and converged factor.
|
||||
- `plastic_zone.csv`: Mohr-Coulomb branch activation for representative slope
|
||||
probes at the converged reduction factor.
|
||||
- `displacement_probe.csv`: crest vertical and toe horizontal displacement
|
||||
control probes.
|
||||
|
||||
Acceptance checks:
|
||||
|
||||
- The input must contain `*MOHR COULOMB` and must not use the old elastic-soil
|
||||
placeholder.
|
||||
- The strength-reduction search must converge with safety factor in
|
||||
`[1.20, 1.55]`.
|
||||
- The history must contain both stable and unstable trials, forming a real
|
||||
bracket.
|
||||
- At least two representative slope probes must activate a Mohr-Coulomb
|
||||
plastic branch at the converged factor.
|
||||
- The displacement probes must keep the expected crest-down and toe-out signs.
|
||||
|
||||
The benchmark report is generated by `tools/benchmarks/strength_reduction_benchmark.f90`,
|
||||
which links the production FemLite core and calls the Mohr-Coulomb and
|
||||
strength-reduction driver/report modules. The helper is intentionally outside
|
||||
`src/` because it is benchmark orchestration, not solver production code.
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def read_key_values(path: Path) -> dict[str, str]:
|
||||
with path.open(newline="", encoding="utf-8") as handle:
|
||||
return {row["key"]: row["value"] for row in csv.DictReader(handle)}
|
||||
|
||||
|
||||
def require(condition: bool, message: str) -> None:
|
||||
if not condition:
|
||||
raise RuntimeError(message)
|
||||
|
||||
|
||||
def find_tool(build_dir: Path) -> Path:
|
||||
candidates = [
|
||||
build_dir / "strength_reduction_benchmark.exe",
|
||||
build_dir / "strength_reduction_benchmark",
|
||||
build_dir / "Release" / "strength_reduction_benchmark.exe",
|
||||
build_dir / "Release" / "strength_reduction_benchmark",
|
||||
]
|
||||
for candidate in candidates:
|
||||
if candidate.exists():
|
||||
return candidate
|
||||
raise RuntimeError(f"missing strength_reduction_benchmark tool under {build_dir}")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if len(sys.argv) != 2:
|
||||
raise RuntimeError("usage: check_strength_reduction_results.py OUTPUT_DIR")
|
||||
|
||||
output_dir = Path(sys.argv[1]).resolve()
|
||||
repo_root = Path(__file__).resolve().parents[2]
|
||||
build_dir = output_dir.parents[1]
|
||||
input_file = repo_root / "examples" / "strengthReduction" / "strength_reduction_slope_static.inp"
|
||||
tool = find_tool(build_dir)
|
||||
|
||||
inp_text = input_file.read_text(encoding="utf-8").upper()
|
||||
require("*MOHR COULOMB" in inp_text, "strength reduction input does not use Mohr-Coulomb")
|
||||
require("ELASTIC_SOIL" not in inp_text, "input still uses the old elastic-soil placeholder")
|
||||
|
||||
completed = subprocess.run(
|
||||
[str(tool), str(input_file), str(output_dir)],
|
||||
cwd=repo_root,
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
print(completed.stdout)
|
||||
if completed.returncode != 0:
|
||||
raise RuntimeError(f"{tool} exited with code {completed.returncode}")
|
||||
|
||||
history = output_dir / "strength_reduction_history.csv"
|
||||
summary = output_dir / "strength_reduction_summary.csv"
|
||||
plastic_zone = output_dir / "plastic_zone.csv"
|
||||
displacement_probe = output_dir / "displacement_probe.csv"
|
||||
vtk = output_dir / "result_00000001.vtk"
|
||||
nodes = output_dir / "nodes_00000001.csv"
|
||||
|
||||
for path in (history, summary, plastic_zone, displacement_probe, vtk, nodes):
|
||||
require(path.exists(), f"missing benchmark output: {path}")
|
||||
|
||||
values = read_key_values(summary)
|
||||
require(values.get("status") == "CONVERGED", f"unexpected SR status: {values.get('status')}")
|
||||
factor = float(values["converged_factor"])
|
||||
lower = float(values["lower"])
|
||||
upper = float(values["upper"])
|
||||
require(1.20 <= factor <= 1.55, f"safety factor out of range: {factor}")
|
||||
require(lower < factor < upper, f"factor is not bracketed: lower={lower}, factor={factor}, upper={upper}")
|
||||
require(float(values["stable_count"]) >= 2.0, "not enough stable SR trials")
|
||||
require(float(values["unstable_count"]) >= 1.0, "not enough unstable SR trials")
|
||||
|
||||
with history.open(newline="", encoding="utf-8") as handle:
|
||||
rows = list(csv.DictReader(handle))
|
||||
stable = [row for row in rows if row.get("stable") == "1"]
|
||||
unstable = [row for row in rows if row.get("stable") == "0"]
|
||||
require(len(stable) >= 2 and len(unstable) >= 1, "history does not contain a real bracket")
|
||||
|
||||
with plastic_zone.open(newline="", encoding="utf-8") as handle:
|
||||
zone_rows = list(csv.DictReader(handle))
|
||||
plastic_count = sum(1 for row in zone_rows if row["plastic"] == "1")
|
||||
max_branch = max(int(row["branch"]) for row in zone_rows)
|
||||
require(plastic_count >= 2, f"plastic zone too small: {plastic_count}")
|
||||
require(max_branch > 0, "plastic zone never activates a Mohr-Coulomb branch")
|
||||
|
||||
probe = read_key_values(displacement_probe)
|
||||
require(float(probe["crest_uz"]) < 0.0, "crest vertical displacement probe has wrong sign")
|
||||
require(float(probe["toe_ux"]) > 0.0, "toe horizontal displacement probe has wrong sign")
|
||||
|
||||
print(f"strength reduction benchmark passed: FS={factor:.4f}, plastic probes={plastic_count}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -1,3 +1,23 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
call "%~dp0..\run_example_case.bat" "%~dp0" "strengthReduction" "--static-linear" "strength_reduction_slope_static.inp" "1"
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
set "ROOT_DIR=%~dp0..\.."
|
||||
set "OUT_DIR=%~dp0results\auto_run"
|
||||
set "TOOL=%ROOT_DIR%\build-win-gcc-16\strength_reduction_benchmark.exe"
|
||||
|
||||
if not exist "%TOOL%" (
|
||||
echo Building strength_reduction_benchmark...
|
||||
cmake --build "%ROOT_DIR%\build-win-gcc-16" --config Release --target strength_reduction_benchmark
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
)
|
||||
|
||||
del /Q "%OUT_DIR%\strength_reduction_history.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\strength_reduction_summary.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\plastic_zone.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\displacement_probe.csv" 2>nul
|
||||
|
||||
"%TOOL%" "%~dp0strength_reduction_slope_static.inp" "%OUT_DIR%"
|
||||
exit /b %errorlevel%
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
*HEADING
|
||||
FemLite compact elastic slope wedge derived from strength-reduction benchmark
|
||||
FemLite compact Mohr-Coulomb slope strength-reduction benchmark
|
||||
*NODE
|
||||
1, 0.0, 0.0, 0.0
|
||||
2, 85.0, 0.0, 0.0
|
||||
@@ -36,12 +36,15 @@ FemLite compact elastic slope wedge derived from strength-reduction benchmark
|
||||
3, 4, 9, 10
|
||||
*NSET, NSET=SLOPE_FACE
|
||||
5, 6, 11, 12
|
||||
*MATERIAL, NAME=ELASTIC_SOIL
|
||||
*MATERIAL, NAME=MC_SOIL
|
||||
*ELASTIC
|
||||
2.0E7, 0.3
|
||||
*DENSITY
|
||||
1940.0
|
||||
*SOLID SECTION, ELSET=SLOPE, MATERIAL=ELASTIC_SOIL
|
||||
*MOHR COULOMB
|
||||
30.0, 22000.0, 5.0, 2000.0
|
||||
20.0, 7000.0, 1.0, 1.0
|
||||
*SOLID SECTION, ELSET=SLOPE, MATERIAL=MC_SOIL
|
||||
*BOUNDARY
|
||||
ALLNODES, 2, 2, 0.0
|
||||
BASE, 3, 3, 0.0
|
||||
|
||||
Reference in New Issue
Block a user