Skip to content

Commit

Permalink
Merge pull request NOAA-EMC#26 from zhanglikate/feature/chem
Browse files Browse the repository at this point in the history
Feature/chem
  • Loading branch information
jkhender authored Mar 31, 2021
2 parents 909c321 + 04975e7 commit 87724f9
Show file tree
Hide file tree
Showing 286 changed files with 24,110 additions and 286 deletions.
69 changes: 10 additions & 59 deletions jobs/rocoto/calcinc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

###############################################################
## Abstract:
## Calculate increment of Met. fields for FV3-CHEM
## Create biomass burning emissions for FV3-CHEM
## RUN_ENVIR : runtime environment (emc | nco)
## HOMEgfs : /full/path/to/workflow
## EXPDIR : /full/path/to/config/files
Expand All @@ -18,73 +18,24 @@ status=$?

###############################################################
# Source relevant configs
configs="base calcinc"
configs="base"
for config in $configs; do
. $EXPDIR/config.${config}
status=$?
[[ $status -ne 0 ]] && exit $status
done

# Source machine runtime environment
. $BASE_ENV/${machine}.env calcinc
status=$?
[[ $status -ne 0 ]] && exit $status
###############################################################
CALCINCEXEC=${CALCINCEXEC:-$HOMEgfs/exec/calc_increment_ens.x}
NTHREADS_CALCINC=${NTHREADS_CALCINC:-1}
ncmd=${ncmd:-1}
imp_physics=${imp_physics:-99}
INCREMENTS_TO_ZERO=${INCREMENTS_TO_ZERO:-"'NONE'"}
DO_CALC_INCREMENT=${DO_CALC_INCREMENT:-"YES"}
export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'}

TMPDAY=`$NDATE -24 $PDY$cyc`
HISDAY=`echo $TMPDAY | cut -c1-8`

if [ $DO_CALC_INCREMENT = "YES" ]; then

export DATA="$RUNDIR/$CDATE/$CDUMP"

[[ ! -d $DATA ]] && mkdir -p $DATA

cd $DATA
mkdir -p calcinc
cd calcinc

# $NLN sigf06 atmges_mem001 ; $NLN siganl atmanl_mem001 ;

export OMP_NUM_THREADS=$NTHREADS_CALCINC
$NCP $CALCINCEXEC .
$NLN $OUTDIR/$CDUMP.$HISDAY/00/$CDUMP.t00z.atmf024.nemsio atmges_mem001
$NLN ../regrid/atmanl.$PDY$cyc atmanl_mem001
$NLN atminc.nc atminc_mem001
rm calc_increment.nml
cat > calc_increment.nml << EOF
&setup
datapath = './'
analysis_filename = 'atmanl'
firstguess_filename = 'atmges'
increment_filename = 'atminc'
debug = .false.
nens = $ncmd
imp_physics = $imp_physics
/
&zeroinc
incvars_to_zero = $INCREMENTS_TO_ZERO
/
EOF
cat calc_increment.nml
if [ $CDATE -ge "2021030100" ]; then
$HOMEgfs/jobs/rocoto/calcinc_gfsv16.sh
else
$HOMEgfs/jobs/rocoto/calcinc_gfsv15.sh
fi
echo "error regrid $rc "
exit $rc

APRUN=$(eval echo $APRUN_CALCINC)
$APRUN $(basename $CALCINCEXEC)
rc=$?

export ERR=$rc
export err=$ERR
$ERRSCRIPT || exit 3
fi

###############################################################

###############################################################
# Exit cleanly

File renamed without changes.
90 changes: 90 additions & 0 deletions jobs/rocoto/calcinc_gfsv15.sh-retro
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/bin/ksh -x

###############################################################
## Abstract:
## Calculate increment of Met. fields for FV3-CHEM
## RUN_ENVIR : runtime environment (emc | nco)
## HOMEgfs : /full/path/to/workflow
## EXPDIR : /full/path/to/config/files
## CDATE : current date (YYYYMMDDHH)
## CDUMP : cycle name (gdas / gfs)
## PDY : current date (YYYYMMDD)
## cyc : current cycle (HH)
###############################################################
# Source FV3GFS workflow modules
. $HOMEgfs/ush/load_fv3gfs_modules.sh
status=$?
[[ $status -ne 0 ]] && exit $status

