Complete V5 acceptance milestone

This commit is contained in:
shenw
2026-06-26 12:54:40 +08:00
parent 26639d8dc2
commit a01a4fda24
105 changed files with 8694 additions and 8922 deletions
+54 -13
View File
@@ -1,19 +1,50 @@
# Roll Forming Friction Smoke Case
# Roll Forming Benchmarks
This folder contains the original roll-forming reference documents plus a
compact FemLite V4.8 smoke case:
This folder contains the original roll-forming reference documents plus two
compact FemLite V5 entries:
- `roll_forming_friction_smoke.inp`
- `run_case.bat`
- `roll_forming_kinematics_benchmark.inp`
- `roll_forming_springback_benchmark.inp`
The reference model describes a quarter-symmetry cold roll-forming process with
rigid rollers, friction coefficient 0.30, roller down-feed, roller rotation,
workpiece plasticity and residual-stress output. FemLite V4.8 does not claim
that complete high-fidelity process simulation. The included input keeps the
executable mechanics that the current solver can verify reliably: a C3D8
workpiece compressed against a C3D8 roller surrogate, scaled elastic material
properties for a stable short explicit run, Coulomb friction, a tangential
forming load and contact/friction output.
`roll_forming_friction_smoke.inp` is the V4.8 executable mechanics smoke: a
C3D8 workpiece compressed against a C3D8 roller surrogate with scaled elastic
material properties, Coulomb friction, tangential forming load and contact
output.
`roll_forming_kinematics_benchmark.inp` is the V5.6 roller kinematics benchmark.
It drives the production rigid-cylinder/roller modules with translation,
down-feed and angular velocity, then compares tangential slip, regularized
traction, friction energy, pressure and torque with and without roller spin.
`roll_forming_springback_benchmark.inp` is the V5.6 plastic forming and
springback benchmark. It drives the production roller kinematics, regularized
traction, roll metrics and J2 small-strain material update on a compact
through-thickness strip model. The benchmark forms the workpiece to a prescribed
curvature, unloads by solving for zero resultant bending moment, and writes
residual displacement, springback ratio and plastic-zone output.
Reference checks for the current kinematics input:
| Metric | Requirement |
|---|---:|
| Active samples | 6 |
| Mean slip with spin | greater than 1.5 x no-spin slip |
| Mean regularized traction with spin | greater than 1.1 x no-spin traction |
| Max traction delta | greater than 50 |
| Friction energy with spin | greater than no-spin energy |
| Roller torque with spin | positive |
Reference checks for the current springback input:
| Metric | Requirement |
|---|---:|
| Material points | 81 |
| Forming force | between `1.0e4` and `3.0e4` |
| Plastic work | positive |
| Plastic zone fraction | between `0.20` and `1.0` |
| Springback ratio | between `0.05` and `0.95` |
| Residual moment | below `1.0e-6` of peak moment scale |
Run:
@@ -21,4 +52,14 @@ Run:
run_case.bat
```
Results are written to `results\auto_run`.
Results are written to:
- `results\auto_run` for the friction smoke
- `results\roller_kinematics` for the kinematics benchmark
- `results\springback` for the plastic springback benchmark
Springback reference outputs include `springback_history.csv`,
`springback_summary.csv` and `plastic_zone.csv`. Current reference values are
springback ratio `0.473154068`, residual displacement `0.0316107559`, plastic
work `1.11591736e-05`, active plastic points `56/81` and residual moment
`8.92778801e-11` in absolute value.
@@ -0,0 +1,84 @@
from __future__ import annotations
import csv
import subprocess
import sys
from pathlib import Path
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 require(condition: bool, message: str) -> None:
if not condition:
raise AssertionError(message)
def main() -> int:
if len(sys.argv) != 3:
raise SystemExit("usage: check_roller_kinematics.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)
inp = Path(__file__).resolve().parent / "roll_forming_kinematics_benchmark.inp"
text = inp.read_text(encoding="utf-8")
require("*ROLLER KINEMATICS" in text, "missing roller kinematics block")
tool = build_dir / "roll_forming_kinematics_benchmark.exe"
if not tool.exists():
tool = build_dir / "roll_forming_kinematics_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 = out_dir / "roller_kinematics_summary.csv"
history = out_dir / "roller_kinematics_history.csv"
require(summary.exists(), "summary output missing")
require(history.exists(), "history output missing")
require(summary.stat().st_size > 0, "summary output empty")
require(history.stat().st_size > 0, "history output empty")
data = read_key_values(summary)
require(int(data["samples"]) == 6, "unexpected sample count")
require(int(data["active_count"]) == 6, "all roller samples should be active")
require(data["mean_slip_with_spin"] > data["mean_slip_without_spin"] * 1.5,
"spin should increase tangential slip")
require(data["mean_traction_with_spin"] > data["mean_traction_without_spin"] * 1.1,
"spin should change regularized tangential traction")
require(data["max_delta_traction"] > 50.0, "traction delta is too small")
require(data["friction_energy_with_spin"] > data["friction_energy_without_spin"],
"spin should increase friction energy")
require(data["roller_torque_with_spin"] > 0.0, "roller torque should be positive")
require(data["mean_pressure"] > 1.0e5, "mean pressure should be nonzero")
with history.open(newline="") as handle:
rows = list(csv.DictReader(handle))
require(len(rows) == 6, "history should have one row per sample")
for row in rows:
require(float(row["traction_with_spin"]) > float(row["traction_without_spin"]),
"each sample should show spin-dependent traction")
require(float(row["friction_energy_with_spin"]) >= 0.0,
"friction energy must be nonnegative")
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,103 @@
from __future__ import annotations
import csv
import subprocess
import sys
from pathlib import Path
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 require(condition: bool, message: str) -> None:
if not condition:
raise AssertionError(message)
def main() -> int:
if len(sys.argv) != 3:
raise SystemExit("usage: check_springback_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 / "roll_forming_springback_benchmark.inp"
text = inp.read_text(encoding="utf-8")
require("*ROLL FORMING SPRINGBACK" in text, "missing springback block")
tool = build_dir / "roll_forming_springback_benchmark.exe"
if not tool.exists():
tool = build_dir / "roll_forming_springback_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 = out_dir / "springback_summary.csv"
history = out_dir / "springback_history.csv"
zone = out_dir / "plastic_zone.csv"
require(summary.exists(), "summary output missing")
require(history.exists(), "history output missing")
require(zone.exists(), "plastic zone output missing")
require(summary.stat().st_size > 0, "summary output empty")
require(history.stat().st_size > 0, "history output empty")
require(zone.stat().st_size > 0, "plastic zone output empty")
data = read_key_values(summary)
require(int(data["samples"]) == 8, "unexpected sample count")
require(int(data["total_points"]) == 81, "unexpected material point count")
require(data["forming_force"] > 1.0e4, "forming force too small")
require(data["forming_force"] < 3.0e4, "forming force too large")
require(data["plastic_work"] > 0.0, "plastic work must be positive")
require(data["friction_energy"] > 0.0, "friction energy must be positive")
require(data["active_plastic_points"] > 0, "plastic zone did not activate")
require(0.20 <= data["plastic_zone_fraction"] <= 1.0,
"plastic zone fraction outside expected range")
require(data["max_eqps"] > 1.0e-4, "equivalent plastic strain too small")
require(data["release_curvature"] > 0.0, "release curvature must be positive")
require(data["residual_curvature"] > 0.0, "residual curvature must be positive")
require(data["formed_displacement"] > data["residual_displacement"],
"springback should reduce displacement")
require(data["residual_displacement"] > 0.0,
"residual displacement should remain positive")
require(0.05 < data["springback_ratio"] < 0.95,
"springback ratio outside expected range")
require(abs(data["residual_moment"]) <= max(1.0, data["peak_moment"]) * 1.0e-6,
"unloaded residual moment is too large")
with history.open(newline="") as handle:
rows = list(csv.DictReader(handle))
require(len(rows) == 8, "history should have one row per forming sample")
require(float(rows[-1]["plastic_work"]) >= data["plastic_work"] * 0.99,
"history plastic work did not reach summary value")
with zone.open(newline="") as handle:
points = list(csv.DictReader(handle))
require(len(points) == 81, "plastic zone should cover all material points")
active = [row for row in points if int(row["active"]) == 1]
require(len(active) == int(data["active_plastic_points"]),
"active plastic point count mismatch")
require(max(float(row["eqps"]) for row in active) >= data["max_eqps"] * 0.99,
"plastic zone max eqps mismatch")
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,6 @@
*HEADING
FemLite roller kinematics benchmark for V5.6 roll forming
**
** radius, normal_force, mu, feed_rate, down_rate, angular_speed, reference_speed, duration, samples
*ROLLER KINEMATICS
0.050, 1000.0, 0.30, 0.20, -0.01, 4.0, 0.20, 1.0, 6
@@ -0,0 +1,7 @@
** FemLite V5.6 roll forming plastic springback benchmark.
** thickness, half_width, strips, layers, length, radius,
** feed_total, down_total, angular_speed, normal_force, mu,
** reference_speed, duration, E, nu, yield, hardening,
** target_curvature, samples
*ROLL FORMING SPRINGBACK
0.004, 0.030, 9, 9, 0.20, 0.05, 0.20, -0.002, 4.0, 20000.0, 0.30, 0.20, 1.0, 210000.0, 0.30, 250.0, 10000.0, 3.0, 8
+38 -1
View File
@@ -1,3 +1,40 @@
@echo off
call "%~dp0..\run_example_case.bat" "%~dp0" "roll_forming" "--run" "roll_forming_friction_smoke.inp" "10"
rem FemLite roll forming smoke, roller kinematics and springback 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%" "roll_forming" "--run" "roll_forming_friction_smoke.inp" "10"
if errorlevel 1 exit /b %errorlevel%
set "TOOL=%BUILD_DIR%\roll_forming_kinematics_benchmark.exe"
set "INP=%CASE_DIR%roll_forming_kinematics_benchmark.inp"
set "OUT_DIR=%CASE_DIR%results\roller_kinematics"
if not exist "%OUT_DIR%" mkdir "%OUT_DIR%"
del /Q "%OUT_DIR%\roller_kinematics_*.csv" 2>nul
if not exist "%TOOL%" (
echo Building roll_forming_kinematics_benchmark...
cmake --build "%BUILD_DIR%" --config Release --target roll_forming_kinematics_benchmark
if errorlevel 1 exit /b %errorlevel%
)
"%TOOL%" "%INP%" "%OUT_DIR%"
if errorlevel 1 exit /b %errorlevel%
set "TOOL=%BUILD_DIR%\roll_forming_springback_benchmark.exe"
set "INP=%CASE_DIR%roll_forming_springback_benchmark.inp"
set "OUT_DIR=%CASE_DIR%results\springback"
if not exist "%OUT_DIR%" mkdir "%OUT_DIR%"
del /Q "%OUT_DIR%\springback_*.csv" 2>nul
del /Q "%OUT_DIR%\plastic_zone.csv" 2>nul
if not exist "%TOOL%" (
echo Building roll_forming_springback_benchmark...
cmake --build "%BUILD_DIR%" --config Release --target roll_forming_springback_benchmark
if errorlevel 1 exit /b %errorlevel%
)
"%TOOL%" "%INP%" "%OUT_DIR%"
exit /b %errorlevel%