Track external solver packages
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# 壳-壳接触 benchmark
|
||||
|
||||
文档状态:0.6.3 文档整理稿
|
||||
|
||||
## 用途
|
||||
|
||||
本目录保存 FemLite 示例或 benchmark:`shell_shell_contact`。它用于验证指定模型、算法路径或输出检查器,不代表所有相近工程问题都已完整生产化。
|
||||
|
||||
## 主要输入文件
|
||||
|
||||
System.Object[]
|
||||
|
||||
## 运行方式
|
||||
|
||||
- Windows 下可双击或执行 `run_case.bat`。
|
||||
- 若该示例已接入 CTest,优先使用项目测试计划中记录的 CTest 名称运行。
|
||||
- 运行前请先完成项目编译。
|
||||
|
||||
## 检查脚本
|
||||
|
||||
System.Object[]
|
||||
|
||||
## 结果文件
|
||||
|
||||
- 结果通常写入 `results`、`results/auto_run` 或命令指定的输出目录。
|
||||
- 不要提交全量 CSV、VTU/PVD、restart、临时网格或缓存文件。
|
||||
- 如需保留参考结果,只保留小型 summary、profile 或 checker 需要的抽样数据。
|
||||
|
||||
## 边界
|
||||
|
||||
- 示例和 benchmark 是受控验收入口,不等同于完整工业级流程。
|
||||
- 若修改输入、checker 或参考容差,应同步更新 `docs/11_benchmark_matrix.md`。
|
||||
@@ -0,0 +1,149 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||
from contact_schema import read_pair_rows, require_pair_schema
|
||||
|
||||
|
||||
def main() -> int:
|
||||
result_dir = sys.argv[1] if len(sys.argv) > 1 else "results"
|
||||
pair_rows = read_pair_rows(result_dir)
|
||||
if not pair_rows:
|
||||
print("no contact pair rows found")
|
||||
return 1
|
||||
if len(pair_rows) < 2:
|
||||
print("shell-shell contact diagnostic path is too short")
|
||||
return 1
|
||||
if not require_pair_schema(pair_rows):
|
||||
return 1
|
||||
|
||||
profile_path = os.path.join(result_dir, "shell_shell_contact_profile.csv")
|
||||
with open(profile_path, "w", newline="") as stream:
|
||||
fieldnames = [
|
||||
"sample",
|
||||
"active_count",
|
||||
"force_norm",
|
||||
"gap_residual",
|
||||
"gap_l2",
|
||||
"failed_projection_count",
|
||||
"active_set_flip_count",
|
||||
"open_count",
|
||||
"closed_stick_count",
|
||||
"closed_slip_count",
|
||||
"closed_restick_count",
|
||||
"separating_count",
|
||||
"state_failed_projection_count",
|
||||
"status",
|
||||
"activation_count",
|
||||
"release_count",
|
||||
"aug_factor",
|
||||
"aug_lambda",
|
||||
"search_masters",
|
||||
]
|
||||
writer = csv.DictWriter(stream, fieldnames=fieldnames)
|
||||
writer.writeheader()
|
||||
for index, row in enumerate(pair_rows):
|
||||
writer.writerow(
|
||||
{
|
||||
"sample": index,
|
||||
"active_count": int(float(row["active_count"])),
|
||||
"force_norm": float(row["force_norm"]),
|
||||
"gap_residual": float(row["gap_residual"]),
|
||||
"gap_l2": float(row["gap_l2"]),
|
||||
"failed_projection_count": int(float(row["failed_projection_count"])),
|
||||
"active_set_flip_count": int(float(row["active_set_flip_count"])),
|
||||
"open_count": int(float(row["open_count"])),
|
||||
"closed_stick_count": int(float(row["closed_stick_count"])),
|
||||
"closed_slip_count": int(float(row["closed_slip_count"])),
|
||||
"closed_restick_count": int(float(row["closed_restick_count"])),
|
||||
"separating_count": int(float(row["separating_count"])),
|
||||
"state_failed_projection_count": int(
|
||||
float(row["state_failed_projection_count"])
|
||||
),
|
||||
"status": int(float(row["status"])),
|
||||
"activation_count": int(float(row["activation_count"])),
|
||||
"release_count": int(float(row["release_count"])),
|
||||
"aug_factor": float(row["aug_factor"]),
|
||||
"aug_lambda": float(row["aug_lambda"]),
|
||||
"search_masters": int(float(row.get("search_masters", "0") or "0")),
|
||||
}
|
||||
)
|
||||
|
||||
max_active = max(int(float(row["active_count"])) for row in pair_rows)
|
||||
max_force = max(float(row["force_norm"]) for row in pair_rows)
|
||||
max_gap = max(float(row["gap_residual"]) for row in pair_rows)
|
||||
max_gap_l2 = max(float(row["gap_l2"]) for row in pair_rows)
|
||||
max_failed_projection = max(int(float(row["failed_projection_count"])) for row in pair_rows)
|
||||
max_state_failed_projection = max(
|
||||
int(float(row["state_failed_projection_count"])) for row in pair_rows
|
||||
)
|
||||
max_closed_state = max(
|
||||
int(float(row["closed_stick_count"]))
|
||||
+ int(float(row["closed_slip_count"]))
|
||||
+ int(float(row["closed_restick_count"]))
|
||||
for row in pair_rows
|
||||
)
|
||||
max_aug_factor = max(float(row["aug_factor"]) for row in pair_rows)
|
||||
max_lambda = max(float(row["aug_lambda"]) for row in pair_rows)
|
||||
max_masters = max(int(float(row.get("search_masters", "0") or "0")) for row in pair_rows)
|
||||
|
||||
if max_active <= 0 or max_force <= 0.0 or max_gap <= 0.0:
|
||||
print("shell-shell contact did not activate")
|
||||
return 1
|
||||
if max_masters <= 0:
|
||||
print("shell-shell contact did not search a master shell facet")
|
||||
return 1
|
||||
if max_gap_l2 < max_gap:
|
||||
print("shell-shell gap L2 diagnostic is inconsistent")
|
||||
return 1
|
||||
if max_failed_projection != 0:
|
||||
print(f"unexpected shell-shell failed projection count: {max_failed_projection}")
|
||||
return 1
|
||||
if max_state_failed_projection != 0:
|
||||
print(f"unexpected shell-shell failed projection state: {max_state_failed_projection}")
|
||||
return 1
|
||||
if max_closed_state <= 0:
|
||||
print("shell-shell closed state counters were not reported")
|
||||
return 1
|
||||
if any(
|
||||
int(float(row["open_count"]))
|
||||
+ int(float(row["closed_stick_count"]))
|
||||
+ int(float(row["closed_slip_count"]))
|
||||
+ int(float(row["closed_restick_count"]))
|
||||
+ int(float(row["separating_count"]))
|
||||
+ int(float(row["state_failed_projection_count"]))
|
||||
!= 1
|
||||
for row in pair_rows
|
||||
):
|
||||
print("shell-shell state counters do not describe exactly one pair state")
|
||||
return 1
|
||||
if any(
|
||||
int(float(row["active_set_flip_count"]))
|
||||
< int(float(row["activation_count"])) + int(float(row["release_count"]))
|
||||
for row in pair_rows
|
||||
):
|
||||
print("shell-shell active-set flip diagnostic is inconsistent")
|
||||
return 1
|
||||
if max_aug_factor <= 0.0 or max_lambda <= 0.0:
|
||||
print("shell-shell augmented multiplier did not grow")
|
||||
return 1
|
||||
if not glob.glob(os.path.join(result_dir, "result_*.vtu")):
|
||||
print("no VTU output found")
|
||||
return 1
|
||||
|
||||
print(
|
||||
"ok: max_active={}, max_force={:.6e}, max_gap={:.6e}, "
|
||||
"max_aug_lambda={:.6e}, max_masters={}".format(
|
||||
max_active, max_force, max_gap, max_lambda, max_masters
|
||||
)
|
||||
)
|
||||
print(f"wrote {profile_path}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,52 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "CASE_DIR=%~dp0"
|
||||
set "ROOT_DIR=%CASE_DIR%..\.."
|
||||
set "EXE=%ROOT_DIR%\cpu_release\bin\femlite.exe"
|
||||
set "PYTHON=%ROOT_DIR%\..\Python\.venv\Scripts\python.exe"
|
||||
set "INP=%CASE_DIR%shell_shell_contact.inp"
|
||||
set "OUT_DIR=%CASE_DIR%results\auto_run"
|
||||
|
||||
echo FemLite shell_shell_contact
|
||||
echo.
|
||||
|
||||
if not exist "%EXE%" (
|
||||
echo femlite.exe was not found: "%EXE%"
|
||||
goto fail
|
||||
)
|
||||
|
||||
if not exist "%OUT_DIR%" mkdir "%OUT_DIR%"
|
||||
del /Q "%OUT_DIR%\history.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\nodes_*.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\elements_*.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\reactions_*.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\contact_*.csv" 2>nul
|
||||
del /Q "%OUT_DIR%\result_*.vtu" 2>nul
|
||||
del /Q "%OUT_DIR%\results.pvd" 2>nul
|
||||
del /Q "%OUT_DIR%\shell_shell_contact_profile.csv" 2>nul
|
||||
|
||||
echo Running FemLite...
|
||||
"%EXE%" "%INP%" --output-dir "%OUT_DIR%" --output-interval 1 --run
|
||||
if errorlevel 1 goto fail
|
||||
|
||||
if exist "%PYTHON%" (
|
||||
echo.
|
||||
echo Checking results...
|
||||
"%PYTHON%" "%CASE_DIR%check_contact_results.py" "%OUT_DIR%"
|
||||
if errorlevel 1 goto fail
|
||||
) else (
|
||||
echo.
|
||||
echo Python virtual environment not found; skipping result checker.
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Case completed successfully.
|
||||
if not "%FEMLITE_NO_PAUSE%"=="1" pause
|
||||
exit /b 0
|
||||
|
||||
:fail
|
||||
echo.
|
||||
echo Case failed.
|
||||
if not "%FEMLITE_NO_PAUSE%"=="1" pause
|
||||
exit /b 1
|
||||
@@ -0,0 +1,41 @@
|
||||
*HEADING
|
||||
FemLite V5.3 shell-shell mortar contact benchmark
|
||||
*NODE
|
||||
1, -0.05, -0.05, 0.000
|
||||
2, 0.05, -0.05, 0.000
|
||||
3, 0.05, 0.05, 0.000
|
||||
4, -0.05, 0.05, 0.000
|
||||
5, -0.05, -0.05, -0.001
|
||||
6, 0.05, -0.05, -0.001
|
||||
7, 0.05, 0.05, -0.001
|
||||
8, -0.05, 0.05, -0.001
|
||||
*ELEMENT, TYPE=S4, ELSET=LOWER_SHELL
|
||||
1, 1, 2, 3, 4
|
||||
*ELEMENT, TYPE=S4, ELSET=UPPER_SHELL
|
||||
2, 5, 6, 7, 8
|
||||
*NSET, NSET=LOWER_ALL
|
||||
1, 2, 3, 4
|
||||
*NSET, NSET=UPPER_ALL
|
||||
5, 6, 7, 8
|
||||
*MATERIAL, NAME=SHELL_MAT
|
||||
*DENSITY
|
||||
1000.0
|
||||
*ELASTIC
|
||||
1.0E7, 0.30
|
||||
*SHELL SECTION, ELSET=LOWER_SHELL, MATERIAL=SHELL_MAT
|
||||
2.0E-3
|
||||
*SHELL SECTION, ELSET=UPPER_SHELL, MATERIAL=SHELL_MAT
|
||||
2.0E-3
|
||||
*AMPLITUDE, NAME=RAMP
|
||||
0.0, 0.0, 1.0E-4, 1.0
|
||||
*BOUNDARY
|
||||
LOWER_ALL, 1, 6, 0.0
|
||||
UPPER_ALL, 1, 2, 0.0
|
||||
UPPER_ALL, 4, 6, 0.0
|
||||
*BOUNDARY, AMPLITUDE=RAMP
|
||||
UPPER_ALL, 3, 3, -5.0E-4
|
||||
*CONTACT PAIR, SLAVE=UPPER_SHELL, MASTER=LOWER_SHELL, PENALTY=1.0E7, DAMPING=1.0E2, SEARCH=1.0E-2, AUGMENT=0.20
|
||||
*STEP
|
||||
*DYNAMIC
|
||||
1.0E-5, 1.0E-4
|
||||
*END STEP
|
||||
Reference in New Issue
Block a user