|
| 1 | +#!/bin/bash |
| 2 | +set -e |
| 3 | +umask 022 |
| 4 | + |
| 5 | +script_root=${PWD} |
| 6 | +branch="decadal-production-run6" #"decadal-production-run4" #"fix-nanobug-in-horiz-remap" #"decadal-production-run4" #"scorpio-update" |
| 7 | +code_root=${HOME}/codes/scream/branches/${branch} |
| 8 | +screamdocs_root=${HOME}/codes/scream-decadal/scream-docs |
| 9 | +res=ne1024pg2_ne1024pg2 #ne1024pg2_ne1024pg2 #ne1024pg2_ne1024pg2 #ne30pg2_EC30to60E2r2 |
| 10 | +compset=F20TR-SCREAMv1 |
| 11 | +machine="frontier-scream-gpu" #chrysalis |
| 12 | +compiler="craygnuamdgpu" #"crayclang-scream" #"craygnuamdgpu" #"crayclang-scream" #intel |
| 13 | +project="cli115" |
| 14 | +walltime="01:00:00" |
| 15 | +datestring="20240708" |
| 16 | +RUN_REFDATE="1999-04-05"; RUN_REFTOD="00000" |
| 17 | +#RUN_REFDATE="1998-09-01"; RUN_REFTOD="00000" |
| 18 | +casename=${branch}-${datestring}.${res}.${compset}.pnetcdf # NOTE: cannot change this for pseudo-branch |
| 19 | +casebase=${compiler}-branch # Need a unique id to tell us where to write run and bld so we do not overwrite original |
| 20 | +caseroot=${HOME}/codes/scream/cases/scream-decadal/${casebase}/${casename} |
| 21 | +#readonly pecount="1536x6" # 192 nodes |
| 22 | +#readonly pecount="3072x6" # 384 nodes |
| 23 | +#readonly pecount="4096x6" # 512 nodes |
| 24 | +#readonly pecount="8192x6" # 1024 nodes |
| 25 | +#readonly pecount="15056x6" # 1882 nodes |
| 26 | +if [ "${res}" == "ne1024pg2_ne1024pg2" ]; then |
| 27 | + #pecount="2560x6" # 320 nodes |
| 28 | + pecount="16384x6" # 2048 nodes |
| 29 | +elif [ "${res}" == "ne256pg2_ne256pg2" ]; then |
| 30 | + pecount="768x6" # 96 nodes |
| 31 | +elif [ "${res}" == "ne30pg2_EC30to60E2r2" ]; then |
| 32 | + pecount="16x6" |
| 33 | + #pecount=5540x1 #128x1 |
| 34 | +fi |
| 35 | +mkdir -p `dirname ${caseroot}` |
| 36 | +if [ 1 -eq 1 ]; then |
| 37 | +${code_root}/cime/scripts/create_newcase \ |
| 38 | + --case=${caseroot} \ |
| 39 | + --res=${res} \ |
| 40 | + --compset=${compset} \ |
| 41 | + --machine=${machine} \ |
| 42 | + --compiler=${compiler} \ |
| 43 | + --pecount=${pecount} \ |
| 44 | + --project=${project} \ |
| 45 | + --walltime=${walltime} |
| 46 | +fi |
| 47 | +cd ${caseroot} |
| 48 | + |
| 49 | +# Extract input_data_dir for user edits to the namelist |
| 50 | +DIN_LOC_ROOT=`./xmlquery DIN_LOC_ROOT --value` |
| 51 | + |
| 52 | +# Change run and bld directories so we can use the same casename for a pseudo-branch run |
| 53 | +./xmlchange RUNDIR=/lustre/orion/cli115/proj-shared/brhillman/e3sm_scratch/scream-decadal/${casebase}/${casename}/run |
| 54 | +./xmlchange EXEROOT=/lustre/orion/cli115/proj-shared/brhillman/e3sm_scratch/scream-decadal/${casebase}/${casename}/bld |
| 55 | + |
| 56 | +# Link to rundir |
| 57 | +#ln -s `./xmlquery --value RUNDIR` run |
| 58 | + |
| 59 | +# Change threads |
| 60 | +if [ "${machine}" == "frontier-scream-gpu" ]; then |
| 61 | + ./xmlchange --file env_mach_pes.xml NTHRDS="1" |
| 62 | + ./xmlchange --file env_mach_pes.xml NTHRDS_ATM="1" |
| 63 | + ./xmlchange --file env_mach_pes.xml NTHRDS_LND="6" |
| 64 | + ./xmlchange --file env_mach_pes.xml NTHRDS_ICE="6" |
| 65 | + ./xmlchange --file env_mach_pes.xml NTHRDS_OCN="1" |
| 66 | + ./xmlchange --file env_mach_pes.xml NTHRDS_ROF="1" |
| 67 | + ./xmlchange --file env_mach_pes.xml NTHRDS_CPL="1" |
| 68 | + ./xmlchange --file env_mach_pes.xml NTHRDS_GLC="1" |
| 69 | + ./xmlchange --file env_mach_pes.xml NTHRDS_WAV="1" |
| 70 | + #./case.setup --reset |
| 71 | +fi |
| 72 | + |
| 73 | +# Change run length |
| 74 | +./xmlchange STOP_OPTION=ndays,STOP_N=1 |
| 75 | +./xmlchange REST_OPTION=ndays,REST_N=1 |
| 76 | +./xmlchange RESUBMIT=0 |
| 77 | +./xmlchange RUN_STARTDATE="1994-10-01" |
| 78 | + |
| 79 | +# Configure for (pseudo) branch run |
| 80 | +if [ 1 -eq 1 ]; then |
| 81 | + RUN_REFDIR="/lustre/orion/cli115/proj-shared/brhillman/e3sm_scratch/decadal-production-run6-20240708.ne1024pg2_ne1024pg2.F20TR-SCREAMv1.pnetcdf/run" |
| 82 | + ./xmlchange RUN_TYPE="startup" |
| 83 | + #./xmlchange RUN_REFCASE="decadal-production-run6-20240708.ne1024pg2_ne1024pg2.F20TR-SCREAMv1.pnetcdf" |
| 84 | + #./xmlchange RUN_REFDIR=${RUN_REFDIR} |
| 85 | + #./xmlchange RUN_REFDATE=${RUN_REFDATE} |
| 86 | + #./xmlchange RUN_REFTOD=${RUN_REFTOD} |
| 87 | + #./xmlchange GET_REFCASE="FALSE" |
| 88 | + ./xmlchange CONTINUE_RUN=TRUE |
| 89 | + # Copy files ourselves |
| 90 | + RUNDIR=`./xmlquery --value RUNDIR` |
| 91 | + mkdir -p ${RUNDIR} |
| 92 | + cp ${RUN_REFDIR}/rpointer.??? ${RUNDIR} |
| 93 | + for file in ${RUNDIR}/rpointer.???; do |
| 94 | + sed -i "s/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-00000/${RUN_REFDATE}-${RUN_REFTOD}/" ${file} |
| 95 | + for f in `cat ${file}`; do |
| 96 | + echo ${f} |
| 97 | + if [ -f ${RUN_REFDIR}/${f} ] && [ ! -f ${RUNDIR}/`basename ${f}` ]; then |
| 98 | + ln -s ${RUN_REFDIR}/`basename ${f}` ${RUNDIR}/`basename ${f}` |
| 99 | + fi |
| 100 | + done |
| 101 | + done |
| 102 | + # Also need to copy the rh files, which might not be picked up in rpointer files |
| 103 | + for file in ${RUN_REFDIR}/*.rh[0-9].${RUN_REFDATE}-${RUN_REFTOD}.nc; do |
| 104 | + if [ ! -f ${RUNDIR}/`basename ${file}` ]; then |
| 105 | + ln -s ${file} ${RUNDIR}/ |
| 106 | + fi |
| 107 | + done |
| 108 | + # And copy .bin file from correct dummy case |
| 109 | + RUN_REFDIR="/lustre/orion/cli115/proj-shared/brhillman/e3sm_scratch/scream-decadal/craygnuamdgpu-gen-docn/decadal-production-run6-20240708.ne1024pg2_ne1024pg2.F20TR-SCREAMv1.pnetcdf/run" |
| 110 | + for file in ${RUN_REFDIR}/*.${RUN_REFDATE}-${RUN_REFTOD}.bin; do |
| 111 | + if [ -e ${RUNDIR}/`basename ${file}` ]; then |
| 112 | + rm ${RUNDIR}/`basename ${file}` |
| 113 | + fi |
| 114 | + ln -s ${file} ${RUNDIR}/ |
| 115 | + done |
| 116 | +fi |
| 117 | + |
| 118 | +# Turn on budget reporting |
| 119 | +./xmlchange BUDGETS=TRUE |
| 120 | + |
| 121 | +# For big data |
| 122 | +./xmlchange PIO_NETCDF_FORMAT="64bit_data" |
| 123 | +./xmlchange PIO_TYPENAME=pnetcdf #adios #,PIO_TYPENAME_ATM=adios |
| 124 | +./xmlchange PIO_REARRANGER=1 # use PIO_REARRANGER=3, for ADIOS; PIO_REARRANGER=1 for pnetcdf |
| 125 | +if [ "${pecount}" == "2560x6" ]; then |
| 126 | + ./xmlchange PIO_STRIDE=4 #BRHDEBUG only needed for small node counts |
| 127 | +fi |
| 128 | + |
| 129 | +# Change to non-parallel netcdf |
| 130 | +#sed -i 's|<command name="load">cray-hdf5-parallel.*|<command name="load">cray-hdf5/1.12.1.5</command>|' env_mach_specific.xml |
| 131 | +#sed -i 's|<command name="load">cray-netcdf-hdf5parallel.*|<command name="load">cray-netcdf/4.8.1.5</command>|' env_mach_specific.xml |
| 132 | + |
| 133 | +# Run setup before configuring components |
| 134 | +./case.setup |
| 135 | + |
| 136 | +# Automatic restarts on regex |
| 137 | +#./xmlchange NODE_FAIL_REGEX='' |
| 138 | +#./xmlchange ALLOCATE_SPARE_NODES=TRUE |
| 139 | +#./xmlchange MPIRUN_RETRY_REGEX='' |
| 140 | +#./xmlchange MPIRUN_RETRY_COUNT=1 |
| 141 | + |
| 142 | +# Extra diagnostics for non-determinism debugging |
| 143 | +#./atmchange --all \ |
| 144 | +# internal_diagnostics_level=1 \ |
| 145 | +# atmosphere_processes::internal_diagnostics_level=0 \ |
| 146 | +# ctl_nl::internal_diagnostics_level=0 |
| 147 | + |
| 148 | +# Namelist options for EAMxx |
| 149 | +if [ "${res}" == "ne1024pg2_ne1024pg2" ]; then |
| 150 | + ./atmchange initial_conditions::Filename="${DIN_LOC_ROOT}/atm/scream/init/screami_ne1024np4L128_era5-19941001-topoadjx6t_20240214.nc" |
| 151 | +elif [ "${res}" == "ne256pg2_ne256pg2" ]; then |
| 152 | + ./atmchange initial_conditions::Filename="${DIN_LOC_ROOT}/atm/scream/init/screami_ne256np4L128_era5-19941001-topoadjx6t_20240123.nc" |
| 153 | +fi |
| 154 | + |
| 155 | +# Run with bugfixed SPA file |
| 156 | +./atmchange spa_data_file="${DIN_LOC_ROOT}/atm/scream/init/spa_v3.LR.F2010.2011-2025.c_20240405.nc" |
| 157 | + |
| 158 | +# Turn on cosp and set frequency |
| 159 | +./atmchange physics::atm_procs_list="mac_aero_mic,rrtmgp,cosp" |
| 160 | +./atmchange physics::cosp::cosp_frequency_units="hours" |
| 161 | +./atmchange physics::cosp::cosp_frequency=1 |
| 162 | + |
| 163 | +# Need to explicitly turn on computing tendencies |
| 164 | +./atmchange physics::mac_aero_mic::shoc::compute_tendencies=T_mid,qv |
| 165 | +./atmchange physics::mac_aero_mic::p3::compute_tendencies=T_mid,qv |
| 166 | +./atmchange physics::rrtmgp::compute_tendencies=T_mid |
| 167 | +./atmchange homme::compute_tendencies=T_mid,qv |
| 168 | + |
| 169 | +# Set temperature cut off in dycore threshold to 180K |
| 170 | +./atmchange vtheta_thresh=180 |
| 171 | + |
| 172 | +# Change lambda_high |
| 173 | +./atmchange lambda_high=0.08 |
| 174 | + |
| 175 | +# use GHG levels more appropriate for sim |
| 176 | +# Average from 19940101 - 20150101 |
| 177 | +./atmchange co2vmr=377.2e-6 |
| 178 | +./atmchange ch4vmr=1786.6e-9 |
| 179 | +./atmchange n2ovmr=318.6e-9 |
| 180 | +./atmchange orbital_year=-9999 |
| 181 | +# use CO2 the same in land model |
| 182 | +./xmlchange CCSM_CO2_PPMV=377.2 |
| 183 | + |
| 184 | +# Copy output stream yaml files |
| 185 | +if [ "${res}" == "ne1024pg2_ne1024pg2" ]; then |
| 186 | + map_to_ne30="${DIN_LOC_ROOT}/atm/scream/maps/map_ne1024pg2_to_ne30pg2_mono.20230901.nc" |
| 187 | + map_to_DecadalSites="${DIN_LOC_ROOT}/atm/scream/maps/map_ne1024pg2_to_DecadalSites_c20240130.nc" |
| 188 | +elif [ "${res}" == "ne256pg2_ne256pg2" ]; then |
| 189 | + map_to_ne30="${DIN_LOC_ROOT}/atm/scream/maps/map_ne256pg2_to_ne30pg2_traave.20240206.nc" |
| 190 | + map_to_DecadalSites="${DIN_LOC_ROOT}/atm/scream/maps/map_ne256pg2_to_DecadalSites_c20240130.nc" |
| 191 | +else |
| 192 | + echo "Unsupported res for horiz maps" |
| 193 | + exit 1 |
| 194 | +fi |
| 195 | +output_yaml_files=(`ls ${screamdocs_root}/v1_output/decadal/*.yaml`) |
| 196 | +for file in ${output_yaml_files[@]}; do |
| 197 | + # TODO: add remap file replacement for different grids |
| 198 | + cp -v ${file} ./ |
| 199 | + if [ "${file}" == "${output_yaml_files[0]}" ]; then |
| 200 | + # First file, reset output list |
| 201 | + ./atmchange output_yaml_files="./`basename ${file}`" |
| 202 | + else |
| 203 | + # Append to output list |
| 204 | + ./atmchange output_yaml_files+="./`basename ${file}`" |
| 205 | + fi |
| 206 | + # Replace remap files |
| 207 | + sed -i "s|horiz_remap_file:.*_to_ne30.*|horiz_remap_file: ${map_to_ne30}|" ./`basename ${file}` |
| 208 | + sed -i "s|horiz_remap_file:.*_to_DecadalSites.*|horiz_remap_file: ${map_to_DecadalSites}|" ./`basename ${file}` |
| 209 | +done |
| 210 | + |
| 211 | +# Namelist options for ELM |
| 212 | +# Specify land initial condition and surface datasets |
| 213 | +if [ "${res}" == "ne1024pg2_ne1024pg2" ]; then |
| 214 | +cat << EOF >> user_nl_elm |
| 215 | + ! Set input data paths |
| 216 | + finidat = "${DIN_LOC_ROOT}/lnd/clm2/initdata/20231226.I2010CRUELM.ne1024pg2_ICOS10.elm.r.1994-10-01-00000.nc" |
| 217 | + flanduse_timeseries = "${DIN_LOC_ROOT}/lnd/clm2/surfdata_map/landuse.timeseries_ne1024pg2_historical_simyr1990-2014_c240109.nc" |
| 218 | + fsurdat = "${DIN_LOC_ROOT}/lnd/clm2/surfdata_map/surfdata_ne1024pg2_simyr2010_c211021.nc" |
| 219 | +EOF |
| 220 | +elif [ "${res}" == "ne256pg2_ne256pg2" ]; then |
| 221 | +cat << EOF >> user_nl_elm |
| 222 | + ! Set input data paths |
| 223 | + finidat = "${DIN_LOC_ROOT}/lnd/clm2/initdata/20240104.I2010CRUELM.ne256pg2.elm.r.1994-10-01-00000.nc" |
| 224 | + flanduse_timeseries = "${DIN_LOC_ROOT}/lnd/clm2/surfdata_map/landuse.timeseries_ne256pg2_hist_simyr1850-2015_c240131.nc" |
| 225 | + fsurdat = "${DIN_LOC_ROOT}/lnd/clm2/surfdata_map/surfdata_ne256pg2_simyr1850_c240131.nc" |
| 226 | +EOF |
| 227 | +elif [ "${res}" == "ne30pg2_EC30to60E2r2" ]; then |
| 228 | +cat << EOF >> user_nl_elm |
| 229 | + finidat = "$DIN_LOC_ROOT/lnd/clm2/initdata/20210802.ICRUELM-1950.ne30pg2_EC30to60E2r2.elm.r.0051-01-01-00000.nc" |
| 230 | + flanduse_timeseries = "${DIN_LOC_ROOT}/lnd/clm2/surfdata_map/landuse.timeseries_ne30np4.pg2_hist_simyr1850-2015_c210113.nc" |
| 231 | + fsurdat = "${DIN_LOC_ROOT}/lnd/clm2/surfdata_map/surfdata_ne30pg2_simyr1850_c230417_with_TOP.nc" |
| 232 | +EOF |
| 233 | +fi |
| 234 | + |
| 235 | +# Additional settings for land |
| 236 | +# TODO: revisit whether or not we need daily means? |
| 237 | +cat << EOF >> user_nl_elm |
| 238 | + ! Override consistency checks since we know our surface data is inconsistent |
| 239 | + check_finidat_fsurdat_consistency = .false. |
| 240 | + check_finidat_year_consistency = .false. |
| 241 | + check_finidat_pct_consistency = .false. |
| 242 | + check_dynpft_consistency = .false. |
| 243 | +
|
| 244 | + ! Make sure we do transient PFTs |
| 245 | + do_transient_pfts = .true. |
| 246 | + |
| 247 | + hist_dov2xy = .true.,.true. |
| 248 | + hist_mfilt = 1,1 |
| 249 | + hist_nhtfrq = 0,-24 |
| 250 | + hist_avgflag_pertape = 'A','A' |
| 251 | + hist_fincl1 = 'FIRE', 'FPSN', 'QDRAI', 'QRUNOFF', 'ZWT', 'FSAT', 'H2OSOI', 'EFLX_LH_TOT', |
| 252 | + 'QVEGT', 'QVEGE', 'FSH', 'ALBD', 'ALBI', 'TBOT', 'QBOT', 'RAIN', 'SNOW', |
| 253 | + 'FSDS', 'FSDSND', 'FSDSNI', 'FSDSVD', 'FSDSVI', 'FLDS' |
| 254 | + hist_fincl2 = 'H2OSNO','SOILWATER_10CM','TG' |
| 255 | +EOF |
| 256 | + |
| 257 | +# Set MOSART initial condition |
| 258 | +if [ "${res}" == "ne1024pg2_ne1024pg2" ]; then |
| 259 | +cat << EOF >> user_nl_mosart |
| 260 | + finidat_rtm = "${DIN_LOC_ROOT}/rof/mosart/initdata/20231226.I2010CRUELM.ne1024pg2_ICOS10.mosart.r.1994-10-01-00000.nc" |
| 261 | +EOF |
| 262 | +elif [ "${res}" == "ne256pg2_ne256pg2" ]; then |
| 263 | +cat << EOF >> user_nl_mosart |
| 264 | + finidat_rtm = "${DIN_LOC_ROOT}/rof/mosart/initdata/20240104.I2010CRUELM.ne256pg2.mosart.r.1994-10-01-00000.nc" |
| 265 | +EOF |
| 266 | +fi |
| 267 | + |
| 268 | +# Coupler settings; new surface flux scheme |
| 269 | +cat << EOF >> user_nl_cpl |
| 270 | + ocn_surface_flux_scheme = 2 |
| 271 | +EOF |
| 272 | + |
| 273 | +# Point to new SST forcing |
| 274 | +./xmlchange --file env_run.xml --id SSTICE_DATA_FILENAME --val "${DIN_LOC_ROOT}/atm/cam/sst/sst_ostia_3600x7200_19940930_20151231_c20240125.nc" |
| 275 | +./xmlchange --file env_run.xml --id SSTICE_GRID_FILENAME --val "${DIN_LOC_ROOT}/ocn/docn7/domain.ocn.3600x7200.230522.nc" |
| 276 | +./xmlchange --file env_run.xml --id SSTICE_YEAR_ALIGN --val 1994 |
| 277 | +./xmlchange --file env_run.xml --id SSTICE_YEAR_START --val 1994 |
| 278 | +./xmlchange --file env_run.xml --id SSTICE_YEAR_END --val 2015 |
| 279 | + |
| 280 | +# Copy runscript to case dir |
| 281 | +cp ${script_root}/`basename $0` ./ |
| 282 | + |
| 283 | +# Setup, build, run |
| 284 | +./case.setup |
| 285 | +./case.build |
| 286 | +#./case.submit -a="--job-name=decadal-amip -t 12:00:00 --mail-type=ALL [email protected] -x frontier08656 --account=cli115" # --gpu-srange=800-1600" |
| 287 | +./case.submit -a= "--job-name=decadal-amip -t ${walltime} --qos=debug --mail-type=ALL [email protected] -x frontier08656 --account=cli115" # --gpu-srange=800-1600" |
| 288 | +echo "${caseroot}" |
0 commit comments