From 18a234f5043a3b2d0407c747c8982e1734322aa3 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Sat, 28 Sep 2024 13:22:43 -0400 Subject: [PATCH 1/2] Set GAAS offset to CHEMISTRY_DT --- gcm_forecast.tmpl | 20 ++++++++++++++++++++ gcm_run.j | 18 ++++++++++++++++++ gcm_run_benchmark.j | 21 +++++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/gcm_forecast.tmpl b/gcm_forecast.tmpl index fd958308..6acb3f37 100755 --- a/gcm_forecast.tmpl +++ b/gcm_forecast.tmpl @@ -749,6 +749,26 @@ if( $REPLAY_MODE == 'Exact' | $REPLAY_MODE == 'Regular' ) then endif +# Update GAAS_GridComp_ExtData.yaml with CHEMISTRY_DT +# --------------------------------------------------- + +# NOTE: Even though GAAS is disabled above, we keep this code here in case this changes + +# We need to make sure GAAS has an offset that matches CHEMISTRY_DT from CAP.rc +# We also need to take that CHEMISTRY_DT and convert it to ISO duration format in seconds +# So, if CHEMISTRY_DT is 1800, we need to convert it to PT1800S +# Then in GAAS_GridComp_ExtData.yaml, we need to find: +# update_offset: PT450S +# and replace it with: +# update_offset: PT1800S +# NOTE: Since it is YAML, we need to make sure the indentation is correct +# 1. First we grab the CHEMISTRY_DT from CAP.rc +CAPRC_CHEMISTRY_DT=`grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` +# 2. Then we convert it to ISO duration format +CHEMDT_ISO_DURATION=`echo "PT${CAPRC_CHEMISTRY_DT}S"` +# 3. Then we replace the update_offset in GAAS_GridComp_ExtData.yaml +sed -i "s/update_offset: .*/update_offset: ${CHEMDT_ISO_DURATION}/" GAAS_GridComp_ExtData.yaml + # Establish safe default number of OpenMP threads # ----------------------------------------------- setenv OMP_NUM_THREADS 1 diff --git a/gcm_run.j b/gcm_run.j index d7946e8d..caf760a3 100755 --- a/gcm_run.j +++ b/gcm_run.j @@ -966,6 +966,24 @@ if( $REPLAY_MODE == 'Exact' | $REPLAY_MODE == 'Regular' ) then endif +# Update GAAS_GridComp_ExtData.yaml with CHEMISTRY_DT +# --------------------------------------------------- + +# We need to make sure GAAS has an offset that matches CHEMISTRY_DT from CAP.rc +# We also need to take that CHEMISTRY_DT and convert it to ISO duration format in seconds +# So, if CHEMISTRY_DT is 1800, we need to convert it to PT1800S +# Then in GAAS_GridComp_ExtData.yaml, we need to find: +# update_offset: PT450S +# and replace it with: +# update_offset: PT1800S +# NOTE: Since it is YAML, we need to make sure the indentation is correct +# 1. First we grab the CHEMISTRY_DT from CAP.rc +CAPRC_CHEMISTRY_DT=`grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` +# 2. Then we convert it to ISO duration format +CHEMDT_ISO_DURATION=`echo "PT${CAPRC_CHEMISTRY_DT}S"` +# 3. Then we replace the update_offset in GAAS_GridComp_ExtData.yaml +sed -i "s/update_offset: .*/update_offset: ${CHEMDT_ISO_DURATION}/" GAAS_GridComp_ExtData.yaml + # Establish safe default number of OpenMP threads # ----------------------------------------------- @MIT # --------------------------------------------------- diff --git a/gcm_run_benchmark.j b/gcm_run_benchmark.j index 64321eda..f18feb6a 100755 --- a/gcm_run_benchmark.j +++ b/gcm_run_benchmark.j @@ -827,6 +827,9 @@ if( $REPLAY_MODE == 'Exact' | $REPLAY_MODE == 'Regular' ) then # Modify GAAS_GridComp.rc and Link REPLAY files # --------------------------------------------- + /bin/mv -f GAAS_GridComp_ExtData.yaml GAAS_GridComp_ExtData.yaml.tmpl + cat GAAS_GridComp_ExtData.yaml.tmpl | sed -e "s?das.aod_?chem/Y%y4/M%m2/${ANA_EXPID}.aod_?g" > GAAS_GridComp_ExtData.yaml + /bin/mv -f GAAS_GridComp.rc GAAS_GridComp.tmp cat GAAS_GridComp.tmp | sed -e "s?aod/Y%y4/M%m2/${ANA_EXPID}.?aod/Y%y4/M%m2/${ANA_EXPID}.?g" > GAAS_GridComp.rc @@ -836,6 +839,24 @@ if( $REPLAY_MODE == 'Exact' | $REPLAY_MODE == 'Regular' ) then endif +# Update GAAS_GridComp_ExtData.yaml with CHEMISTRY_DT +# --------------------------------------------------- + +# We need to make sure GAAS has an offset that matches CHEMISTRY_DT from CAP.rc +# We also need to take that CHEMISTRY_DT and convert it to ISO duration format in seconds +# So, if CHEMISTRY_DT is 1800, we need to convert it to PT1800S +# Then in GAAS_GridComp_ExtData.yaml, we need to find: +# update_offset: PT450S +# and replace it with: +# update_offset: PT1800S +# NOTE: Since it is YAML, we need to make sure the indentation is correct +# 1. First we grab the CHEMISTRY_DT from CAP.rc +CAPRC_CHEMISTRY_DT=`grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` +# 2. Then we convert it to ISO duration format +CHEMDT_ISO_DURATION=`echo "PT${CAPRC_CHEMISTRY_DT}S"` +# 3. Then we replace the update_offset in GAAS_GridComp_ExtData.yaml +sed -i "s/update_offset: .*/update_offset: ${CHEMDT_ISO_DURATION}/" GAAS_GridComp_ExtData.yaml + # Establish safe default number of OpenMP threads # ----------------------------------------------- setenv OMP_NUM_THREADS 1 From 9621a783fde0a9f8708e82dff38205b515e84ecb Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Sun, 29 Sep 2024 12:50:24 -0400 Subject: [PATCH 2/2] Use correct tcsh --- gcm_forecast.tmpl | 4 ++-- gcm_run.j | 4 ++-- gcm_run_benchmark.j | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcm_forecast.tmpl b/gcm_forecast.tmpl index 6acb3f37..0be411a2 100755 --- a/gcm_forecast.tmpl +++ b/gcm_forecast.tmpl @@ -763,9 +763,9 @@ endif # update_offset: PT1800S # NOTE: Since it is YAML, we need to make sure the indentation is correct # 1. First we grab the CHEMISTRY_DT from CAP.rc -CAPRC_CHEMISTRY_DT=`grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` +set CAPRC_CHEMISTRY_DT = `grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` # 2. Then we convert it to ISO duration format -CHEMDT_ISO_DURATION=`echo "PT${CAPRC_CHEMISTRY_DT}S"` +set CHEMDT_ISO_DURATION = `echo "PT${CAPRC_CHEMISTRY_DT}S"` # 3. Then we replace the update_offset in GAAS_GridComp_ExtData.yaml sed -i "s/update_offset: .*/update_offset: ${CHEMDT_ISO_DURATION}/" GAAS_GridComp_ExtData.yaml diff --git a/gcm_run.j b/gcm_run.j index caf760a3..de7998e1 100755 --- a/gcm_run.j +++ b/gcm_run.j @@ -978,9 +978,9 @@ endif # update_offset: PT1800S # NOTE: Since it is YAML, we need to make sure the indentation is correct # 1. First we grab the CHEMISTRY_DT from CAP.rc -CAPRC_CHEMISTRY_DT=`grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` +set CAPRC_CHEMISTRY_DT = `grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` # 2. Then we convert it to ISO duration format -CHEMDT_ISO_DURATION=`echo "PT${CAPRC_CHEMISTRY_DT}S"` +set CHEMDT_ISO_DURATION = `echo "PT${CAPRC_CHEMISTRY_DT}S"` # 3. Then we replace the update_offset in GAAS_GridComp_ExtData.yaml sed -i "s/update_offset: .*/update_offset: ${CHEMDT_ISO_DURATION}/" GAAS_GridComp_ExtData.yaml diff --git a/gcm_run_benchmark.j b/gcm_run_benchmark.j index f18feb6a..15d884c3 100755 --- a/gcm_run_benchmark.j +++ b/gcm_run_benchmark.j @@ -851,9 +851,9 @@ endif # update_offset: PT1800S # NOTE: Since it is YAML, we need to make sure the indentation is correct # 1. First we grab the CHEMISTRY_DT from CAP.rc -CAPRC_CHEMISTRY_DT=`grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` +set CAPRC_CHEMISTRY_DT = `grep '^\s*CHEMISTRY_DT:' CAP.rc | cut -d: -f2 | awk '{print $1}'` # 2. Then we convert it to ISO duration format -CHEMDT_ISO_DURATION=`echo "PT${CAPRC_CHEMISTRY_DT}S"` +set CHEMDT_ISO_DURATION = `echo "PT${CAPRC_CHEMISTRY_DT}S"` # 3. Then we replace the update_offset in GAAS_GridComp_ExtData.yaml sed -i "s/update_offset: .*/update_offset: ${CHEMDT_ISO_DURATION}/" GAAS_GridComp_ExtData.yaml