#!/bin/bash

while true; do
    # Prompt the user to choose a Mach number
    echo "Choose a Mach number:"
    echo "1) Mach 6.82"
    echo "2) Mach 5"
    echo "3) Mach 3"
    read -p "Enter 1 or 2 or 3 for the respective choice: " mach_choice

    case $mach_choice in
        1)
            folder_name="Mach_6.82"
            break
            ;;
        2)
            folder_name="Mach_5"
            break
            ;;
        3)
            folder_name="Mach_3"
            break
            ;;
        *)
            echo "Invalid choice. Please enter 1 or 2 or 3 for the respective choice."
            ;;
    esac
done

while true; do
    # Prompt the user to choose a body type
    echo "Choose a body type:"
    echo "1) Blunt Body"
    echo "2) Spiked Blunt Body"
    read -p "Enter 1 or 2 for the respective choice: " body_choice

    case $body_choice in
        1)
            msh_file="blunt_body.msh"
            break
            ;;
        2)
            msh_file="spiked_blunt_body.msh"
            break
            ;;
        *)
            echo "Invalid choice. Please enter 1 or 2 for the respective choice."
            ;;
    esac
done

# Specify the source directory (Meshes folder)
source_dir="Meshes"

# Copy the chosen .msh file from the source directory to the selected folder
cp "$source_dir/$msh_file" "$folder_name/"

# Change directory to the selected folder and run the Allrun_parallel script
cd "$folder_name" || exit
./Allrun_parallel

