##!/bin/bash
#
#PBS -j oe
#PBS -o /lfs/h2/emc/ptmp/Ming.Hu/outputrap/rap_analysis_pcyc.out20z
#PBS -e /lfs/h2/emc/ptmp/Ming.Hu/outputrap/rap_analysis_pcyc.out20z
#PBS -N rap_anl_pcyc_20
#PBS -l walltime=01:00:00
#PBS -q "dev"
#PBS -A RAP-DEV
#PBS -l place=vscatter,select=3:ncpus=128:mem=500GB
#

##########################################################################
# Purpose: to run the analysis for the Rapid Refresh Model
##########################################################################

# EXPORT list here

set -x

export FI_OFI_RXM_SAR_LIMIT=3145728
export OMP_NUM_THREADS=2
export OMP_STACKSIZE=500M

export numprocs=192
export NTASK=192
export PTILE=64

export envir=canned
export RUN_ENVIR=prod
export cyc=20
export cycle=t20z
export job=rap_analysis_pcyc_20
export group_name=meso

# Paths needed here for testing - these will be set by prod_envir in ops
export NWROOT=/lfs/h2/emc/lam/noscrub/Ming.Hu/nwprod
export DATAROOT=/lfs/h2/emc/ptmp/Ming.Hu

. ${NWROOT}/rap.v5.1.0/versions/run.ver

module purge

module load envvar/${envvar_ver}
module load PrgEnv-intel/${PrgEnv_intel_ver}
module load craype/${craype_ver}
module load intel/${intel_ver}
module load cray-mpich/${cray_mpich_ver}
module load hdf5/${hdf5_ver}
module load netcdf/${netcdf_ver}
module load pnetcdf/${pnetcdf_ver}

module load prod_util/${prod_util_ver}
module load wgrib2/${wgrib2_ver}
module load grib_util/${grib_util_ver}
module load util_shared/${util_shared_ver}
module load cray-pals/${cray_pals_ver}

${NWROOT}/rap.${rap_ver}/jobs/JRAP_ANALYSIS_PCYC 
# next step is to update the boundary conditions
qsub ${NWROOT}/rap.${rap_ver}/sms/jrap_updatebc_pcyc_20.bsub