Release FemLite 0.5.3
FemLite CI / build-test (push) Has been cancelled

This commit is contained in:
shenw
2026-07-01 18:39:18 +08:00
parent 75d4e735b1
commit 2b7962eb96
51 changed files with 3084 additions and 2175 deletions
+6
View File
@@ -45,3 +45,9 @@ The checker verifies active contact on multiple candidates, four available
master facets, accumulated sliding, stick/slip counters, positive frictional
work, nonzero tangential force and VTK output. It also writes
`sliding_profile.csv` in the result directory for benchmark inspection.
0.5.3 diagnostic checks also consume contact state/status fields,
activation/release counts, active-set flip count, gap L2, failed projection
count, augmentation factor/lambda, slip increment/residual and friction
residual fields. These checks are diagnostic guards, not a retuning of the
friction law.
@@ -26,9 +26,19 @@ def write_sliding_profile(result_dir: str, rows: list[dict[str, str]]) -> str:
"stick_count",
"slip_count",
"accumulated_slip",
"slip_increment_norm",
"slip_residual",
"friction_work_total",
"friction_residual",
"tangential_force",
"status",
"activation_count",
"release_count",
"gap_residual",
"gap_l2",
"failed_projection_count",
"active_set_flip_count",
"aug_factor",
"aug_lambda",
"search_masters",
"search_active",
@@ -47,9 +57,19 @@ def write_sliding_profile(result_dir: str, rows: list[dict[str, str]]) -> str:
"stick_count": int(float(row["stick_count"])),
"slip_count": int(float(row["slip_count"])),
"accumulated_slip": float(row["accumulated_slip"]),
"slip_increment_norm": float(row["slip_increment_norm"]),
"slip_residual": float(row["slip_residual"]),
"friction_work_total": float(row["friction_work_total"]),
"friction_residual": float(row["friction_residual"]),
"tangential_force": (ftx * ftx + fty * fty + ftz * ftz) ** 0.5,
"status": int(float(row["status"])),
"activation_count": int(float(row["activation_count"])),
"release_count": int(float(row["release_count"])),
"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"])),
"aug_factor": float(row["aug_factor"]),
"aug_lambda": float(row["aug_lambda"]),
"search_masters": int(float(row.get("search_masters", "0") or "0")),
"search_active": int(float(row.get("search_active", "0") or "0")),
@@ -70,6 +90,8 @@ def main() -> int:
max_stick_count = max(int(float(row["stick_count"])) for row in pair_rows)
max_slip_count = max(int(float(row["slip_count"])) for row in pair_rows)
max_slip = max(float(row["accumulated_slip"]) for row in pair_rows)
max_slip_increment = max(float(row["slip_increment_norm"]) for row in pair_rows)
max_slip_residual = max(float(row["slip_residual"]) for row in pair_rows)
max_fric_work = max(float(row["friction_work_total"]) for row in pair_rows)
min_fric_work = min(float(row["friction_work_total"]) for row in pair_rows)
max_ft = max(
@@ -82,6 +104,12 @@ def main() -> int:
for row in pair_rows
)
max_reg = max(float(row["friction_regularization"]) for row in pair_rows)
max_friction_residual = max(float(row["friction_residual"]) 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_aug_factor = max(float(row["aug_factor"]) for row in pair_rows)
max_aug_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)
max_search_active = max(int(float(row.get("search_active", "0") or "0")) for row in pair_rows)
@@ -100,6 +128,28 @@ def main() -> int:
if max_slip < MIN_ACCUMULATED_SLIP or max_ft <= 0.0:
print("frictional sliding response was not detected")
return 1
if max_slip_increment < max_slip or max_slip_residual <= 0.0:
print("slip residual diagnostics were not reported")
return 1
if max_friction_residual <= 0.0:
print("friction residual diagnostic was not reported")
return 1
if max_gap <= 0.0 or max_gap_l2 < max_gap:
print("gap residual diagnostics were not reported consistently")
return 1
if max_failed_projection != 0:
print(f"unexpected failed projection count: {max_failed_projection}")
return 1
if max_aug_factor <= 0.0 or max_aug_lambda <= 0.0:
print("augmentation diagnostics were not reported")
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("active-set flip diagnostic is inconsistent")
return 1
if max_slip_count <= 0 or max_stick_count <= 0:
print("stick/slip transition counters were not reported")
return 1
@@ -43,4 +43,10 @@ mortar-weighted penetration and VTK output. It also writes
`pressure_profile.csv` in the result directory with one row per contact output
sample.
0.5.3 diagnostic checks also consume contact state/status fields, activation
and release counts, active-set flip count, augmentation factor/lambda,
failed projection count, mean gap and L2 gap. The numerical checks emphasize
existence, sign, boundedness and internal consistency rather than exact
large-path nonlinear matching.
The double-click script writes repeatable output to `results\auto_run`.
@@ -24,15 +24,31 @@ def main() -> int:
for index, row in enumerate(pair_rows):
force_norm = float(row["force_norm"])
gap = float(row["gap_residual"])
gap_mean = float(row["gap_mean"])
gap_l2 = float(row["gap_l2"])
failed_projection = int(float(row["failed_projection_count"]))
active_set_flip = int(float(row["active_set_flip_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"])
profile_rows.append(
{
"sample": float(index),
"active_count": float(row["active_count"]),
"status": float(status),
"activation_count": float(activation_count),
"release_count": float(release_count),
"pressure": force_norm / CONTACT_AREA,
"max_gap": gap,
"gap_mean": gap_mean,
"gap_l2": gap_l2,
"failed_projection_count": float(failed_projection),
"active_set_flip_count": float(active_set_flip),
"weighted_gap": gap * CONTACT_AREA,
"multiplier_residual": abs(gap),
"aug_factor": aug_factor,
"aug_lambda": aug_lambda,
"search_masters": float(row.get("search_masters", "0") or "0"),
}
@@ -45,10 +61,18 @@ def main() -> int:
fieldnames=[
"sample",
"active_count",
"status",
"activation_count",
"release_count",
"pressure",
"max_gap",
"gap_mean",
"gap_l2",
"failed_projection_count",
"active_set_flip_count",
"weighted_gap",
"multiplier_residual",
"aug_factor",
"aug_lambda",
"search_masters",
],
@@ -59,8 +83,13 @@ def main() -> int:
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_gap_l2 = max(row["gap_l2"] for row in profile_rows)
max_failed_projection = max(int(row["failed_projection_count"]) for row in profile_rows)
max_activation_count = max(int(row["activation_count"]) for row in profile_rows)
max_release_count = max(int(row["release_count"]) 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_aug_factor = max(row["aug_factor"] 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)
@@ -71,6 +100,22 @@ def main() -> int:
if max_masters < MIN_MASTER_FACETS:
print("nonmatching master surface did not expose four contact facets")
return 1
if max_gap_l2 < max_gap:
print("gap L2 diagnostic is inconsistent with max gap")
return 1
if max_failed_projection != 0:
print(f"unexpected failed projection count: {max_failed_projection}")
return 1
if any(
int(row["active_set_flip_count"])
< int(row["activation_count"]) + int(row["release_count"])
for row in profile_rows
):
print("active-set flip diagnostic is inconsistent")
return 1
if max_aug_factor <= 0.0:
print("augmentation factor was not reported")
return 1
if positive_pressure_steps < 3:
print("pressure profile is too short for a benchmark check")
return 1
+3
View File
@@ -32,3 +32,6 @@ Check:
```
The checker writes `shell_shell_contact_profile.csv` in the result directory.
In 0.5.3 it also validates shared contact diagnostics: state/status fields,
activation/release counts, active-set flip count, gap L2, failed projection
count and augmentation factor/lambda.
@@ -28,6 +28,13 @@ def main() -> int:
"active_count",
"force_norm",
"gap_residual",
"gap_l2",
"failed_projection_count",
"active_set_flip_count",
"status",
"activation_count",
"release_count",
"aug_factor",
"aug_lambda",
"search_masters",
]
@@ -40,6 +47,13 @@ def main() -> int:
"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"])),
"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")),
}
@@ -48,6 +62,9 @@ def main() -> int:
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_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)
@@ -57,7 +74,20 @@ def main() -> int:
if max_masters <= 0:
print("shell-shell contact did not search a master shell facet")
return 1
if max_lambda <= 0.0:
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 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_*.vtk")):
+3
View File
@@ -32,3 +32,6 @@ Check:
```
The checker writes `shell_solid_contact_profile.csv` in the result directory.
In 0.5.3 it also validates shared contact diagnostics: state/status fields,
activation/release counts, active-set flip count, gap L2, failed projection
count and augmentation factor/lambda.
@@ -28,6 +28,13 @@ def main() -> int:
"active_count",
"force_norm",
"gap_residual",
"gap_l2",
"failed_projection_count",
"active_set_flip_count",
"status",
"activation_count",
"release_count",
"aug_factor",
"aug_lambda",
"search_masters",
]
@@ -40,6 +47,13 @@ def main() -> int:
"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"])),
"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")),
}
@@ -48,6 +62,9 @@ def main() -> int:
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_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)
@@ -57,7 +74,20 @@ def main() -> int:
if max_masters <= 0:
print("shell-solid contact did not search a solid master facet")
return 1
if max_lambda <= 0.0:
if max_gap_l2 < max_gap:
print("shell-solid gap L2 diagnostic is inconsistent")
return 1
if max_failed_projection != 0:
print(f"unexpected shell-solid failed projection count: {max_failed_projection}")
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-solid active-set flip diagnostic is inconsistent")
return 1
if max_aug_factor <= 0.0 or 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")):
@@ -272,6 +272,12 @@ def collect_path_curve(
residual_norm = float(row["residual_norm"])
relative_residual = float(row["relative_residual"])
correction_norm = float(row["correction_norm"])
residual_total = float(row["residual_total"])
residual_force = float(row["residual_force"])
residual_contact = float(row["residual_contact"])
residual_constraint = float(row["residual_constraint"])
residual_arc = float(row["residual_arc"])
material_failures = int(row["material_failure_count"])
target_dt = float(row["target_dt"])
actual_dt = float(row["actual_dt"])
next_dt = float(row["next_dt"])
@@ -306,6 +312,14 @@ def collect_path_curve(
"accepted continuation row has negative trust_rejections")
require(residual_linf <= 1.0e-8, "crown constraint residual is too large")
require(residual_l2 <= 1.0e-8, "crown constraint residual norm is too large")
require(residual_total >= 0.0, "accepted row has negative total residual")
require(residual_force >= 0.0, "accepted row has negative force residual")
require(residual_contact >= 0.0, "accepted row has negative contact residual")
require(residual_constraint >= 0.0,
"accepted row has negative constraint residual")
require(residual_arc >= 0.0, "accepted row has negative arc residual")
require(material_failures >= 0,
"accepted row has negative material failure count")
require(abs(actual - prescribed) <= 1.0e-8 * max(1.0, prescribed),
"actual crown displacement differs from prescribed displacement")
@@ -326,6 +340,12 @@ def collect_path_curve(
"residual_norm": residual_norm,
"relative_residual": relative_residual,
"correction_norm": correction_norm,
"residual_total": residual_total,
"residual_force": residual_force,
"residual_contact": residual_contact,
"residual_constraint": residual_constraint,
"residual_arc": residual_arc,
"material_failure_count": float(material_failures),
"target_dt": target_dt,
"actual_dt": actual_dt,
"next_dt": next_dt,
@@ -408,6 +428,12 @@ def write_curve_csv(path: Path, records: list[dict[str, float]]) -> None:
"residual_norm",
"relative_residual",
"correction_norm",
"residual_total",
"residual_force",
"residual_contact",
"residual_constraint",
"residual_arc",
"material_failure_count",
"target_dt",
"actual_dt",
"next_dt",
@@ -436,6 +462,12 @@ def write_curve_csv(path: Path, records: list[dict[str, float]]) -> None:
"residual_norm": f"{record['residual_norm']:.10E}",
"relative_residual": f"{record['relative_residual']:.10E}",
"correction_norm": f"{record['correction_norm']:.10E}",
"residual_total": f"{record['residual_total']:.10E}",
"residual_force": f"{record['residual_force']:.10E}",
"residual_contact": f"{record['residual_contact']:.10E}",
"residual_constraint": f"{record['residual_constraint']:.10E}",
"residual_arc": f"{record['residual_arc']:.10E}",
"material_failure_count": int(record["material_failure_count"]),
"target_dt": f"{record['target_dt']:.10E}",
"actual_dt": f"{record['actual_dt']:.10E}",
"next_dt": f"{record['next_dt']:.10E}",
@@ -770,6 +802,12 @@ def main() -> int:
"residual_norm": 0.0,
"relative_residual": 0.0,
"correction_norm": 0.0,
"residual_total": 0.0,
"residual_force": 0.0,
"residual_contact": 0.0,
"residual_constraint": 0.0,
"residual_arc": 0.0,
"material_failure_count": 0.0,
"target_dt": 0.0,
"actual_dt": 0.0,
"next_dt": 0.0,