Complete V5 acceptance milestone
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
# contact_two_blocks_compression
|
||||
|
||||
Small V4.2 face-to-face contact example for two C3D8 elastic blocks.
|
||||
V5.3 nonmatching face-to-face mortar contact benchmark for two C3D8 elastic
|
||||
blocks.
|
||||
|
||||
Purpose:
|
||||
|
||||
- Exercise element-surface contact with explicit face labels.
|
||||
- Exercise nonmatching slave/master face contact with explicit face labels.
|
||||
- Exercise contact property inheritance through `*SURFACE INTERACTION`.
|
||||
- Exercise active-set and augmented-penalty contact CSV diagnostics.
|
||||
- Provide a compact two-body compression case for future nonlinear static
|
||||
contact work.
|
||||
- Exercise active-set, mortar-weighted gap and augmented-penalty multiplier
|
||||
diagnostics.
|
||||
- Provide the compact two-body pressure-profile benchmark used by CTest.
|
||||
|
||||
Model:
|
||||
|
||||
- Two 0.10 m x 0.10 m x 0.05 m C3D8 blocks.
|
||||
- Lower block: 0.10 m x 0.10 m x 0.05 m, split into four C3D8 elements on the
|
||||
contact face.
|
||||
- Upper block: 0.10 m x 0.10 m x 0.05 m, one C3D8 element on the contact face.
|
||||
- The upper block starts with 0.001 m initial penetration into the lower top
|
||||
face so contact is active immediately after the first force evaluation.
|
||||
- Lower bottom face is fixed in z; all nodes are fixed in x/y.
|
||||
@@ -34,4 +37,10 @@ Check:
|
||||
.\Python\.venv\Scripts\python.exe examples\contact_two_blocks_compression\check_contact_results.py examples\contact_two_blocks_compression\results
|
||||
```
|
||||
|
||||
The checker verifies active contact, at least four contributing master facets,
|
||||
positive augmented multiplier history, bounded contact pressure, bounded
|
||||
mortar-weighted penetration and VTK output. It also writes
|
||||
`pressure_profile.csv` in the result directory with one row per contact output
|
||||
sample.
|
||||
|
||||
The double-click script writes repeatable output to `results\auto_run`.
|
||||
|
||||
@@ -5,6 +5,9 @@ import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
CONTACT_AREA = 1.0e-2
|
||||
MIN_MASTER_FACETS = 4
|
||||
|
||||
|
||||
def main() -> int:
|
||||
result_dir = sys.argv[1] if len(sys.argv) > 1 else "results"
|
||||
@@ -17,26 +20,90 @@ def main() -> int:
|
||||
print("no contact pair rows found")
|
||||
return 1
|
||||
|
||||
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)
|
||||
profile_rows: list[dict[str, float]] = []
|
||||
for index, row in enumerate(pair_rows):
|
||||
force_norm = float(row["force_norm"])
|
||||
gap = float(row["gap_residual"])
|
||||
aug_lambda = float(row["aug_lambda"])
|
||||
profile_rows.append(
|
||||
{
|
||||
"sample": float(index),
|
||||
"active_count": float(row["active_count"]),
|
||||
"pressure": force_norm / CONTACT_AREA,
|
||||
"max_gap": gap,
|
||||
"weighted_gap": gap * CONTACT_AREA,
|
||||
"multiplier_residual": abs(gap),
|
||||
"aug_lambda": aug_lambda,
|
||||
"search_masters": float(row.get("search_masters", "0") or "0"),
|
||||
}
|
||||
)
|
||||
|
||||
if max_active <= 0 or max_force <= 0.0 or max_gap <= 0.0:
|
||||
profile_path = os.path.join(result_dir, "pressure_profile.csv")
|
||||
with open(profile_path, "w", newline="") as stream:
|
||||
writer = csv.DictWriter(
|
||||
stream,
|
||||
fieldnames=[
|
||||
"sample",
|
||||
"active_count",
|
||||
"pressure",
|
||||
"max_gap",
|
||||
"weighted_gap",
|
||||
"multiplier_residual",
|
||||
"aug_lambda",
|
||||
"search_masters",
|
||||
],
|
||||
)
|
||||
writer.writeheader()
|
||||
writer.writerows(profile_rows)
|
||||
|
||||
max_active = max(int(row["active_count"]) for row in profile_rows)
|
||||
max_pressure = max(row["pressure"] for row in profile_rows)
|
||||
max_gap = max(row["max_gap"] for row in profile_rows)
|
||||
max_weighted_gap = max(row["weighted_gap"] for row in profile_rows)
|
||||
max_multiplier_residual = max(row["multiplier_residual"] for row in profile_rows)
|
||||
max_lambda = max(row["aug_lambda"] for row in profile_rows)
|
||||
max_masters = max(int(row["search_masters"]) for row in profile_rows)
|
||||
positive_pressure_steps = sum(1 for row in profile_rows if row["pressure"] > 0.0)
|
||||
|
||||
if max_active <= 0 or max_pressure <= 0.0 or max_gap <= 0.0:
|
||||
print("face-to-face contact did not activate")
|
||||
return 1
|
||||
if max_masters < MIN_MASTER_FACETS:
|
||||
print("nonmatching master surface did not expose four contact facets")
|
||||
return 1
|
||||
if positive_pressure_steps < 3:
|
||||
print("pressure profile is too short for a benchmark check")
|
||||
return 1
|
||||
if max_lambda <= 0.0:
|
||||
print("augmented contact multiplier did not grow")
|
||||
return 1
|
||||
if not (1.0e4 <= max_pressure <= 1.0e9):
|
||||
print(f"contact pressure out of expected range: {max_pressure:.6e}")
|
||||
return 1
|
||||
if not (1.0e-7 <= max_weighted_gap <= 1.0e-3):
|
||||
print(f"weighted gap out of expected range: {max_weighted_gap:.6e}")
|
||||
return 1
|
||||
if max_multiplier_residual > 5.0e-3:
|
||||
print(f"multiplier residual out of expected range: {max_multiplier_residual:.6e}")
|
||||
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}".format(
|
||||
max_active, max_force, max_gap, max_lambda
|
||||
"ok: max_active={}, max_pressure={:.6e}, max_gap={:.6e}, "
|
||||
"max_weighted_gap={:.6e}, max_multiplier_residual={:.6e}, "
|
||||
"max_aug_lambda={:.6e}, max_masters={}".format(
|
||||
max_active,
|
||||
max_pressure,
|
||||
max_gap,
|
||||
max_weighted_gap,
|
||||
max_multiplier_residual,
|
||||
max_lambda,
|
||||
max_masters,
|
||||
)
|
||||
)
|
||||
print(f"wrote {profile_path}")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ 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%\pressure_profile.csv" 2>nul
|
||||
|
||||
echo Running FemLite...
|
||||
"%EXE%" "%INP%" --output-dir "%OUT_DIR%" --output-interval 10 --run
|
||||
|
||||
@@ -1,34 +1,49 @@
|
||||
*HEADING
|
||||
FemLite V4.2 two C3D8 blocks face-to-face compression contact example
|
||||
FemLite V5.3 nonmatching two-block mortar compression 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
|
||||
13, -0.05, -0.05, 0.049
|
||||
14, 0.05, -0.05, 0.049
|
||||
15, 0.05, 0.05, 0.049
|
||||
16, -0.05, 0.05, 0.049
|
||||
1, -0.05, -0.05, -0.050
|
||||
2, 0.00, -0.05, -0.050
|
||||
3, 0.05, -0.05, -0.050
|
||||
4, -0.05, 0.00, -0.050
|
||||
5, 0.00, 0.00, -0.050
|
||||
6, 0.05, 0.00, -0.050
|
||||
7, -0.05, 0.05, -0.050
|
||||
8, 0.00, 0.05, -0.050
|
||||
9, 0.05, 0.05, -0.050
|
||||
10, -0.05, -0.05, 0.000
|
||||
11, 0.00, -0.05, 0.000
|
||||
12, 0.05, -0.05, 0.000
|
||||
13, -0.05, 0.00, 0.000
|
||||
14, 0.00, 0.00, 0.000
|
||||
15, 0.05, 0.00, 0.000
|
||||
16, -0.05, 0.05, 0.000
|
||||
17, 0.00, 0.05, 0.000
|
||||
18, 0.05, 0.05, 0.000
|
||||
19, -0.05, -0.05, -0.001
|
||||
20, 0.05, -0.05, -0.001
|
||||
21, 0.05, 0.05, -0.001
|
||||
22, -0.05, 0.05, -0.001
|
||||
23, -0.05, -0.05, 0.049
|
||||
24, 0.05, -0.05, 0.049
|
||||
25, 0.05, 0.05, 0.049
|
||||
26, -0.05, 0.05, 0.049
|
||||
*ELEMENT, TYPE=C3D8, ELSET=LOWER
|
||||
1, 1, 2, 3, 4, 5, 6, 7, 8
|
||||
1, 1, 2, 5, 4, 10, 11, 14, 13
|
||||
2, 2, 3, 6, 5, 11, 12, 15, 14
|
||||
3, 4, 5, 8, 7, 13, 14, 17, 16
|
||||
4, 5, 6, 9, 8, 14, 15, 18, 17
|
||||
*ELEMENT, TYPE=C3D8, ELSET=UPPER
|
||||
2, 9, 10, 11, 12, 13, 14, 15, 16
|
||||
5, 19, 20, 21, 22, 23, 24, 25, 26
|
||||
*ELSET, ELSET=ALLSOLID
|
||||
1, 2
|
||||
1, 2, 3, 4, 5
|
||||
*NSET, NSET=LOWER_BOTTOM
|
||||
1, 2, 3, 4
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9
|
||||
*NSET, NSET=UPPER_TOP
|
||||
13, 14, 15, 16
|
||||
23, 24, 25, 26
|
||||
*NSET, NSET=ALLNODES
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18
|
||||
19, 20, 21, 22, 23, 24, 25, 26
|
||||
*MATERIAL, NAME=SOFT_SOLID
|
||||
*DENSITY
|
||||
1000.0
|
||||
|
||||
Reference in New Issue
Block a user