#!/bin/csh -f
#$ -A cmit2
#$ -pe wcomp 8
#$ -N TimestepRun-0001
#$ -o TimestepRun-0001.output
#S -e TimestepRun-0001.error
#$ -l h_rt=02:00:00
#$ -cwd

# Set up environment variables
setenv INSTALL_DIR /home/pschmitt/cmit2/pschmitt/opt-intel
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${INSTALL_DIR}/overture-noX/lib

setenv PVM_ROOT ${INSTALL_DIR}/pvm3
setenv PVM_ARCH LINUX64
setenv PVM_BIN ${PVM_ROOT}/bin
setenv PVM_RSH /usr/bin/rsh

# End any active PVM sessions
echo "halt" | ${PVM_ROOT}/lib/pvm
rm -f /tmp/pvm* /tmp/aaa*

# Start PVM
echo "quit" | ${PVM_ROOT}/lib/pvm

# Loop through the hosts & add to pvm
# use env var LSB_HOSTS

wait

# Run the MIX ionosphere solver
./ionosphere jpara-ion.param >&! IONOSPHERE.info &

# Run the LFM MHD solver
./jpara_wrapper jpara-ion.xjd >&! JPARA_WRAPPER.info
wait

# Stop PVM
echo "halt" | ${PVM_ROOT}/lib/pvm
