#!/bin/csh
#
# LSF batch script to run the test MPI code
#
#BSUB -n 1              # number of nodes to allocate (bu has 8 processors/node)
#BSUB -q p4-mp8         # queue
#BSUB -P cism2004       # Project
#BSUB -W 0:15           # 15 minute wallclock limit (required)
#BSUB -J LFM-MIX        # job name
#BSUB -o LFM-MIX.out    # output filename
#BSUB -e LFM-MIX.out    # error filename

# Set up PVM environment variables
setenv PVM_ROOT /project/cism2004/share/pvm3
setenv PVM_ARCH AIX56K
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
