#!/bin/csh
#---------------------------------------------------------------------------
# corhel: Run the coupled corona and heliospheric models.
#
# Usage : corhel <Carrington rotation> <resolution>
#---------------------------------------------------------------------------

# Set parameters
set cr = $1
set res = $2

# Set directories
setenv CORHEL_DIR "$CORHEL_ROOT"
setenv CORHEL_BIN "$CORHEL_ROOT/bin"
setenv CORHEL_RUN "$CORHEL_ROOT/run/cr$cr-$res"


# Check whether the same directory with this carrington rotation exists
echo "Check existence of the same running directory ..."
if (-e $CORHEL_RUN) then
  echo "Directory: $CORHEL_RUN exists."
  echo "Delete or rename this directory and re-run CORHEL-2 to run this case."
  echo ""
  exit 1
endif
echo "Directory: $CORHEL_RUN does not exist."


# Run the coupled corona heliospheric models
cd $CORHEL_DIR/run
mkdir $CORHEL_RUN
echo "Setting up directory: $CORHEL_RUN."
cd $CORHEL_RUN
mkdir $CORHEL_RUN/corona
mkdir $CORHEL_RUN/helio
mkdir $CORHEL_RUN/corona_bc
mkdir $CORHEL_RUN/helio_bc


# EVERYTHING IS READY TO RUN THE COUPLED SOLAR/HELIOSPHERIC SOLUTION
echo ""
echo "READY TO RUN THE COUPLED SOLAR/HELIOSPHERIC SOLUTION"
echo ""

exit 0
