This commit is contained in:
@@ -18,6 +18,7 @@ def parse_args() -> argparse.Namespace:
|
||||
parser.add_argument("--dynamic-steps", type=int, default=0)
|
||||
parser.add_argument("--output-interval", type=int, default=0)
|
||||
parser.add_argument("--require-contact", action="store_true")
|
||||
parser.add_argument("--require-friction", action="store_true")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -95,11 +96,39 @@ def check_contact_output(build_dir: Path, case_name: str, step: int) -> None:
|
||||
raise RuntimeError(f"{contact_file} did not record active contact")
|
||||
|
||||
|
||||
def check_friction_output(build_dir: Path, case_name: str, step: int) -> None:
|
||||
contact_file = build_dir / "example_smoke" / case_name / f"contact_{step:08d}.csv"
|
||||
if not contact_file.exists():
|
||||
raise RuntimeError(f"missing contact output: {contact_file}")
|
||||
|
||||
with contact_file.open(newline="", encoding="utf-8") as handle:
|
||||
rows = [row for row in csv.DictReader(handle) if row.get("kind") == "PAIR"]
|
||||
if not rows:
|
||||
raise RuntimeError(f"{contact_file} does not contain contact pair rows")
|
||||
|
||||
max_slip = max(float(row["accumulated_slip"]) for row in rows)
|
||||
max_work = max(float(row["friction_work_total"]) for row in rows)
|
||||
min_work = min(float(row["friction_work_total"]) for row in rows)
|
||||
max_reg = max(float(row["friction_regularization"]) for row in rows)
|
||||
max_ft = max(
|
||||
max(abs(float(row["ftx"])), abs(float(row["fty"])), abs(float(row["ftz"])))
|
||||
for row in rows
|
||||
)
|
||||
if max_reg <= 0.0:
|
||||
raise RuntimeError(f"{contact_file} did not report friction regularization")
|
||||
if max_slip <= 0.0 or max_ft <= 0.0:
|
||||
raise RuntimeError(f"{contact_file} did not record frictional slip")
|
||||
if min_work < -1.0e-12 or max_work <= 0.0:
|
||||
raise RuntimeError(f"{contact_file} did not record positive friction work")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = parse_args()
|
||||
_, steps = run_case(args)
|
||||
if args.require_contact:
|
||||
check_contact_output(Path(args.build_dir).resolve(), args.case_name, steps)
|
||||
if args.require_friction:
|
||||
check_friction_output(Path(args.build_dir).resolve(), args.case_name, steps)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user