From 2185d73d1d3d4b449e9e911971f00782ce5f3822 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 5 Feb 2024 11:02:39 -0500 Subject: [PATCH 1/6] 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/6] 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/6] 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 & From b804e27da1796e1cbab5a1277ee38cbb7f24480d Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 13 Feb 2024 09:09:39 -0500 Subject: [PATCH 4/6] Use nccmp, add readers/writers test to regress --- gcm_regress.j | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/gcm_regress.j b/gcm_regress.j index 3a4de0d7..79c4f9e5 100755 --- a/gcm_regress.j +++ b/gcm_regress.j @@ -692,6 +692,7 @@ if ( $RUN_LAYOUT == TRUE) then /bin/mv CAP.rc CAP.tmp cat CAP.tmp | sed -e "s?$oldstring?$newstring?g" > CAP.rc + # Set the new NX and NY ./strip AGCM.rc set oldstring = `cat AGCM.rc | grep "^ *NX:"` set newstring = "NX: ${test_NX}" @@ -701,6 +702,17 @@ if ( $RUN_LAYOUT == TRUE) then set newstring = "NY: ${test_NY}" /bin/mv AGCM.rc AGCM.tmp cat AGCM.tmp | sed -e "s?$oldstring?$newstring?g" > AGCM.rc + + # Set the new number of writers and readers + set oldstring = `cat AGCM.rc | grep "^ *NUM_WRITERS:"` + set newstring = "NUM_WRITERS: 6" + /bin/mv AGCM.rc AGCM.tmp + cat AGCM.tmp | sed -e "s?$oldstring?$newstring?g" > AGCM.rc + set oldstring = `cat AGCM.rc | grep "^ *NUM_READERS:"` + set newstring = "NUM_READERS: 6" + /bin/mv AGCM.rc AGCM.tmp + cat AGCM.tmp | sed -e "s?$oldstring?$newstring?g" > AGCM.rc + @COUPLED set oldstring = `cat AGCM.rc | grep "^ *OGCM.NX:"` @COUPLED set newstring = "OGCM.NX: ${test_NY}" @COUPLED /bin/mv AGCM.rc AGCM.tmp @@ -777,8 +789,8 @@ if ($RUN_STARTSTOP == TRUE) then if( $check == true ) then echo Comparing ${chk} - # compare binary checkpoint files - cmp $file1 $file2 + # compare NetCDF-4 checkpoint files + ${NCCMP} $file1 $file2 if( $status == 0 ) then echo Start-Stop Success! echo " " @@ -788,17 +800,6 @@ if ($RUN_STARTSTOP == TRUE) then set startstop_pass = false endif - # compare NetCDF-4 checkpoint files - # ${NCCMP} $file1 $file2 - # if( status == 0 ) then - # echo Start-Stop Success! - # echo " " - # else - # echo Start-Stop Failed! - # echo " " - # set startstop_pass = false - # endif - endif endif end @@ -915,8 +916,8 @@ if ($RUN_LAYOUT == TRUE) then if( $check == true ) then echo Comparing ${chk} - # compare binary checkpoint files - cmp $file1 $file2 + # compare NetCDF-4 checkpoint files + ${NCCMP} $file1 $file2 if( $status == 0 ) then echo Layout Success! echo " " @@ -926,17 +927,6 @@ if ($RUN_LAYOUT == TRUE) then set layout_pass = false endif - # compare NetCDF-4 checkpoint files - # ${NCCMP} $file1 $file2 - # if( status == 0 ) then - # echo Layout Success! - # echo " " - # else - # echo Layout Failed! - # echo " " - # set layout_pass = false - # endif - endif endif end From 27b387eb9ade6504c7f12e4c2c06196d276b6909 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 13 Feb 2024 09:13:40 -0500 Subject: [PATCH 5/6] Have only one NCCMP set --- gcm_regress.j | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gcm_regress.j b/gcm_regress.j index 79c4f9e5..4a2ed92a 100755 --- a/gcm_regress.j +++ b/gcm_regress.j @@ -761,6 +761,9 @@ if ( $RUN_LAYOUT == TRUE) then endif +# Set the comparison command for netCDF-4 files +set NCCMP = `echo ${BASEDIR}/${ARCH}/bin/nccmp -dmfgBq ` + ####################################################################### # Compare Restarts # for start stop regression @@ -771,8 +774,6 @@ endif if ($RUN_STARTSTOP == TRUE) then - set NCCMP = `echo ${BASEDIR}/${ARCH}/bin/nccmp -dmfgBq ` - if( -e startstop_regress_test ) /bin/rm startstop_regress_test echo "=== Comparing restarts from ${NX0}x${NY0} run of duration ${test_duration_step1} with restarts from ${test_duration_step2} + ${test_duration_step3} ${NX0}x${NY0} runs ===" @@ -898,8 +899,6 @@ endif if ($RUN_LAYOUT == TRUE) then - set NCCMP = `echo ${BASEDIR}/${ARCH}/bin/nccmp -dmfgBq ` - if( -e layout_regress_test ) /bin/rm layout_regress_test echo "=== Comparing restarts from ${NX0}x${NY0} run of duration ${test_duration_step2} with restarts from ${test_NX}x${test_NY} run of duration ${test_duration_step4} ===" @@ -961,7 +960,7 @@ if ($RUN_LAYOUT == TRUE) then if( $check == true ) then echo Comparing ${chk} - # compare checkpoint files + # compare checkpoint files ${NCCMP} $file1 $file2 if( $status == 0 ) then echo Layout Success! @@ -987,7 +986,7 @@ if ($RUN_LAYOUT == TRUE) then if( $check == true ) then echo Comparing ${hist} - # compare history files + # compare history files ${NCCMP} $file1 $file2 if( $status == 0 ) then echo Layout Success! From 91789cebd87bcbbbec39749639209369536fdabc Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 13 Feb 2024 09:14:20 -0500 Subject: [PATCH 6/6] Strip trailing whitespace --- gcm_regress.j | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcm_regress.j b/gcm_regress.j index 4a2ed92a..47ec9cb3 100755 --- a/gcm_regress.j +++ b/gcm_regress.j @@ -459,7 +459,7 @@ if( $RUN_STARTSTOP == TRUE ) then # Some replay runs also have checkpoints like mkiau_checkpoint.20150509_2200z.nc4 # and we need to move those as well if they exist - set replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` + set replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` # Need also make another variable storing all the mkiau_checkpoint files set complete_startstop_replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` foreach chk ( $replay_chk_file_names ) @@ -533,7 +533,7 @@ end # Some replay runs also have checkpoints like mkiau_checkpoint.20150509_2200z.nc4 # and we need to move those as well if they exist -set replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` +set replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` # Need also make another variable storing all the replay checkpoint files set complete_layout_replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` foreach chk ( $replay_chk_file_names ) @@ -631,7 +631,7 @@ if ($RUN_STARTSTOP == TRUE) then # Some replay runs also have checkpoints like mkiau_checkpoint.20150509_2200z.nc4 # and we need to move those as well if they exist - set replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` + set replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` foreach chk ( $replay_chk_file_names ) /bin/mv -v $chk ${chk}.${nymde1}_${nhmse1}.3 end @@ -745,7 +745,7 @@ if ( $RUN_LAYOUT == TRUE) then # Some replay runs also have checkpoints like mkiau_checkpoint.20150509_2200z.nc4 # and we need to move those as well if they exist - set replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` + set replay_chk_file_names = `ls -1 mkiau_checkpoint.*.nc4` foreach chk ( $replay_chk_file_names ) /bin/mv -v $chk ${chk}.${nymde1}_${nhmse1}.4 end