#!/bin/bash ######################################## # WRF-SREF Preliminary data setup step # change log: # 09/xx/2005, Jun Du - initial implementation # 04/04/2006, Jun Du - change the directory name $COMENS from # ${COMROOT}/mrf/prod/ to /com/gens/prod to match the new # global ensemble data outout # 07/18/2008, Jun Du - upgrade to WRFv2.2 # # !!!!!This Job needs to be lunched 21 times with specific MODEL and # MEMBER names, i.e., MODEL(MEMBER....) = NMB(ctl,p01,n01,p02,n02,p03,n03) # NMM(ctl,p01,n01,p02,n02,p03,n03) and ARW(ctl,p01,n01,p02,n02,p03,n03) # simutaneously!!!!! # 9/20/2009, Julia Zhu Scripts are modified to be sharable # between EMC and NCO # Please note that variable "RUN_ENVIR" is set and used # in the development enviroment only. # 4/15/2010, Jun Du Generalized the script to run NEMS-NMMB # ensemble (MODEL=NMB) # 11/20/2021, Jun Du WCOSS2 version (v7.1.0) ######################################## set -eux export OMP_NUM_THREADS=1 export N_TASK=${NCPUS:-1} #export N_TASK=${LSB_DJOB_NUMPROC:-1} # # Specify whether the run is production or development # export RUN_ENVIR=${RUN_ENVIR:-nco} ##################################################################################### # Run config file to get input parameters # This config file should define the following variables # DATA_IN: Location of working directory, default to ${DATAROOT} # DEV_SMS: If the job is to be running using ecFflow, default to YES # SENDDBN: Set to NO for developers, default to YES # COM_IN: Directory for input files, default to ${COMROOT}/$NET/${envir} # COM_OUT: Directory for output file, default to ${COMROOT}/$NET/${envir} # gespath: Directory for the guess or restart files, default to ${GESROOT}/${envir} ##################################################################################### if [ "$RUN_ENVIR" != nco ] ### For Developers, "group_name" is passed from the ecFflow script then CONFIG_FILE=${CONFIG_FILE:-/lfs/h2/emc/lam/noscrub/${LOGNAME}/sref${PACKAGEROOTp1}/parm/sref_para_config_cray} . $CONFIG_FILE export userid=$LOGNAME export DATA_IN=${DATA_IN:-/lfs/h2/emc/ptmp/$userid} fi echo `date` $0 `date -u` begin export PS4='$SECONDS + ' export CYC=${CYC:-${cyc}} export MEMBER=${MEMBER:-ctl} export MODEL=${MODEL:-ARW} export RES=${RES:-16km} ########################################################### # obtain unique process id (pid) and make temp directories # Note: ctl member needs to be run only once and can be used # for both NMM and ARW cores! ########################################################### export DATA_IN=${DATA_IN:-${DATAROOT}} export DATA=$DATA_IN/sref_${MODEL}_wps_${CYC}_${envir} export WORK_DIR=$DATA/wps.$MEMBER # Remove old directory if it exists rm -rf $WORK_DIR mkdir -p $WORK_DIR while [ ! -d $WORK_DIR ] do mkdir -p $WORK_DIR done cd $WORK_DIR #################################### # File To Log Msgs #################################### export jlogfile=${jlogfile:-$DATA/jlogfile.${job}.$$} #################################### # Determine Job Output Name on System #################################### export pgmout="OUTPUT.$$" export cycle=t${cyc}z ############################### # Specify NET and RUN name ############################## export NET=sref export RUN=sref ################################################## # SAVEGES - Copy Files From TMPDIR to $GESdir # SENDECF - Flag Events on ecFflow # SENDCOM - Copy Files From TMPDIR to $COMOUT # SENDDBN - Issue DBNet Client Calls # RERUN - Rerun fcst from beginning (default no) ################################################## export SENDCOM=${SENDCOM:-YES} export SENDECF=${SENDECF:-YES} export SENDDBN=${SENDDBN:-YES} export HOMEsref=${HOMEsref:-${PACKAGEROOT}/${NET}.${sref_ver}} export EXECsref=${EXECsref:-$HOMEsref/exec} export FIXsref=${FIXsref:-$HOMEsref/fix} export PARMsref=${PARMsref:-$HOMEsref/parm} export USHsref=${USHsref:-$HOMEsref/ush} ################################### # Set up the UTILITIES ################################### #machine=`cat /proc/sys/kernel/hostname | cut -c 1-1` #machine=`hostname |cut -c1` machine=`cat /etc/cluster_name | cut -c 1-1` if [ $machine = c -o $machine = d ]; then export MACHINE=wcoss2 elif [ $machine = m -o $machine = v ]; then export MACHINE=dell fi # Run setpdy and initialize PDY variables setpdy.sh . ./PDY ############################################# # COMIN and COMOUT ############################################# #export COMglb_IN=${COMglb_IN:-${COMROOT}/${NET}/${envir}} export COM_IN=${COM_IN:-$(compath.py ${NET}/${sref_ver})} export COM_OUT=${COM_OUT:-$(compath.py ${NET}/${sref_ver})} export COMINglb=${COMINglb:-$(compath.py ${NET}/${sref_ver})/${RUN}.${PDY}} export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}} export COMOUT=${COMOUT:-$COM_OUT/${RUN}.${PDY}/${cyc}} export COMINnam=${COMINnam:-$(compath.py nam/${nam_ver})} export COMINrap=${COMINrap:-$(compath.py rap/${rap_ver})} mkdir -p -m 775 $COMOUT env export FLENGTH=${FLENGTH:-87} export INCR=${INCR:-3} # Note: For ctl run, hires gfs is actually used instead of low-res c00 later on if [ $MODEL = NMB ];then if [ $MEMBER = ctl ];then export GLBMEM=c00;fi if [ $MEMBER = p01 ];then export GLBMEM=p01;fi if [ $MEMBER = n01 ];then export GLBMEM=p02;fi if [ $MEMBER = p02 ];then export GLBMEM=p03;fi if [ $MEMBER = n02 ];then export GLBMEM=p04;fi if [ $MEMBER = p03 ];then export GLBMEM=p05;fi if [ $MEMBER = n03 ];then export GLBMEM=p06;fi if [ $MEMBER = p04 ];then export GLBMEM=p07;fi if [ $MEMBER = n04 ];then export GLBMEM=p08;fi if [ $MEMBER = p05 ];then export GLBMEM=p09;fi if [ $MEMBER = n05 ];then export GLBMEM=p10;fi if [ $MEMBER = p06 ];then export GLBMEM=p11;fi if [ $MEMBER = n06 ];then export GLBMEM=p12;fi fi if [ $MODEL = NMM ];then if [ $MEMBER = ctl ];then export GLBMEM=c00;fi if [ $MEMBER = p01 ];then export GLBMEM=p07;fi if [ $MEMBER = n01 ];then export GLBMEM=p08;fi if [ $MEMBER = p02 ];then export GLBMEM=p09;fi if [ $MEMBER = n02 ];then export GLBMEM=p10;fi if [ $MEMBER = p03 ];then export GLBMEM=p11;fi if [ $MEMBER = n03 ];then export GLBMEM=p12;fi fi if [ $MODEL = ARW ];then if [ $MEMBER = ctl ];then export GLBMEM=c00;fi if [ $MEMBER = p01 ];then export GLBMEM=p13;fi if [ $MEMBER = n01 ];then export GLBMEM=p14;fi if [ $MEMBER = p02 ];then export GLBMEM=p15;fi if [ $MEMBER = n02 ];then export GLBMEM=p16;fi if [ $MEMBER = p03 ];then export GLBMEM=p17;fi if [ $MEMBER = n03 ];then export GLBMEM=p18;fi if [ $MEMBER = p04 ];then export GLBMEM=p19;fi if [ $MEMBER = n04 ];then export GLBMEM=p20;fi if [ $MEMBER = p05 ];then export GLBMEM=p01;fi if [ $MEMBER = n05 ];then export GLBMEM=p02;fi if [ $MEMBER = p06 ];then export GLBMEM=p03;fi if [ $MEMBER = n06 ];then export GLBMEM=p04;fi fi export IOFORM=2 export KEEPDATA=YES ######################################################## # Execute the script. if [ $MEMBER = ctl ];then $HOMEsref/scripts/exsref_wrfprep.sh $MEMBER $GLBMEM export WORK_DIR=$DATA/wps.c00 rm -rf $WORK_DIR mkdir -p $WORK_DIR cd $WORK_DIR $HOMEsref/scripts/exsref_wrfprep.sh c00 c00 else $HOMEsref/scripts/exsref_wrfprep.sh $MEMBER $GLBMEM fi ######################################################## cat $pgmout msg="JOB COMPLETED NORMALLY" postmsg $jlogfile "$msg" ################################ # Remove the Working Directory ################################ cd $DATA_IN if [ ${KEEPDATA:-NO} != YES ] ; then rm -rf $DATA ; fi date