###############################################################
# Source relevant configs
configs="base calcinc"
for config in $configs; do
. $EXPDIR/config.${config}
status=$?
[[ $status -ne 0 ]] && exit $status
done

# Source machine runtime environment
. $BASE_ENV/${machine}.env calcinc
status=$?
[[ $status -ne 0 ]] && exit $status
###############################################################
CALCINCEXEC=${CALCINCEXEC:-$HOMEgfs/exec/calc_increment_ens.x}
NTHREADS_CALCINC=${NTHREADS_CALCINC:-1}
ncmd=${ncmd:-1}
imp_physics=${imp_physics:-99}
INCREMENTS_TO_ZERO=${INCREMENTS_TO_ZERO:-"'NONE'"}
DO_CALC_INCREMENT=${DO_CALC_INCREMENT:-"YES"}
export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'}

TMPDAY=`$NDATE -24 $PDY$cyc`
HISDAY=`echo $TMPDAY | cut -c1-8`

if [ $DO_CALC_INCREMENT = "YES" ]; then

export DATA="$RUNDIR/$CDATE/$CDUMP"

[[ ! -d $DATA ]] && mkdir -p $DATA

cd $DATA
mkdir -p calcinc
cd calcinc

# $NLN sigf06 atmges_mem001 ; $NLN siganl atmanl_mem001 ;

export OMP_NUM_THREADS=$NTHREADS_CALCINC
$NCP $CALCINCEXEC .
$NLN $OUTDIR/$CDUMP.$HISDAY/00/$CDUMP.t00z.atmf024.nemsio atmges_mem001
$NLN ../regrid/atmanl.$PDY$cyc atmanl_mem001
$NLN atminc.nc atminc_mem001
rm calc_increment.nml
cat > calc_increment.nml << EOF
&setup
datapath = './'
analysis_filename = 'atmanl'
firstguess_filename = 'atmges'
increment_filename = 'atminc'
debug = .false.
nens = $ncmd
imp_physics = $imp_physics
/
&zeroinc
incvars_to_zero = $INCREMENTS_TO_ZERO
/
EOF
cat calc_increment.nml

APRUN=$(eval echo $APRUN_CALCINC)
$APRUN $(basename $CALCINCEXEC)
rc=$?

export ERR=$rc
export err=$ERR
$ERRSCRIPT || exit 3
fi

###############################################################

###############################################################
# Exit cleanly
93 changes: 93 additions & 0 deletions jobs/rocoto/calcinc_gfsv16.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/ksh -x

###############################################################
## Abstract:
## Calculate increment of Met. fields for FV3-CHEM
## RUN_ENVIR : runtime environment (emc | nco)
## HOMEgfs : /full/path/to/workflow
## EXPDIR : /full/path/to/config/files
## CDATE : current date (YYYYMMDDHH)
## CDUMP : cycle name (gdas / gfs)
## PDY : current date (YYYYMMDD)
## cyc : current cycle (HH)
###############################################################
# Source FV3GFS workflow modules
. $HOMEgfs/ush/load_fv3gfs16_modules.sh
status=$?
[[ $status -ne 0 ]] && exit $status

###############################################################
# Source relevant configs
configs="base calcinc"
for config in $configs; do
. $EXPDIR/config.${config}
status=$?
[[ $status -ne 0 ]] && exit $status
done

# Source machine runtime environment
. $BASE_ENV/${machine}.env calcinc
status=$?
[[ $status -ne 0 ]] && exit $status
###############################################################
#CALCINCEXEC=${CALCINCEXEC:-$HOMEgfs/exec/calc_increment_ens_gsdchem.x}
CALCINCEXEC=${CALCINCEXEC:-$HOMEgfs/exec/calc_increment_ens_ncio.x}
NTHREADS_CALCINC=${NTHREADS_CALCINC:-1}
ncmd=${ncmd:-1}
imp_physics=${imp_physics:-99}
INCREMENTS_TO_ZERO=${INCREMENTS_TO_ZERO:-"'NONE'"}
DO_CALC_INCREMENT=${DO_CALC_INCREMENT:-"YES"}
export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'}

TMPDAY=`$NDATE -24 $PDY$cyc`
HISDAY=`echo $TMPDAY | cut -c1-8`

#convert nemsio to netcdf
#$EXECgfs/nemsioatm2nc $OUTDIR/$CDUMP.$HISDAY/00/$CDUMP.t00z.atmf024.nemsio $CDUMP.t00z.atmf024.nc

