Complete V5 acceptance milestone
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# shell_solid_contact
|
||||
|
||||
V5.3 shell-solid mortar contact benchmark.
|
||||
|
||||
Purpose:
|
||||
|
||||
- Exercise S4 shell slave contact against a C3D8 solid master face.
|
||||
- Verify active contact, gap residual, augmented multiplier and VTK output for
|
||||
a shell-to-solid pair.
|
||||
- Provide the shell-solid coverage item used by the V5.3 contact CTest matrix.
|
||||
|
||||
Model:
|
||||
|
||||
- Fixed C3D8 block with its top face as the master surface.
|
||||
- S4 shell patch starts 0.001 m above the solid top face and is prescribed a
|
||||
downward displacement through the master face.
|
||||
- Contact property: penalty = 1.0E7, damping = 1.0E2, augment = 0.20.
|
||||
|
||||
Run from the repository root:
|
||||
|
||||
Double-click `run_case.bat` in this directory, or run manually:
|
||||
|
||||
```powershell
|
||||
New-Item -ItemType Directory -Force examples\shell_solid_contact\results | Out-Null
|
||||
build-win-gcc-16\femlite.exe examples\shell_solid_contact\shell_solid_contact.inp --output-dir examples\shell_solid_contact\results --output-interval 1 --run
|
||||
```
|
||||
|
||||
Check:
|
||||
|
||||
```powershell
|
||||
.\Python\.venv\Scripts\python.exe examples\shell_solid_contact\check_contact_results.py examples\shell_solid_contact\results
|
||||
```
|
||||
|
||||
The checker writes `shell_solid_contact_profile.csv` in the result directory.
|
||||
@@ -0,0 +1,78 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def read_pair_rows(result_dir: str) -> list[dict[str, str]]:
|
||||
rows: list[dict[str, str]] = []
|
||||
for path in sorted(glob.glob(os.path.join(result_dir, "contact_*.csv"))):
|
||||
with open(path, newline="") as stream:
|
||||
rows.extend(row for row in csv.DictReader(stream) if row["kind"] == "PAIR")
|
||||
return rows
|
||||
|
||||
|
||||
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
|
||||
|
||||
profile_path = os.path.join(result_dir, "shell_solid_contact_profile.csv")
|
||||
with open(profile_path, "w", newline="") as stream:
|
||||
fieldnames = [
|
||||
"sample",
|
||||
"active_count",
|
||||
"force_norm",
|
||||
"gap_residual",
|
||||
"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"]),
|
||||
"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_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-solid contact did not activate")
|
||||
return 1
|
||||
if max_masters <= 0:
|
||||
print("shell-solid contact did not search a solid master facet")
|
||||
return 1
|
||||
if max_lambda <= 0.0:
|
||||
print("shell-solid augmented multiplier did not grow")
|
||||
return 1
|
||||
if not glob.glob(os.path.join(result_dir, "result_*.vtk")):
|
||||
print("no VTK 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%\build-win-gcc-16\femlite.exe"
|
||||
set "PYTHON=%ROOT_DIR%\Python\.venv\Scripts\python.exe"
|
||||
set "INP=%CASE_DIR%shell_solid_contact.inp"
|
||||
set "OUT_DIR=%CASE_DIR%results\auto_run"
|
||||
|
||||
echo FemLite shell_solid_contact
|
||||
echo.
|
||||
|
||||
if not exist "%EXE%" (
|
||||
echo femlite.exe was not found. Trying to build build-win-gcc-16...
|
||||
cmake --build "%ROOT_DIR%\build-win-gcc-16" --config Release
|
||||
if errorlevel 1 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_*.vtk" 2>nul
|
||||
del /Q "%OUT_DIR%\shell_solid_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,57 @@
|
||||
*HEADING
|
||||
FemLite V5.3 shell-solid mortar contact benchmark
|
||||
*NODE
|
||||
1, -0.05, -0.05, -0.050
|
||||
2, 0.05, -0.05, -0.050
|
||||
3, 0.05, 0.05, -0.050
|
||||
4, -0.05, 0.05, -0.050
|
||||
5, -0.05, -0.05, 0.000
|
||||
6, 0.05, -0.05, 0.000
|
||||
7, 0.05, 0.05, 0.000
|
||||
8, -0.05, 0.05, 0.000
|
||||
9, -0.05, -0.05, 0.001
|
||||
10, 0.05, -0.05, 0.001
|
||||
11, 0.05, 0.05, 0.001
|
||||
12, -0.05, 0.05, 0.001
|
||||
*ELEMENT, TYPE=C3D8, ELSET=SOLID_BLOCK
|
||||
1, 1, 2, 3, 4, 5, 6, 7, 8
|
||||
*ELEMENT, TYPE=S4, ELSET=SHELL_PATCH
|
||||
2, 9, 10, 11, 12
|
||||
*ELSET, ELSET=ALL_SOLID
|
||||
1
|
||||
*NSET, NSET=SOLID_ALL
|
||||
1, 2, 3, 4, 5, 6, 7, 8
|
||||
*NSET, NSET=SHELL_ALL
|
||||
9, 10, 11, 12
|
||||
*MATERIAL, NAME=SOLID_MAT
|
||||
*DENSITY
|
||||
1000.0
|
||||
*ELASTIC
|
||||
1.0E7, 0.30
|
||||
*MATERIAL, NAME=SHELL_MAT
|
||||
*DENSITY
|
||||
1000.0
|
||||
*ELASTIC
|
||||
1.0E7, 0.30
|
||||
*SOLID SECTION, ELSET=ALL_SOLID, MATERIAL=SOLID_MAT
|
||||
*SHELL SECTION, ELSET=SHELL_PATCH, MATERIAL=SHELL_MAT
|
||||
2.0E-3
|
||||
*AMPLITUDE, NAME=RAMP
|
||||
0.0, 0.0, 1.0E-4, 1.0
|
||||
*BOUNDARY
|
||||
SOLID_ALL, 1, 3, 0.0
|
||||
SHELL_ALL, 1, 2, 0.0
|
||||
SHELL_ALL, 4, 6, 0.0
|
||||
*BOUNDARY, AMPLITUDE=RAMP
|
||||
SHELL_ALL, 3, 3, -2.0E-3
|
||||
*SURFACE, NAME=SOLID_TOP, TYPE=ELEMENT
|
||||
SOLID_BLOCK, S2
|
||||
*SURFACE, NAME=SHELL_BOTTOM, TYPE=ELEMENT
|
||||
SHELL_PATCH, SPOS
|
||||
*SURFACE INTERACTION, NAME=SHELL_SOLID_CONTACT, PENALTY=1.0E7, DAMPING=1.0E2, SEARCH=1.0E-2, AUGMENT=0.20
|
||||
*CONTACT PAIR, INTERACTION=SHELL_SOLID_CONTACT
|
||||
SHELL_BOTTOM, SOLID_TOP
|
||||
*STEP
|
||||
*DYNAMIC
|
||||
1.0E-5, 1.0E-4
|
||||
*END STEP
|
||||
Reference in New Issue
Block a user