#PBS -N hwrf%STORMNUM%_wrfhycom_%CYC%
#PBS -j oe
#PBS -S /bin/bash
#PBS -q %QUEUE%
#PBS -A %PROJ%-%PROJENVIR%
#PBS -l walltime=02:20:00
#PBS -l select=1:mpiprocs=2:ncpus=2+1:mpiprocs=90:ncpus=90+16:mpiprocs=60:ompthreads=2:ncpus=120+1:mpiprocs=12:ompthreads=2:ncpus=24
#PBS -l debug=true

export NODES=19
export TOTAL_TASKS=1064
export OMP_NUM_THREADS=2
export ATM_THREADS=2

model=hwrf
%include <head.h>
%include <envir-p1.h>
export FORECAST_CONF_OVERRIDE=" %FORECAST_CONF_OVERRIDE%"

export cyc="%CYC%"
export storm_num="%STORMNUM%"

# versions file for hwrf sets $model_ver and $code_ver

module load envvar/$::env(envvar_ver)
module load PrgEnv-intel/$::env(PrgEnv_intel_ver)
module load craype/$::env(craype_ver)
module load intel/$::env(intel_ver)
module load cray-mpich/$::env(cray_mpich_ver)
module load cray-pals/$::env(cray_pals_ver)
module load libpng/$::env(libpng_ver)
module load zlib/$::env(zlib_ver)
module load jasper/$::env(jasper_ver)
module load libjpeg/$::env(libjpeg_ver)
module load grib_util/$::env(grib_util_ver)
module load wgrib2/$::env(wgrib2_ver)
module load w3emc/$::env(w3emc_ver)
module load w3nco/$::env(w3nco_ver)
module load bufr/$::env(bufr_ver)
module load hdf5/$::env(hdf5_ver)
module load netcdf/$::env(netcdf_ver)
module load pnetcdf/$::env(pnetcdf_ver)
module load udunits/$::env(udunits_ver)
module load nco/$::env(nco_ver)
module load python/$::env(python_ver)
module list

${HOMEhwrf}/jobs/JHWRF_FORECAST

%include <tail.h>

%manual

TASK wrfhycom

PURPOSE: Runs the ocean-coupled forecast job with HYCOM and no wave coupling.

TROUBLESHOOTING

WARNING: MAKE SURE THE POST FAMILY IS REQUEUED when resubmitting a
  forecast job.  This ensures the post-processing proceeds in the
  correct order.

CAUTION: Submitting this job, in and of itself, is not enough to cause
  an ocean-coupled, waveless forecast if the wave_init succeeded.
  Instead, simply submitting this job will likely cause the job to fail.
  Follow this procedure to force an ocean-coupled, no wave forecast:

1. Edit the relevant storm*.conf for this storm in the COM directory.
   In the [config] section of the file, you must set run_wave=no and
   run_ocean=yes like so:

   [config]
   run_ocean=yes    ;; Enable ocean coupling
   run_wave=no      ;; Disable ocean coupling

2. Manually clear the Wave flag in the init/wave_init

3. Make sure the Ocean flag is set in the init/ocean_init job.

4. Make sure no jobs in the forecast family are running.

5. Resubmit the entire forecast family.

%end