From 2185d73d1d3d4b449e9e911971f00782ce5f3822 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 5 Feb 2024 11:02:39 -0500 Subject: [PATCH 1/3] Initialize USE_WAVES to 0 --- AGCM.rc.tmpl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AGCM.rc.tmpl b/AGCM.rc.tmpl index c7e36e47..9ff59044 100644 --- a/AGCM.rc.tmpl +++ b/AGCM.rc.tmpl @@ -116,7 +116,7 @@ CLOSURE_CONGESTUS: 3 @HIST_GOCARTCA.br::CA.brphilic default @HIST_GOCARTCA.oc::CA.ocphilic default @HIST_GOCARTNI::NO3an1 "NI::NO3an2,NI::NO3an3" -@HIST_GOCARTPCHEM::OX default +@HIST_GOCARTPCHEM::OX default @HIST_GOCART:: @HIST_GOCART########################################################### @@ -905,6 +905,10 @@ USE_SATSIM_RADAR: @RADAR_SATSIM USE_SATSIM_LIDAR: @LIDAR_SATSIM USE_SATSIM_MISR: @MISR_SATSIM +# Flags to enable wave code +# ------------------------- +USE_WAVES: 0 + @COUPLED INTERPOLATE_ATMLM: 0 @COUPLED INTERPOLATE_ATMTAU: 1 @COUPLED INTERPOLATE_OCEAN_ICE_CURRENTS: 0 @@ -929,7 +933,7 @@ USE_SATSIM_MISR: @MISR_SATSIM @MOM5#DATA_SST_FILE: sst.data @MOM5#DATA_FRT_FILE: fraci.data -@COUPLED +@COUPLED @COUPLED# Section for CICE @COUPLED# ----------------- @CICE4USE_CICE_Thermo: 1 From a1f20948242edb71e16ba1a63bbfb051afb3d118 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 6 Feb 2024 10:08:54 -0500 Subject: [PATCH 2/3] Add more USE_WAVES protections --- gcm_run.j | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcm_run.j b/gcm_run.j index 502ac093..8c6ef107 100755 --- a/gcm_run.j +++ b/gcm_run.j @@ -644,7 +644,7 @@ else end # WW3 restart file - if( $wavemodel == "WW3" ) then + if( $USE_WAVES != 0 && $wavemodel == "WW3" ) then set rst_ww3 = "restart.ww3" if(-e $EXPDIR/${rst_ww3} ) /bin/cp $EXPDIR/${rst_ww3} . & endif @@ -679,7 +679,7 @@ if($numrs == 0) then wait @COUPLED cp -r $EXPDIR/RESTART ${EXPDIR}/restarts/RESTART.${edate} # WW3 restart file - if( $wavemodel == "WW3" ) then + if( $USE_WAVES != 0 && $wavemodel == "WW3" ) then set rst_ww3 = "restart.ww3" if( -e ${rst_ww3} ) cp ${rst_ww3} ${EXPDIR}/restarts/$EXPID.${rst_ww3}.${edate}.${GCMVER}.${BCTAG}_${BCRSLV} endif @@ -1318,7 +1318,7 @@ end # WW3 restarts - assumes that there is at least one NEW restart file # ------------------------------------------------------------------ -if( $wavemodel == "WW3" ) then +if( $USE_WAVES != 0 && $wavemodel == "WW3" ) then set ww3checkpoint = `/bin/ls -1 restart[0-9][0-9][0-9].ww3 | sort -n | tail -n 1` set rst_ww3 = "restart.ww3" @@ -1326,7 +1326,7 @@ if( $wavemodel == "WW3" ) then cp $rst_ww3 ${EXPDIR}/restarts/$EXPID.${rst_ww3}.${edate}.${GCMVER}.${BCTAG}_${BCRSLV}.bin # remove intermediate restarts - set ww3checkpoint = `/bin/ls -1 restart[0-9][0-9][0-9].ww3 | sort -n | tail -n 1` + set ww3checkpoint = `/bin/ls -1 restart[0-9][0-9][0-9].ww3 | sort -n | tail -n 1` if ( $#ww3checkpoint != 0 ) /bin/rm ./restart[0-9][0-9][0-9].ww3 endif @@ -1437,7 +1437,7 @@ else wait cp cap_restart $EXPDIR/cap_restart - if( $wavemodel == "WW3" ) then + if( $USE_WAVES != 0 && $wavemodel == "WW3" ) then set rst_ww3 = "restart.ww3" /bin/rm -f $EXPDIR/$rst_ww3 cp $rst_ww3 $EXPDIR/$rst_ww3 & From e430fb103eb4adf525829c1b3a3a2d1954bf5153 Mon Sep 17 00:00:00 2001 From: Anton Darmenov Date: Tue, 6 Feb 2024 11:02:51 -0500 Subject: [PATCH 3/3] Improve readability This commit introduces a logical variable 'wavewatch'. Said flag controls the handling of WAVEWATCH namelists and restarts in the gcm_run.j script. --- gcm_run.j | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gcm_run.j b/gcm_run.j index 8c6ef107..f7244a23 100755 --- a/gcm_run.j +++ b/gcm_run.j @@ -631,6 +631,7 @@ end # ----------------------- set USE_WAVES = `grep '^\s*USE_WAVES:' AGCM.rc| cut -d: -f2` set wavemodel = `cat WGCM.rc | grep "wave_model:" | cut -d "#" -f1 | cut -d ":" -f 2 | sed 's/\s//g'` +set wavewatch = `$USE_WAVES != 0 && $wavemodel == "WW3"` # Copy Restarts to Scratch Directory # ---------------------------------- @@ -644,7 +645,7 @@ else end # WW3 restart file - if( $USE_WAVES != 0 && $wavemodel == "WW3" ) then + if( $wavewatch ) then set rst_ww3 = "restart.ww3" if(-e $EXPDIR/${rst_ww3} ) /bin/cp $EXPDIR/${rst_ww3} . & endif @@ -679,7 +680,7 @@ if($numrs == 0) then wait @COUPLED cp -r $EXPDIR/RESTART ${EXPDIR}/restarts/RESTART.${edate} # WW3 restart file - if( $USE_WAVES != 0 && $wavemodel == "WW3" ) then + if( $wavewatch ) then set rst_ww3 = "restart.ww3" if( -e ${rst_ww3} ) cp ${rst_ww3} ${EXPDIR}/restarts/$EXPID.${rst_ww3}.${edate}.${GCMVER}.${BCTAG}_${BCRSLV} endif @@ -839,7 +840,7 @@ endif # Set WW3 start date and time # --------------------------- -if ( $USE_WAVES != 0 && $wavemodel == "WW3" ) then +if( $wavewatch ) then cp ww3_multi.nml ww3_multi.nml.orig awk '{$1=$1};1' < ww3_multi.nml.orig > ww3_multi.nml @@ -1318,7 +1319,7 @@ end # WW3 restarts - assumes that there is at least one NEW restart file # ------------------------------------------------------------------ -if( $USE_WAVES != 0 && $wavemodel == "WW3" ) then +if( $wavewatch ) then set ww3checkpoint = `/bin/ls -1 restart[0-9][0-9][0-9].ww3 | sort -n | tail -n 1` set rst_ww3 = "restart.ww3" @@ -1437,7 +1438,7 @@ else wait cp cap_restart $EXPDIR/cap_restart - if( $USE_WAVES != 0 && $wavemodel == "WW3" ) then + if( $wavewatch ) then set rst_ww3 = "restart.ww3" /bin/rm -f $EXPDIR/$rst_ww3 cp $rst_ww3 $EXPDIR/$rst_ww3 &