Example: Load and run Paroto system from STONE configuration.

This example demonstrates how to load a complete system architecture from a STONE format YAML file and run a simulation.

import os

from paroto.io.stone_loader import create_problem_from_stone


def main():
    """Load architecture from STONE config and run simulation."""
    print("\n" + "=" * 60)
    print("  Paroto - STONE Configuration Example")
    print("=" * 60)

    script_dir = os.path.dirname(os.path.abspath(__file__))
    config_path = os.path.join(script_dir, "config_example.yml")

    print(f"\nLoading configuration from: {os.path.basename(config_path)}")
    print("-" * 60)

    # Create problem from STONE configuration
    prob = create_problem_from_stone(config_path)
    prob.run_model()

    # Display results
    print("\nSimulation Results:")
    print("-" * 60)
    print(f"Breakdown Voltage:        {prob.get_val('breakdown_voltage')[0]:.2f} V")
    print(f"Arc Current:              {prob.get_val('arc_current')[0]:.2f} A")
    print(f"Power to Gas:             {prob.get_val('power_to_gas')[0]:.2f} W")
    print(f"Ablation Rate:            {prob.get_val('ablation_rate')[0]:.6f} kg/s")
    print(f"Flow Velocity:            {prob.get_val('flow_velocity')[0]:.2f} m/s")
    print(f"Outlet Temperature:       {prob.get_val('outlet_temperature')[0]:.2f} K")
    print(f"Temperature Homogeneity:  {prob.get_val('temperature_homogeneity_index')[0]:.3f}")

    print("\n" + "=" * 60)
    print("SUCCESS: Simulation completed")
    print("=" * 60)
    print("\nNext steps:")
    print("  1. Edit config_example.yml to customize the system")
    print("  2. Try config_low_fidelity.yml or config_high_fidelity.yml")
    print("  3. Run optimization: paroto-optimize --config config_example.yml")
    print()


if __name__ == "__main__":
    try:
        main()
    except Exception as e:
        print(f"\nError: {e}")
        import traceback

        traceback.print_exc()