""" Create circular plate frequency tuning study with COMPLETE automation. This demonstrates the proper Hybrid Mode workflow: 1. Study structure creation 2. Benchmarking 3. Validation 4. Auto-generated runner """ from pathlib import Path import sys sys.path.insert(0, str(Path(__file__).parent)) from optimization_engine.hybrid_study_creator import HybridStudyCreator def main(): creator = HybridStudyCreator() # Create workflow JSON first (in temp location) import json import tempfile workflow = { "study_name": "circular_plate_frequency_tuning", "optimization_request": "Tune the first natural frequency mode to exactly 115 Hz (within 0.1 Hz tolerance)", "design_variables": [ {"parameter": "inner_diameter", "bounds": [50, 150]}, {"parameter": "plate_thickness", "bounds": [2, 10]} ], "objectives": [{ "name": "frequency_error", "goal": "minimize", "extraction": { "action": "extract_first_natural_frequency", "params": {"mode_number": 1, "target_frequency": 115.0} } }], "constraints": [{ "name": "frequency_tolerance", "type": "less_than", "threshold": 0.1 }] } # Write to temp file temp_workflow = Path(tempfile.gettempdir()) / "circular_plate_workflow.json" with open(temp_workflow, 'w') as f: json.dump(workflow, f, indent=2) # Create study with complete automation study_dir = creator.create_from_workflow( workflow_json_path=temp_workflow, model_files={ 'prt': Path("examples/Models/Circular Plate/Circular_Plate.prt"), 'sim': Path("examples/Models/Circular Plate/Circular_Plate_sim1.sim"), 'fem': Path("examples/Models/Circular Plate/Circular_Plate_fem1.fem"), 'fem_i': Path("examples/Models/Circular Plate/Circular_Plate_fem1_i.prt") }, study_name="circular_plate_frequency_tuning" ) print(f"Study ready at: {study_dir}") print() print("Next step:") print(f" python {study_dir}/run_optimization.py") if __name__ == "__main__": main()