Complete V5 acceptance milestone
This commit is contained in:
@@ -1,19 +1,37 @@
|
||||
# Ball Adhesion/Decohesion Contact Smoke Case
|
||||
# Ball Adhesion/Decohesion Cohesive Benchmark
|
||||
|
||||
This folder contains the original ball adhesion/decohesion reference files plus
|
||||
a compact FemLite V4.8 smoke case:
|
||||
This folder contains the original ball adhesion/decohesion reference files, the
|
||||
older contact indentation smoke case, and a V5.7 cohesive adhesion/decohesion
|
||||
benchmark:
|
||||
|
||||
- `ball_adhesion_decohesion_params.txt`
|
||||
- `ball_adhesion_contact_smoke.inp`
|
||||
- `ball_adhesion_cohesive_benchmark.inp`
|
||||
- `check_cohesive_results.py`
|
||||
- `run_case.bat`
|
||||
|
||||
The reference model uses a rubber membrane, a ball indenter, adhesive normal
|
||||
and shear stiffness, tensile/shear strength limits and energy-release criteria.
|
||||
FemLite V4.8 does not include a cohesive adhesion/decohesion law. The included
|
||||
input keeps the executable contact part of the benchmark in the current solver:
|
||||
a rubber-like C3D8 membrane pad, a stiffer ball surrogate, the documented
|
||||
50 mm / 150 mm / 6 mm length scale, and a short explicit indentation that
|
||||
checks contact activation.
|
||||
The smoke input keeps the executable contact part of the benchmark in the main
|
||||
solver: a rubber-like C3D8 membrane pad, a stiffer ball surrogate, the documented
|
||||
50 mm / 150 mm / 6 mm length scale, and a short explicit indentation that checks
|
||||
contact activation.
|
||||
|
||||
The cohesive benchmark is driven by `tools/benchmarks/ball_adhesion_cohesive_benchmark.f90`.
|
||||
It discretizes the circular ball/membrane adhesive zone into concentric rings
|
||||
and drives a compression, unloading and pull-off displacement history. Each ring
|
||||
uses the production `fem_cohesive_law`, `fem_cohesive_state` and
|
||||
`fem_cohesive_metrics` modules, so damage, maximum opening, dissipated energy
|
||||
and failed area are advanced through the same state helpers used by the core.
|
||||
|
||||
Outputs:
|
||||
|
||||
- `adhesion_history.csv`: force-displacement history, pull/compression force,
|
||||
cumulative energy, maximum damage and failed fraction.
|
||||
- `adhesion_summary.csv`: peak pull-off force, compression force, dissipated
|
||||
energy, hysteresis area, decohesion area and final failed fraction.
|
||||
- `decohesion_profile.csv`: ring-level damage, maximum opening, energy and
|
||||
failed status.
|
||||
|
||||
Run:
|
||||
|
||||
@@ -21,4 +39,15 @@ Run:
|
||||
run_case.bat
|
||||
```
|
||||
|
||||
Results are written to `results\auto_run`.
|
||||
The smoke result is written to `results\auto_run`; cohesive benchmark results
|
||||
are written to `results\cohesive`.
|
||||
|
||||
CTest benchmark:
|
||||
|
||||
```powershell
|
||||
ctest --test-dir build-win-gcc-16 -C Release -R example_ball_adhesion_cohesive_benchmark --output-on-failure
|
||||
```
|
||||
|
||||
The checker fails if cohesive damage does not activate, if pull-off force is
|
||||
missing, if dissipated energy decreases, or if the final profile does not show a
|
||||
nonzero decohesion area.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
** FemLite V5.7 cohesive ball adhesion/decohesion benchmark.
|
||||
**
|
||||
** Fields:
|
||||
** ball_radius, contact_radius, rings, samples, duration,
|
||||
** max_indentation, max_opening,
|
||||
** normal_stiffness, tangent_stiffness,
|
||||
** normal_strength, tangent_strength,
|
||||
** fracture_energy_i, fracture_energy_ii,
|
||||
** mode_mix_eta, compression_factor, slip_ratio
|
||||
*BALL ADHESION COHESIVE
|
||||
0.050, 0.020, 12, 41, 1.0, 0.0016, 0.010, 8.0e7, 4.0e7, 1.0e5, 6.0e4, 350.0, 520.0, 1.0, 2.5, 0.35
|
||||
@@ -0,0 +1,119 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def require(condition: bool, message: str) -> None:
|
||||
if not condition:
|
||||
raise AssertionError(message)
|
||||
|
||||
|
||||
def read_key_values(path: Path) -> dict[str, float]:
|
||||
result: dict[str, float] = {}
|
||||
with path.open(newline="") as handle:
|
||||
reader = csv.reader(handle)
|
||||
next(reader)
|
||||
for key, value in reader:
|
||||
result[key] = float(value)
|
||||
return result
|
||||
|
||||
|
||||
def read_rows(path: Path) -> list[dict[str, str]]:
|
||||
with path.open(newline="") as handle:
|
||||
return list(csv.DictReader(handle))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if len(sys.argv) != 3:
|
||||
raise SystemExit("usage: check_cohesive_results.py BUILD_DIR OUTPUT_DIR")
|
||||
|
||||
repo = Path(__file__).resolve().parents[2]
|
||||
build_dir = Path(sys.argv[1]).resolve()
|
||||
out_dir = Path(sys.argv[2]).resolve()
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
case_dir = Path(__file__).resolve().parent
|
||||
inp = case_dir / "ball_adhesion_cohesive_benchmark.inp"
|
||||
text = inp.read_text(encoding="utf-8")
|
||||
require("*BALL ADHESION COHESIVE" in text, "missing cohesive benchmark block")
|
||||
|
||||
tool = build_dir / "ball_adhesion_cohesive_benchmark.exe"
|
||||
if not tool.exists():
|
||||
tool = build_dir / "ball_adhesion_cohesive_benchmark"
|
||||
completed = subprocess.run(
|
||||
[str(tool), str(inp), str(out_dir)],
|
||||
cwd=repo,
|
||||
text=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
if completed.returncode != 0:
|
||||
print(completed.stdout)
|
||||
raise RuntimeError(f"{tool} exited with code {completed.returncode}")
|
||||
|
||||
summary_path = out_dir / "adhesion_summary.csv"
|
||||
history_path = out_dir / "adhesion_history.csv"
|
||||
profile_path = out_dir / "decohesion_profile.csv"
|
||||
for path in (summary_path, history_path, profile_path):
|
||||
require(path.exists(), f"{path.name} missing")
|
||||
require(path.stat().st_size > 0, f"{path.name} empty")
|
||||
|
||||
summary = read_key_values(summary_path)
|
||||
history = read_rows(history_path)
|
||||
profile = read_rows(profile_path)
|
||||
|
||||
samples = int(summary["samples"])
|
||||
rings = int(summary["rings"])
|
||||
contact_area = summary["contact_area"]
|
||||
require(samples == 41, "unexpected sample count")
|
||||
require(rings == 12, "unexpected ring count")
|
||||
require(len(history) == samples, "history row count mismatch")
|
||||
require(len(profile) == rings, "profile row count mismatch")
|
||||
|
||||
forces = [float(row["normal_force"]) for row in history]
|
||||
energies = [float(row["energy_total"]) for row in history]
|
||||
damages = [float(row["max_damage"]) for row in history]
|
||||
failed_fracs = [float(row["failed_fraction"]) for row in history]
|
||||
|
||||
require(min(forces) < -50.0, "compression branch did not activate")
|
||||
require(max(forces) > 20.0, "pull-off force too small")
|
||||
require(summary["peak_pull_force"] == max(forces), "peak pull force mismatch")
|
||||
require(summary["min_compression_force"] == min(forces),
|
||||
"compression force mismatch")
|
||||
require(summary["dissipated_energy"] > 0.05, "cohesive energy too small")
|
||||
require(summary["hysteresis_area"] > 0.02, "hysteresis area too small")
|
||||
require(summary["max_damage"] > 0.95, "cohesive damage did not activate")
|
||||
require(summary["decohesion_area"] > 0.50 * contact_area,
|
||||
"decohesion area too small")
|
||||
require(summary["failed_fraction"] > 0.50, "failed fraction too small")
|
||||
require(abs(summary["final_force"]) < 1.0e-6,
|
||||
"final force should vanish after complete decohesion")
|
||||
|
||||
for prev, cur in zip(energies, energies[1:]):
|
||||
require(cur + 1.0e-12 >= prev, "cohesive energy decreased")
|
||||
for prev, cur in zip(damages, damages[1:]):
|
||||
require(cur + 1.0e-12 >= prev, "cohesive damage decreased")
|
||||
require(failed_fracs[-1] == summary["failed_fraction"],
|
||||
"final failed fraction mismatch")
|
||||
|
||||
failed = [row for row in profile if int(row["status"]) == 3]
|
||||
damaged = [row for row in profile if float(row["damage"]) > 1.0e-8]
|
||||
failed_area = sum(float(row["area"]) for row in failed)
|
||||
damaged_area = sum(float(row["area"]) for row in damaged)
|
||||
max_damage = max(float(row["damage"]) for row in profile)
|
||||
require(len(failed) == int(summary["failed_count"]), "failed count mismatch")
|
||||
require(abs(failed_area - summary["decohesion_area"]) <= 1.0e-10,
|
||||
"decohesion area mismatch")
|
||||
require(abs(damaged_area - summary["damaged_area"]) <= 1.0e-10,
|
||||
"damaged area mismatch")
|
||||
require(abs(max_damage - summary["max_damage"]) <= 1.0e-10,
|
||||
"profile damage mismatch")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -1,3 +1,25 @@
|
||||
@echo off
|
||||
call "%~dp0..\run_example_case.bat" "%~dp0" "ball_adhesion_decohesion" "--run" "ball_adhesion_contact_smoke.inp" "10"
|
||||
rem FemLite ball adhesion smoke and cohesive decohesion benchmark runner.
|
||||
setlocal
|
||||
set "CASE_DIR=%~dp0"
|
||||
for %%I in ("%CASE_DIR%..\..") do set "ROOT_DIR=%%~fI"
|
||||
set "BUILD_DIR=%ROOT_DIR%\build-win-gcc-16"
|
||||
|
||||
call "%CASE_DIR%..\run_example_case.bat" "%CASE_DIR%" "ball_adhesion_decohesion" "--run" "ball_adhesion_contact_smoke.inp" "10"
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
set "TOOL=%BUILD_DIR%\ball_adhesion_cohesive_benchmark.exe"
|
||||
set "INP=%CASE_DIR%ball_adhesion_cohesive_benchmark.inp"
|
||||
set "OUT_DIR=%CASE_DIR%results\cohesive"
|
||||
if not exist "%OUT_DIR%" mkdir "%OUT_DIR%"
|
||||
del /Q "%OUT_DIR%\adhesion_*.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\decohesion_profile.csv" 2>nul
|
||||
|
||||
if not exist "%TOOL%" (
|
||||
echo Building ball_adhesion_cohesive_benchmark...
|
||||
cmake --build "%BUILD_DIR%" --config Release --target ball_adhesion_cohesive_benchmark
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
)
|
||||
|
||||
"%TOOL%" "%INP%" "%OUT_DIR%"
|
||||
exit /b %errorlevel%
|
||||
|
||||
Reference in New Issue
Block a user