#!/bin/bash #------------------------------------------------------------------------------ # Harvard University Atmospheric Chemistry Modeling Group ! #------------------------------------------------------------------------------ #BOP # # !MODULE: setup_1yr_rnpbbe # # !DESCRIPTION: Sets up a 1-year Rn-Pb-Be benchmark from a run directory # created by the GEOS-Chem unit tester. #\\ #\\ # !CALLING SEQUENCE: # make_1yr_run # # !REVISION HISTORY: # 14 Feb 2018 - M. Sulprizio- Initial version #EOP #------------------------------------------------------------------------------ #BOC #---------------------------------------------------------------- # Define version names #---------------------------------------------------------------- MIXING="NLPBL" #MIXING="TURBDAY" GC_VERSION="v11-02" BM_VERSION="v11-02e-RnPbBePasv-Run1-$MIXING" START_YR=2013 TEMP="temp.txt" echo "===========================================================" echo "CREATING 1-YR RUN DIRECTORY for $BM_VERSION" echo "===========================================================" echo "" #---------------------------------------------------------------- # Create subdirectories #---------------------------------------------------------------- mkdir -v bpch # For BPCH diagnostic output mkdir -v bpch/spinup1 mkdir -v bpch/spinup2 mkdir -v bpch/spinup3 mkdir -v bpch/spinup4 mkdir -v input # For input.geos files mkdir -v logs # For *.log files mkdir -v output # For 1-yr benchmark plots mkdir -v restarts # For GEOS-Chem and HEMCO restart files mkdir -v restarts/spinup1 mkdir -v restarts/spinup2 mkdir -v restarts/spinup3 mkdir -v restarts/spinup4 mkdir -v run # For run scripts #---------------------------------------------------------------- # Copy code directory #---------------------------------------------------------------- echo -e "\nCopying Code.$GC_VERSION\n" cp -r ~/GC/Code.$GC_VERSION . # Change path to code directory in Makefile OLD=' CODE_DIR :=$(HOME)/GC/Code.$(VERSION)' NEW=' CODE_DIR :=./Code.$(VERSION)' sed "s,$OLD,$NEW,g" Makefile > $TEMP && mv $TEMP Makefile #---------------------------------------------------------------- # Set up input.geos files #---------------------------------------------------------------- echo -e "Setting up input.geos files\n" mv input.geos input/ cd input/ inFiles=( "input.geos.template.spinup" "input.geos.template.production" ) # Need to replace the following text OLD1="Start YYYYMMDD, hhmmss : 20130101 000000" NEW1="Start YYYYMMDD, hhmmss : {DATE1} {TIME1}" OLD2="End YYYYMMDD, hhmmss : 20130201 000000" NEW2="End YYYYMMDD, hhmmss : {DATE2} {TIME2}" OLD3="Binary punch file name : trac_avg.geosfp_4x5_RnPbBe.YYYYMMDDhhmm" NEW3="Binary punch file name : .\/bpch\/trac_avg.{VERSION}.YYYYMMDDhhmm" OLD4=" => Use non-local PBL? : T" NEW4=" => Use non-local PBL? : F" OLD5="Save benchmark output? : F" NEW5="Save benchmark output? : T" # Loop over input files for file in ${inFiles[@]}; do cp input.geos $file # Replace text echo -e "Replacing text in $file\n" sed "s/$OLD1/$NEW1/g" "$file" > $TEMP && mv $TEMP "$file" sed "s/$OLD2/$NEW2/g" "$file" > $TEMP && mv $TEMP "$file" sed "s/$OLD3/$NEW3/g" "$file" > $TEMP && mv $TEMP "$file" if [[ ${MIXING} = "TURBDAY" ]]; then sed "s/$OLD4/$NEW4/g" "$file" > $TEMP && mv $TEMP "$file" fi if [[ ${file} = "input.geos.template.production" ]]; then sed "s/$OLD5/$NEW5/g" "$file" > $TEMP && mv $TEMP "$file" fi done # Move back to top-level run directory rm input.geos cd .. #---------------------------------------------------------------- # Set up run scripts #---------------------------------------------------------------- echo -e "Setting up run scripts\n" cp -v ~/util_scripts/bash/RnPbBePasv_benchmark/run.template run/ cp -v ~/util_scripts/bash/RnPbBePasv_benchmark/make_runscripts run/ cd run ./make_runscripts ${BM_VERSION} ${START_YR} cd .. #---------------------------------------------------------------- # Copy additional files #---------------------------------------------------------------- cp -v ~/util_scripts/bash/RnPbBePasv_benchmark/pack_1yr_run . echo "===========================================================" echo "DONE UPDATING 1-YR Rn-Pb-Be BENCHMARK RUN DIRECTORY" echo "===========================================================" # Exit normally exit 0 #EOC