if [ $DO_CALC_INCREMENT = "YES" ]; then

cd $DATA
mkdir -p calcinc
cd calcinc

#convert nemsio to netcdf
$EXECgfs/nemsioatm2nc $OUTDIR/$CDUMP.$HISDAY/00/$CDUMP.t00z.atmf024.nemsio $CDUMP.t00z.atmf024.nc
# $NLN sigf06 atmges_mem001 ; $NLN siganl atmanl_mem001 ;

export OMP_NUM_THREADS=$NTHREADS_CALCINC
$NCP $CALCINCEXEC .
# $NLN $OUTDIR/$CDUMP.$HISDAY/00/$CDUMP.t00z.atmf024.nemsio atmges_mem001
$NLN $CDUMP.t00z.atmf024.nc atmges_mem001
$NLN ../regrid/atmanl.$PDY$cyc.nc atmanl_mem001
$NLN atminc.nc atminc_mem001
rm calc_increment.nml
cat > calc_increment.nml << EOF
&setup
datapath = './'
analysis_filename = 'atmanl'
firstguess_filename = 'atmges'
increment_filename = 'atminc'
debug = .false.
nens = $ncmd
imp_physics = $imp_physics
/
&zeroinc
incvars_to_zero = $INCREMENTS_TO_ZERO
/
EOF
cat calc_increment.nml

APRUN=$(eval echo $APRUN_CALCINC)
$APRUN $(basename $CALCINCEXEC)
rc=$?

export ERR=$rc
export err=$ERR
$ERRSCRIPT || exit 3
fi

###############################################################

###############################################################
# Exit cleanly
47 changes: 11 additions & 36 deletions jobs/rocoto/fv3ic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

###############################################################
## Abstract:
## Create FV3 initial conditions from GFS intitial conditions
## Create biomass burning emissions for FV3-CHEM
## RUN_ENVIR : runtime environment (emc | nco)
## HOMEgfs : /full/path/to/workflow
## EXPDIR : /full/path/to/config/files
## CDATE : current date (YYYYMMDDHH)
## CDUMP : cycle name (gdas / gfs)
## PDY : current date (YYYYMMDD)
## cyc : current cycle (HH)
###############################################################

###############################################################
# Source FV3GFS workflow modules
. $HOMEgfs/ush/load_fv3gfs_modules.sh
Expand All @@ -20,47 +18,24 @@ status=$?

###############################################################
# Source relevant configs
configs="base fv3ic"
configs="base"
for config in $configs; do
. $EXPDIR/config.${config}
status=$?
[[ $status -ne 0 ]] && exit $status
done

###############################################################
# Source machine runtime environment
. $BASE_ENV/${machine}.env fv3ic
status=$?
[[ $status -ne 0 ]] && exit $status

# Temporary runtime directory
export DATA="$RUNDIR/$CDATE/$CDUMP/fv3ic$$"
[[ -d $DATA ]] && rm -rf $DATA

# Input GFS initial condition directory
export INIDIR="$ICSDIR/$CDATE/$CDUMP/$CDUMP.$PDY/$cyc"

# Output FV3 initial condition directory
export OUTDIR="$ICSDIR/$CDATE/$CDUMP/$CASE/INPUT"

export OMP_NUM_THREADS_CH=$NTHREADS_CHGRES
export APRUNC=$APRUN_CHGRES

# Call global_chgres_driver.sh
$HOMEgfs/ush/global_chgres_driver.sh
status=$?
if [ $status -ne 0 ]; then
echo "global_chgres_driver.sh returned with a non-zero exit code, ABORT!"
exit $status
if [ $CDATE -ge "2021030100" ]; then
$HOMEgfs/jobs/rocoto/fv3ic_gfsv16.sh
else
$HOMEgfs/jobs/rocoto/fv3ic_gfsv15.sh
fi
echo "error fv3ic $rc "
exit $rc

# Stage the FV3 initial conditions to ROTDIR
COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc"
[[ ! -d $COMOUT ]] && mkdir -p $COMOUT
cd $COMOUT || exit 99
rm -rf INPUT
$NLN $OUTDIR .

###############################################################

###############################################################
# Exit cleanly
exit 0

Loading

0 comments on commit 87724f9

Please sign in to comment.