39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""Test extraction pipeline on existing OP2 file."""
|
||
|
|
|
||
|
|
import sys
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||
|
|
|
||
|
|
from optimization_engine.extractors import extract_displacement, extract_solid_stress
|
||
|
|
|
||
|
|
op2_path = r"C:\Users\antoi\Atomizer\studies\_Other\Model_for_dev\support_arm_sim1-solution_1.op2"
|
||
|
|
|
||
|
|
print("Testing extractors on existing OP2 file...")
|
||
|
|
print(f"File: {op2_path}")
|
||
|
|
print(f"Exists: {Path(op2_path).exists()}")
|
||
|
|
print()
|
||
|
|
|
||
|
|
# Test displacement extraction
|
||
|
|
print("1. Displacement extraction:")
|
||
|
|
try:
|
||
|
|
result = extract_displacement(op2_path)
|
||
|
|
print(f" Max magnitude: {result.get('max_magnitude', 'N/A')} mm")
|
||
|
|
print(f" Full result: {result}")
|
||
|
|
except Exception as e:
|
||
|
|
print(f" ERROR: {e}")
|
||
|
|
|
||
|
|
# Test stress extraction
|
||
|
|
print()
|
||
|
|
print("2. Stress extraction (CTETRA):")
|
||
|
|
try:
|
||
|
|
result = extract_solid_stress(op2_path, element_type="ctetra")
|
||
|
|
print(f" Max von Mises: {result.get('max_von_mises', 'N/A')} MPa")
|
||
|
|
print(f" Full result: {result}")
|
||
|
|
except Exception as e:
|
||
|
|
print(f" ERROR: {e}")
|
||
|
|
|
||
|
|
print()
|
||
|
|
print("Done!")
|