File size: 1,440 Bytes
a48faac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from applications.binary_blending_tool.cli import get_user_config
from applications.binary_blending_tool.results import (
    run_blend_sweep,
    display_sweep_results,
    save_results,
)


def main():
    print("\n" + "=" * 70)
    print("        BINARY BLENDING TOOL")
    print("=" * 70)
    print("\nSweep an additive's mole fraction and see how DCN and YSI respond.")

    while True:
        try:
            config = get_user_config()

            confirm = input("\nRun sweep? (y/n): ").strip().lower()
            if confirm != "y":
                print("Cancelled.")
                continue

            result = run_blend_sweep(**config)

            display_sweep_results(result)

            save = input("\nSave results to file? (y/n): ").strip().lower()
            if save == "y":
                raw = input("Filename prefix (no extension) [default: auto]: ").strip()
                filename = raw if raw else None
                save_results(result, filename)

            break

        except KeyboardInterrupt:
            print("\n\n⚠ Interrupted by user. Exiting...")
            print("=" * 70 + "\n")
            break

        except Exception as e:
            print(f"\n❌ Unexpected error: {e}")
            retry = input("\nTry again? (y/n): ").strip().lower()
            if retry != "y":
                break


if __name__ == "__main__":
    main()