Skip to content

Commit

Permalink
Small independent upgrades to cam-fv shell scripts
Browse files Browse the repository at this point in the history
shell_scripts/cesm2_1/
   assimilate.csh.template
      Avoid listing files if the CAM_PHIS file already exists.
   setup_advanced
   setup_hybrid
      Define a TMPDIR that's not the default /var/tmp.
      Changing CIME_OUTPUT_ROOT changes RUNDIR, so define RUNDIR after
      CIME_OUTPUT_ROOT.
      Check for existence of inflation files.
  • Loading branch information
kdraeder committed Aug 17, 2023
1 parent b710f9f commit 8c29b61
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
9 changes: 5 additions & 4 deletions models/cam-fv/shell_scripts/cesm2_1/assimilate.csh.template
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,14 @@ ${REMOVE} ${CAMINPUT}
${LINK} ${CASE}.cam_0001.i.${ATM_DATE_EXT}.nc ${CAMINPUT} || exit 90

# All of the .h0. files contain the same PHIS field, so we can link to any of them.

set hists = `${LIST} ${CASE}.cam_0001.h0.*.nc`
set MYSTRING = `grep cam_phis_filename input.nml`
set MYSTRING = `echo $MYSTRING | sed -e "s#[=,']# #g"`
set CAM_PHIS = $MYSTRING[2]
${REMOVE} ${CAM_PHIS}
${LINK} $hists[1] ${CAM_PHIS} || exit 100
# Listings are slow in productions runs; only do it if necessary
if (! -f ${CAM_PHIS}) then
set hists = `${LIST} ${CASE}.cam_0001.h0.*.nc`
${COPY} $hists[1] ${CAM_PHIS} || exit 100
endif

# Now, actually check the inflation settings

Expand Down
20 changes: 19 additions & 1 deletion models/cam-fv/shell_scripts/cesm2_1/setup_advanced
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
#PBS -o Test_0.bld1
#PBS -j oe
#
if ($?PBS_O_WORKDIR) then
# This avoids using /var/tmp, which can be purged by other jobs while this
# share queue job is running, which kills it.
setenv TMPDIR /glade/scratch/$USER/temp
mkdir -p $TMPDIR
endif

# ---------------------
# Purpose
# ---------------------
Expand Down Expand Up @@ -516,7 +523,6 @@ setenv COMP_GLC `./xmlquery COMP_GLC --value`
setenv COMP_ROF `./xmlquery COMP_ROF --value`
setenv CIMEROOT `./xmlquery CIMEROOT --value`
setenv EXEROOT `./xmlquery EXEROOT --value`
setenv RUNDIR `./xmlquery RUNDIR --value`
setenv CAM_CONFIG_OPTS `./xmlquery CAM_CONFIG_OPTS --value`

set max_tasks_per_node = `./xmlquery MAX_TASKS_PER_NODE --value`
Expand Down Expand Up @@ -672,6 +678,8 @@ echo "After xmlchanges for ROOTPEs ..."
./xmlchange GET_REFCASE=FALSE

./xmlchange CIME_OUTPUT_ROOT=${cime_output}
# Changing CIME_OUTPUT_ROOT changes RUNDIR in CESM, so change it here too.
setenv RUNDIR `./xmlquery RUNDIR --value`

./xmlchange SSTICE_DATA_FILENAME=$sst_dataset
./xmlchange SSTICE_GRID_FILENAME=$sst_grid
Expand Down Expand Up @@ -1236,6 +1244,16 @@ else # CONTINUE_RUN == FALSE
echo "All files set to run the FIRST experiment step using (ref)time" $init_time
endif
ls *inf*\${restart_time}* >& /dev/null
if (\$status != 0) then
echo ""
echo '==========================================================='
echo "WARNING: no inflation files were found for \$restart_time"
echo '==========================================================='
echo ""
endif
exit 0
EndOfText
Expand Down
20 changes: 19 additions & 1 deletion models/cam-fv/shell_scripts/cesm2_1/setup_hybrid
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
#PBS -o Test_0.bld1
#PBS -j oe
#
if ($?PBS_O_WORKDIR) then
# This avoids using /var/tmp, which can be purged by other jobs while this
# share queue job is running, which kills it.
setenv TMPDIR /glade/scratch/$USER/temp
mkdir -p $TMPDIR
endif

# ---------------------
# Purpose
# ---------------------
Expand Down Expand Up @@ -484,7 +491,6 @@ setenv COMP_GLC `./xmlquery COMP_GLC --value`
setenv COMP_ROF `./xmlquery COMP_ROF --value`
setenv CIMEROOT `./xmlquery CIMEROOT --value`
setenv EXEROOT `./xmlquery EXEROOT --value`
setenv RUNDIR `./xmlquery RUNDIR --value`
setenv CAM_CONFIG_OPTS `./xmlquery CAM_CONFIG_OPTS --value`

set max_tasks_per_node = `./xmlquery MAX_TASKS_PER_NODE --value`
Expand Down Expand Up @@ -640,6 +646,8 @@ echo "After xmlchanges for ROOTPEs ..."
./xmlchange GET_REFCASE=FALSE

./xmlchange CIME_OUTPUT_ROOT=${cime_output}
# Changing CIME_OUTPUT_ROOT changes RUNDIR in CESM, so change it here too.
setenv RUNDIR `./xmlquery RUNDIR --value`

./xmlchange SSTICE_DATA_FILENAME=$sst_dataset
./xmlchange SSTICE_GRID_FILENAME=$sst_grid
Expand Down Expand Up @@ -1128,6 +1136,16 @@ else # CONTINUE_RUN == FALSE
echo "All files set to run the FIRST experiment step using (ref)time" $init_time
endif
ls *inf*\${restart_time}* >& /dev/null
if (\$status != 0) then
echo ""
echo '==========================================================='
echo "WARNING: no inflation files were found for \$restart_time"
echo '==========================================================='
echo ""
endif
exit 0
EndOfText
Expand Down

0 comments on commit 8c29b61

Please sign in to comment.