Advertisement
Guest User

run_cctm script

a guest
Mar 30th, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.75 KB | None | 0 0
  1. #!/bin/csh -f
  2. #SBATCH --job-name=CMAQ_Benchmark
  3. #SBATCH --partition=interactive
  4. #SBATCH --nodes=1
  5. #SBATCH --ntasks=16
  6. #SBATCH --mem-per-cpu=1G
  7. #SBATCH --time 00:30:00
  8. #SBATCH --mail-user=gap6@rice.edu
  9. #SBATCH --mail-type=ALL
  10. #SBATCH --export=ALL
  11.  
  12.  
  13. # ===================== CCTMv5.4.X Run Script =========================
  14. # Usage: run.cctm >&! cctm_Bench_2018_12SE1.log &
  15. #
  16. # To report problems or request help with this script/program:
  17. # http://www.epa.gov/cmaq (EPA CMAQ Website)
  18. # http://www.cmascenter.org (CMAS Website)
  19. # ===================================================================
  20.  
  21. # ===================================================================
  22. #> Runtime Environment Options
  23. # ===================================================================
  24. setenv compiler gcc
  25. setenv compilerVrsn 9.3.0
  26.  
  27. echo 'Start Model Run At ' `date`
  28.  
  29. #> Toggle Diagnostic Mode which will print verbose information to
  30. #> standard output
  31. setenv CTM_DIAG_LVL 0
  32.  
  33. #> Choose compiler and set up CMAQ environment with correct
  34. #> libraries using config.cmaq. Options: intel | gcc | pgi
  35. if ( ! $?compiler ) then
  36. setenv compiler gcc
  37. endif
  38. if ( ! $?compilerVrsn ) then
  39. setenv compilerVrsn 9.3.0
  40. endif
  41.  
  42. #> Source the config.cmaq file to set the build environment
  43. cd ../..
  44. source ./config_cmaq.csh $compiler $compilerVrsn
  45. cd CCTM/scripts
  46.  
  47. #> Set General Parameters for Configuring the Simulation
  48. set VRSN = v54 #> Code Version
  49. set PROC = mpi #> serial or mpi
  50. set MECH = cb6r5_ae7_aq #> Mechanism ID
  51. set APPL = Bench_2018_12NE3 #> Application Name (e.g. Gridname)
  52.  
  53. #> Define RUNID as any combination of parameters above or others. By default,
  54. #> this information will be collected into this one string, $RUNID, for easy
  55. #> referencing in output binaries and log files as well as in other scripts.
  56. setenv RUNID ${VRSN}_${compilerString}_${APPL}
  57.  
  58. #> Set the build directory (this is where the CMAQ executable
  59. #> is located by default).
  60. set BLD = ${CMAQ_HOME}/CCTM/scripts/BLD_CCTM_${VRSN}_${compilerString}
  61. set EXEC = CCTM_${VRSN}.exe
  62.  
  63. #> Output Each line of Runscript to Log File
  64. if ( $CTM_DIAG_LVL != 0 ) set echo
  65.  
  66. #> Set Working, Input, and Output Directories
  67. setenv WORKDIR ${CMAQ_HOME}/CCTM/scripts #> Working Directory. Where the runscript is.
  68. setenv OUTDIR ${CMAQ_DATA}/output_CCTM_${RUNID} #> Output Directory
  69. setenv INPDIR ${CMAQ_DATA}/2018_12NE3 #> Input Directory
  70. setenv LOGDIR ${OUTDIR}/LOGS #> Log Directory Location
  71. setenv NMLpath ${BLD} #> Location of Namelists. Common places are:
  72. #> ${WORKDIR} | ${CCTM_SRC}/MECHS/${MECH} | ${BLD}
  73.  
  74. echo ""
  75. echo "Working Directory is $WORKDIR"
  76. echo "Build Directory is $BLD"
  77. echo "Output Directory is $OUTDIR"
  78. echo "Log Directory is $LOGDIR"
  79. echo "Executable Name is $EXEC"
  80.  
  81. # =====================================================================
  82. #> CCTM Configuration Options
  83. # =====================================================================
  84.  
  85. #> Set Start and End Days for looping
  86. setenv NEW_START TRUE #> Set to FALSE for model restart
  87. set START_DATE = "2018-07-01" #> beginning date (July 1, 2016)
  88. set END_DATE = "2018-07-01" #> ending date (July 1, 2016)
  89.  
  90. #> Set Timestepping Parameters
  91. set STTIME = 000000 #> beginning GMT time (HHMMSS)
  92. set NSTEPS = 240000 #> time duration (HHMMSS) for this run
  93. set TSTEP = 010000 #> output time step interval (HHMMSS)
  94.  
  95. #> Horizontal domain decomposition
  96. if ( $PROC == serial ) then
  97. setenv NPCOL_NPROW "1 1"; set NPROCS = 1 # single processor setting
  98. else
  99. @ NPCOL = 8; @ NPROW = 2
  100. @ NPROCS = $NPCOL * $NPROW
  101. setenv NPCOL_NPROW "$NPCOL $NPROW";
  102. endif
  103.  
  104. #> Define Execution ID: e.g. [CMAQ-Version-Info]_[User]_[Date]_[Time]
  105. if ( ! -e ${BLD}/CCTM_${VRSN}.cfg ) then
  106. set SHAID = ""
  107. else
  108. set SHAID = `grep "sha_ID" ${BLD}/CCTM_${VRSN}.cfg | cut -c 13-22`
  109. if ( $SHAID == not_a_repo ) then
  110. set SHAID = ""
  111. else
  112. set SHAID = "_sha="$SHAID
  113. endif
  114. endif
  115. setenv EXECUTION_ID "CMAQ_CCTM${VRSN}${SHAID}_`id -u -n`_`date -u +%Y%m%d_%H%M%S_%N`" #> Inform IO/API of the Execution ID
  116. echo ""
  117. echo "---CMAQ EXECUTION ID: $EXECUTION_ID ---"
  118.  
  119. #> Keep or Delete Existing Output Files
  120. set CLOBBER_DATA = TRUE
  121.  
  122. #> Logfile Options
  123. #> Master Log File Name; uncomment to write standard output to a log, otherwise write to screen
  124. #setenv LOGFILE $CMAQ_HOME/$RUNID.log
  125. if (! -e $LOGDIR ) then
  126. mkdir -p $LOGDIR
  127. endif
  128. setenv PRINT_PROC_TIME Y #> Print timing for all science subprocesses to Logfile
  129. #> [ default: TRUE or Y ]
  130. setenv STDOUT T #> Override I/O-API trying to write information to both the processor
  131. #> logs and STDOUT [ options: T | F ]
  132.  
  133. setenv GRID_NAME 2018_12NE3 #> check GRIDDESC file for GRID_NAME options
  134. setenv GRIDDESC $INPDIR//met/mcipv5.4/GRIDDESC #> grid description file
  135.  
  136. #> Retrieve the number of columns, rows, and layers in this simulation
  137. set NZ = 35
  138. set NX = `grep -A 1 ${GRID_NAME} ${GRIDDESC} | tail -1 | sed 's/ */ /g' | cut -d' ' -f6`
  139. set NY = `grep -A 1 ${GRID_NAME} ${GRIDDESC} | tail -1 | sed 's/ */ /g' | cut -d' ' -f7`
  140. set NCELLS = `echo "${NX} * ${NY} * ${NZ}" | bc -l`
  141.  
  142. #> Output Species and Layer Options
  143. #> CONC file species; comment or set to "ALL" to write all species to CONC
  144. setenv CONC_SPCS "O3 NO ANO3I ANO3J NO2 FORM ISOP NH3 ANH4I ANH4J ASO4I ASO4J"
  145. setenv CONC_BLEV_ELEV " 1 1" #> CONC file layer range; comment to write all layers to CONC
  146.  
  147. #> ACONC file species; comment or set to "ALL" to write all species to ACONC
  148. #setenv AVG_CONC_SPCS "O3 NO CO NO2 ASO4I ASO4J NH3"
  149. setenv AVG_CONC_SPCS "ALL"
  150. setenv ACONC_BLEV_ELEV " 1 1" #> ACONC file layer range; comment to write all layers to ACONC
  151. setenv AVG_FILE_ENDTIME N #> override default beginning ACONC timestamp [ default: N ]
  152.  
  153. #> Synchronization Time Step and Tolerance Options
  154. setenv CTM_MAXSYNC 300 #> max sync time step (sec) [ default: 720 ]
  155. setenv CTM_MINSYNC 60 #> min sync time step (sec) [ default: 60 ]
  156. setenv SIGMA_SYNC_TOP 0.7 #> top sigma level thru which sync step determined [ default: 0.7 ]
  157. #setenv ADV_HDIV_LIM 0.95 #> maximum horiz. div. limit for adv step adjust [ default: 0.9 ]
  158. setenv CTM_ADV_CFL 0.95 #> max CFL [ default: 0.75]
  159. #setenv RB_ATOL 1.0E-09 #> global ROS3 solver absolute tolerance [ default: 1.0E-07 ]
  160.  
  161. #> Science Options
  162. setenv CTM_OCEAN_CHEM Y #> Flag for ocean halogen chemistry, sea spray aerosol emissions,
  163. #> and enhanced ozone deposition over ocean waters [ default: Y ]
  164. setenv CTM_WB_DUST N #> use inline windblown dust emissions (only for use with PX) [ default: N ]
  165. setenv CTM_LTNG_NO N #> turn on lightning NOx [ default: N ]
  166. setenv KZMIN Y #> use Min Kz option in edyintb [ default: Y ],
  167. #> otherwise revert to Kz0UT
  168. setenv PX_VERSION Y #> WRF PX LSM
  169. setenv CLM_VERSION N #> WRF CLM LSM
  170. setenv NOAH_VERSION N #> WRF NOAH LSM
  171. setenv CTM_ABFLUX Y #> ammonia bi-directional flux for in-line deposition
  172. #> velocities [ default: N ]
  173. setenv CTM_BIDI_FERT_NH3 T #> subtract fertilizer NH3 from emissions because it will be handled
  174. #> by the BiDi calculation [ default: Y ]
  175. setenv CTM_HGBIDI N #> mercury bi-directional flux for in-line deposition
  176. #> velocities [ default: N ]
  177. setenv CTM_SFC_HONO Y #> surface HONO interaction [ default: Y ]
  178. #> please see user guide (6.10.4 Nitrous Acid (HONO))
  179. #> for dependency on percent urban fraction dataset
  180. setenv CTM_GRAV_SETL Y #> vdiff aerosol gravitational sedimentation [ default: Y ]
  181.  
  182. setenv CTM_BIOGEMIS_BE Y #> calculate in-line biogenic emissions with BEIS [ default: N ]
  183. setenv CTM_BIOGEMIS_MG N #> turns on MEGAN biogenic emission [ default: N ]
  184. setenv BDSNP_MEGAN N #> turns on BDSNP soil NO emissions [ default: N ]
  185.  
  186. #> Surface Tiled Aerosol and Gaseous Exchange Options
  187. #> Only active if DepMod=stage at compile time
  188. setenv CTM_MOSAIC N #> Output landuse specific deposition velocities [ default: N ]
  189. setenv CTM_STAGE_P22 N #> Pleim et al. 2022 Aerosol deposition model [default: N]
  190. setenv CTM_STAGE_E20 Y #> Emerson et al. 2020 Aerosol deposition model [default: Y]
  191. setenv CTM_STAGE_S22 N #> Shu et al. 2022 (CMAQ v5.3) Aerosol deposition model [default: N]
  192.  
  193. setenv IC_AERO_M2WET F #> Specify whether or not initial condition aerosol size distribution
  194. #> is wet or dry [ default: F = dry ]
  195. setenv BC_AERO_M2WET F #> Specify whether or not boundary condition aerosol size distribution
  196. #> is wet or dry [ default: F = dry ]
  197. setenv IC_AERO_M2USE F #> Specify whether or not to use aerosol surface area from initial
  198. #> conditions [ default: T = use aerosol surface area ]
  199. setenv BC_AERO_M2USE F #> Specify whether or not to use aerosol surface area from boundary
  200. #> conditions [ default: T = use aerosol surface area ]
  201.  
  202.  
  203. #> Vertical Extraction Options
  204. setenv VERTEXT N
  205. setenv VERTEXT_COORD_PATH ${WORKDIR}/lonlat.csv
  206.  
  207. #> I/O Controls
  208. setenv IOAPI_LOG_WRITE F #> turn on excess WRITE3 logging [ options: T | F ]
  209. setenv FL_ERR_STOP N #> stop on inconsistent input files
  210. setenv PROMPTFLAG F #> turn on I/O-API PROMPT*FILE interactive mode [ options: T | F ]
  211. setenv IOAPI_OFFSET_64 YES #> support large timestep records (>2GB/timestep record) [ options: YES | NO ]
  212. setenv IOAPI_CHECK_HEADERS N #> check file headers [ options: Y | N ]
  213. setenv CTM_EMISCHK N #> Abort CMAQ if missing surrogates from emissions Input files
  214.  
  215. #> Diagnostic Output Flags
  216. setenv CTM_CKSUM Y #> checksum report [ default: Y ]
  217. setenv CLD_DIAG N #> cloud diagnostic file [ default: N ]
  218.  
  219. setenv CTM_PHOTDIAG N #> photolysis diagnostic file [ default: N ]
  220. setenv NLAYS_PHOTDIAG "1" #> Number of layers for PHOTDIAG2 and PHOTDIAG3 from
  221. #> Layer 1 to NLAYS_PHOTDIAG [ default: all layers ]
  222. #setenv NWAVE_PHOTDIAG "294 303 310 316 333 381 607" #> Wavelengths written for variables
  223. #> in PHOTDIAG2 and PHOTDIAG3
  224. #> [ default: all wavelengths ]
  225.  
  226. setenv CTM_SSEMDIAG N #> sea-spray emissions diagnostic file [ default: N ]
  227. setenv CTM_DUSTEM_DIAG N #> windblown dust emissions diagnostic file [ default: N ];
  228. #> Ignore if CTM_WB_DUST = N
  229. setenv CTM_DEPV_FILE N #> deposition velocities diagnostic file [ default: N ]
  230. setenv VDIFF_DIAG_FILE N #> vdiff & possibly aero grav. sedimentation diagnostic file [ default: N ]
  231. setenv LTNGDIAG N #> lightning diagnostic file [ default: N ]
  232. setenv B3GTS_DIAG N #> BEIS mass emissions diagnostic file [ default: N ]
  233. setenv CTM_WVEL Y #> save derived vertical velocity component to conc
  234. #> file [ default: Y ]
  235.  
  236. # =====================================================================
  237. #> Input Directories and Filenames
  238. # =====================================================================
  239.  
  240. set ICpath = $INPDIR/icbc #> initial conditions input directory
  241. set BCpath = $INPDIR/icbc #> boundary conditions input directory
  242. set EMISpath = $INPDIR/emis #> gridded emissions input directory
  243. set IN_PTpath = $INPDIR/emis #> point source emissions input directory
  244. set IN_LTpath = $INPDIR/lightning #> lightning NOx input directory
  245. set METpath = $INPDIR/met/mcipv5.4 #> meteorology input directory
  246. #set JVALpath = $INPDIR/jproc #> offline photolysis rate table directory
  247. set OMIpath = $BLD #> ozone column data for the photolysis model
  248. set EPICpath = $INPDIR/epic #> EPIC putput for bidirectional NH3
  249. set SZpath = $INPDIR/surface #> surf zone file for in-line seaspray emissions
  250.  
  251. # =====================================================================
  252. #> Begin Loop Through Simulation Days
  253. # =====================================================================
  254. set rtarray = ""
  255.  
  256. set TODAYG = ${START_DATE}
  257. set TODAYJ = `date -ud "${START_DATE}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
  258. set START_DAY = ${TODAYJ}
  259. set STOP_DAY = `date -ud "${END_DATE}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
  260. set NDAYS = 0
  261.  
  262. while ($TODAYJ <= $STOP_DAY ) #>Compare dates in terms of YYYYJJJ
  263.  
  264. set NDAYS = `echo "${NDAYS} + 1" | bc -l`
  265.  
  266. #> Retrieve Calendar day Information
  267. set YYYYMMDD = `date -ud "${TODAYG}" +%Y%m%d` #> Convert YYYY-MM-DD to YYYYMMDD
  268. set YYYYMM = `date -ud "${TODAYG}" +%Y%m` #> Convert YYYY-MM-DD to YYYYMM
  269. set YYMMDD = `date -ud "${TODAYG}" +%y%m%d` #> Convert YYYY-MM-DD to YYMMDD
  270. set MM = `date -ud "${TODAYG}" +%m` #> Convert YYYY-MM-DD to MM
  271. set YYYYJJJ = $TODAYJ
  272.  
  273. #> Calculate Yesterday's Date
  274. set YESTERDAY = `date -ud "${TODAYG}-1days" +%Y%m%d` #> Convert YYYY-MM-DD to YYYYJJJ
  275.  
  276. # =====================================================================
  277. #> Set Output String and Propagate Model Configuration Documentation
  278. # =====================================================================
  279. echo ""
  280. echo "Set up input and output files for Day ${TODAYG}."
  281.  
  282. #> set output file name extensions
  283. setenv CTM_APPL ${RUNID}_${YYYYMMDD}
  284.  
  285. #> Copy Model Configuration To Output Folder
  286. if ( ! -d "$OUTDIR" ) mkdir -p $OUTDIR
  287. cp $BLD/CCTM_${VRSN}.cfg $OUTDIR/CCTM_${CTM_APPL}.cfg
  288.  
  289. # =====================================================================
  290. #> Input Files (Some are Day-Dependent)
  291. # =====================================================================
  292.  
  293. #> Initial conditions
  294. if ($NEW_START == true || $NEW_START == TRUE ) then
  295. setenv ICFILE CCTM_ICON_v54_${MECH}_12NE3_20180701.nc
  296. setenv INIT_MEDC_1 notused
  297. else
  298. set ICpath = $OUTDIR
  299. setenv ICFILE CCTM_CGRID_${RUNID}_${YESTERDAY}.nc
  300. setenv INIT_MEDC_1 $ICpath/CCTM_MEDIA_CONC_${RUNID}_${YESTERDAY}.nc
  301. endif
  302.  
  303. #> Boundary conditions
  304. set BCFILE = CCTM_BCON_v54_${MECH}_12NE3_${YYYYMMDD}.nc
  305.  
  306. #> Off-line photolysis rates
  307. #set JVALfile = JTABLE_${YYYYJJJ}
  308.  
  309. #> Ozone column data
  310. set OMIfile = OMI_1979_to_2019.dat
  311.  
  312. #> Optics file
  313. set OPTfile = PHOT_OPTICS.dat
  314.  
  315. #> MCIP meteorology files
  316. setenv GRID_BDY_2D $METpath/GRIDBDY2D_12NE3_${YYYYMMDD}.nc # GRID files are static, not day-specific
  317. setenv GRID_CRO_2D $METpath/GRIDCRO2D_12NE3_${YYYYMMDD}.nc
  318. setenv GRID_CRO_3D $METpath/GRIDCRO3D_12NE3_${YYYYMMDD}.nc
  319. setenv GRID_DOT_2D $METpath/GRIDDOT2D_12NE3_${YYYYMMDD}.nc
  320. setenv MET_CRO_2D $METpath/METCRO2D_12NE3_${YYYYMMDD}.nc
  321. setenv MET_CRO_3D $METpath/METCRO3D_12NE3_${YYYYMMDD}.nc
  322. setenv MET_DOT_3D $METpath/METDOT3D_12NE3_${YYYYMMDD}.nc
  323. setenv MET_BDY_3D $METpath/METBDY3D_12NE3_${YYYYMMDD}.nc
  324. setenv LUFRAC_CRO $METpath/LUFRAC_CRO_12NE3_${YYYYMMDD}.nc
  325.  
  326. #> Control Files
  327. #>
  328. #> IMPORTANT NOTE
  329. #>
  330. #> The DESID control files defined below are an integral part of controlling the behavior of the model simulation.
  331. #> Among other things, they control the mapping of species in the emission files to chemical species in the model and
  332. #> several aspects related to the simulation of organic aerosols.
  333. #> Please carefully review the DESID control files to ensure that they are configured to be consistent with the assumptions
  334. #> made when creating the emission files defined below and the desired representation of organic aerosols.
  335. #> For further information, please see:
  336. #> + AERO7 Release Notes section on 'Required emission updates':
  337. #> https://github.com/USEPA/CMAQ/blob/master/DOCS/Release_Notes/aero7_overview.md
  338. #> + CMAQ User's Guide section 6.9.3 on 'Emission Compatability':
  339. #> https://github.com/USEPA/CMAQ/blob/master/DOCS/Users_Guide/CMAQ_UG_ch06_model_configuration_options.md#6.9.3_Emission_Compatability
  340. #> + Emission Control (DESID) Documentation in the CMAQ User's Guide:
  341. #> https://github.com/USEPA/CMAQ/blob/master/DOCS/Users_Guide/Appendix/CMAQ_UG_appendixB_emissions_control.md
  342. #>
  343. setenv DESID_CTRL_NML ${BLD}/CMAQ_Control_DESID.nml
  344. setenv DESID_CHEM_CTRL_NML ${BLD}/CMAQ_Control_DESID_${MECH}.nml
  345.  
  346. #> The following namelist configures aggregated output (via the Explicit and Lumped
  347. #> Air Quality Model Output (ELMO) Module), domain-wide budget output, and chemical
  348. #> family output.
  349. setenv MISC_CTRL_NML ${BLD}/CMAQ_Control_Misc.nml
  350.  
  351. #> The following namelist controls the mapping of meteorological land use types and the NH3 and Hg emission
  352. #> potentials
  353. setenv STAGECTRL_NML ${BLD}/CMAQ_Control_STAGE.nml
  354.  
  355. #> Spatial Masks For Emissions Scaling
  356. #setenv CMAQ_MASKS $SZpath/OCEAN_${MM}_L3m_MC_CHL_chlor_a_12NE3.nc #> horizontal grid-dependent ocean file
  357. setenv CMAQ_MASKS $INPDIR/GRIDMASK_STATES_12NE3.nc
  358.  
  359. #> Gridded Emissions Files
  360. setenv N_EMIS_GR 2
  361. set EMISfile = emis_mole_all_${YYYYMMDD}_12NE3_nobeis_norwc_2018gc_cb6_18j.ncf
  362. setenv GR_EMIS_001 ${EMISpath}/merged_nobeis_norwc/${EMISfile}
  363. setenv GR_EMIS_LAB_001 GRIDDED_EMIS
  364. setenv GR_EM_SYM_DATE_001 F # To change default behaviour please see Users Guide for EMIS_SYM_DATE
  365.  
  366. set EMISfile = emis_mole_rwc_${YYYYMMDD}_12NE3_cmaq_cb6ae7_2018gc_cb6_18j.ncf
  367. setenv GR_EMIS_002 ${EMISpath}/rwc/${EMISfile}
  368. setenv GR_EMIS_LAB_002 GR_RES_FIRES
  369. setenv GR_EM_SYM_DATE_002 F # To change default behaviour please see Users Guide for EMIS_SYM_DATE
  370.  
  371. #> In-line point emissions configuration
  372. setenv N_EMIS_PT 10 #> Number of elevated source groups
  373.  
  374. set STKCASEG = 12US1_2018gc_cb6_18j # Stack Group Version Label
  375. set STKCASEE = 12US1_cmaq_cb6ae7_2018gc_cb6_18j # Stack Emission Version Label
  376.  
  377. # Time-Independent Stack Parameters for Inline Point Sources
  378. setenv STK_GRPS_001 $IN_PTpath/ptnonipm/stack_groups_ptnonipm_${STKCASEG}.ncf
  379. setenv STK_GRPS_002 $IN_PTpath/ptegu/stack_groups_ptegu_${STKCASEG}.ncf
  380. setenv STK_GRPS_003 $IN_PTpath/othpt/stack_groups_othpt_${STKCASEG}.ncf
  381. setenv STK_GRPS_004 $IN_PTpath/ptagfire/stack_groups_ptagfire_${YYYYMMDD}_${STKCASEG}.ncf
  382. setenv STK_GRPS_005 $IN_PTpath/ptfire-rx/stack_groups_ptfire-rx_${YYYYMMDD}_${STKCASEG}.ncf
  383. setenv STK_GRPS_006 $IN_PTpath/ptfire-wild/stack_groups_ptfire-wild_${YYYYMMDD}_${STKCASEG}.ncf
  384. setenv STK_GRPS_007 $IN_PTpath/ptfire_othna/stack_groups_ptfire_othna_${YYYYMMDD}_${STKCASEG}.ncf
  385. setenv STK_GRPS_008 $IN_PTpath/pt_oilgas/stack_groups_pt_oilgas_${STKCASEG}.ncf
  386. setenv STK_GRPS_009 $IN_PTpath/cmv_c3_12/stack_groups_cmv_c3_12_${STKCASEG}.ncf
  387. setenv STK_GRPS_010 $IN_PTpath/cmv_c1c2_12/stack_groups_cmv_c1c2_12_${STKCASEG}.ncf
  388.  
  389. # Emission Rates for Inline Point Sources
  390. setenv STK_EMIS_001 $IN_PTpath/ptnonipm/inln_mole_ptnonipm_${YYYYMMDD}_${STKCASEE}.ncf
  391. setenv STK_EMIS_002 $IN_PTpath/ptegu/inln_mole_ptegu_${YYYYMMDD}_${STKCASEE}.ncf
  392. setenv STK_EMIS_003 $IN_PTpath/othpt/inln_mole_othpt_${YYYYMMDD}_${STKCASEE}.ncf
  393. setenv STK_EMIS_004 $IN_PTpath/ptagfire/inln_mole_ptagfire_${YYYYMMDD}_${STKCASEE}.ncf
  394. setenv STK_EMIS_005 $IN_PTpath/ptfire-rx/inln_mole_ptfire-rx_${YYYYMMDD}_${STKCASEE}.ncf
  395. setenv STK_EMIS_006 $IN_PTpath/ptfire-wild/inln_mole_ptfire-wild_${YYYYMMDD}_${STKCASEE}.ncf
  396. setenv STK_EMIS_007 $IN_PTpath/ptfire_othna/inln_mole_ptfire_othna_${YYYYMMDD}_${STKCASEE}.ncf
  397. setenv STK_EMIS_008 $IN_PTpath/pt_oilgas/inln_mole_pt_oilgas_${YYYYMMDD}_${STKCASEE}.ncf
  398. setenv STK_EMIS_009 $IN_PTpath/cmv_c3_12/inln_mole_cmv_c3_12_${YYYYMMDD}_${STKCASEE}.ncf
  399. setenv STK_EMIS_010 $IN_PTpath/cmv_c1c2_12/inln_mole_cmv_c1c2_12_${YYYYMMDD}_${STKCASEE}.ncf
  400.  
  401. # Label Each Emissions Stream
  402. setenv STK_EMIS_LAB_001 PT_NONEGU
  403. setenv STK_EMIS_LAB_002 PT_EGU
  404. setenv STK_EMIS_LAB_003 PT_OTHER
  405. setenv STK_EMIS_LAB_004 PT_AGFIRES
  406. setenv STK_EMIS_LAB_005 PT_RXFIRES
  407. setenv STK_EMIS_LAB_006 PT_WILDFIRES
  408. setenv STK_EMIS_LAB_007 PT_OTHFIRES
  409. setenv STK_EMIS_LAB_008 PT_OILGAS
  410. setenv STK_EMIS_LAB_009 PT_CMV_C3
  411. setenv STK_EMIS_LAB_010 PT_CMV_C1C2
  412.  
  413. # Allow CMAQ to Use Point Source files with dates that do not
  414. # match the internal model date
  415. # To change default behaviour please see Users Guide for EMIS_SYM_DATE
  416. setenv STK_EM_SYM_DATE_001 F
  417. setenv STK_EM_SYM_DATE_002 F
  418. setenv STK_EM_SYM_DATE_003 F
  419. setenv STK_EM_SYM_DATE_004 F
  420. setenv STK_EM_SYM_DATE_005 F
  421. setenv STK_EM_SYM_DATE_006 F
  422. setenv STK_EM_SYM_DATE_007 F
  423. setenv STK_EM_SYM_DATE_008 F
  424.  
  425. #> Lightning NOx configuration
  426. if ( $CTM_LTNG_NO == 'Y' ) then
  427. setenv LTNGNO "InLine" #> set LTNGNO to "Inline" to activate in-line calculation
  428.  
  429. #> In-line lightning NOx options
  430. setenv USE_NLDN Y #> use hourly NLDN strike file [ default: Y ]
  431. if ( $USE_NLDN == Y ) then
  432. setenv NLDN_STRIKES ${IN_LTpath}/NLDN_12km_60min_${YYYYMMDD}.ioapi
  433. endif
  434. setenv LTNGPARMS_FILE ${IN_LTpath}/LTNG_AllParms_12NE3.nc #> lightning parameter file
  435. endif
  436.  
  437. #> In-line biogenic emissions configuration
  438. if ( $CTM_BIOGEMIS_BE == 'Y' ) then
  439. set IN_BEISpath = ${INPDIR}/surface
  440. setenv GSPRO $BLD/gspro_biogenics.txt
  441. setenv BEIS_NORM_EMIS $IN_BEISpath/beis4_beld6_norm_emis.12NE3.nc
  442. setenv BEIS_SOILINP $OUTDIR/CCTM_BSOILOUT_${RUNID}_${YESTERDAY}.nc
  443. #> Biogenic NO soil input file; ignore if NEW_START = TRUE
  444. endif
  445. if ( $CTM_BIOGEMIS_MG == 'Y' ) then
  446. setenv MEGAN_SOILINP $OUTDIR/CCTM_MSOILOUT_${RUNID}_${YESTERDAY}.nc
  447. #> Biogenic NO soil input file; ignore if INITIAL_RUN = Y
  448. #> ; ignore if IGNORE_SOILINP = Y
  449. setenv MEGAN_CTS $SZpath/megan3.2/CT3_CONUS.ncf
  450. setenv MEGAN_EFS $SZpath/megan3.2/EFMAPS_CONUS.ncf
  451. setenv MEGAN_LDF $SZpath/megan3.2/LDF_CONUS.ncf
  452. if ($BDSNP_MEGAN == 'Y') then
  453. setenv BDSNPINP $OUTDIR/CCTM_BDSNPOUT_${RUNID}_${YESTERDAY}.nc
  454. setenv BDSNP_FFILE $SZpath/megan3.2/FERT_tceq_12km.ncf
  455. setenv BDSNP_NFILE $SZpath/megan3.2/NDEP_tceq_12km.ncf
  456. setenv BDSNP_LFILE $SZpath/megan3.2/LANDTYPE_tceq_12km.ncf
  457. setenv BDSNP_AFILE $SZpath/megan3.2/ARID_tceq_12km.ncf
  458. setenv BDSNP_NAFILE $SZpath/megan3.2/NONARID_tceq_12km.ncf
  459. endif
  460. endif
  461.  
  462. #> In-line sea spray emissions configuration
  463. setenv OCEAN_1 $SZpath/OCEAN_${MM}_L3m_MC_CHL_chlor_a_12NE3.nc #> horizontal grid-dependent ocean file
  464.  
  465. #> Bidirectional ammonia configuration
  466. if ( $CTM_ABFLUX == 'Y' ) then
  467. setenv E2C_SOIL ${EPICpath}/2018r1_EPIC0509_12NE3_soil.nc
  468. setenv E2C_CHEM ${EPICpath}/2018r1_EPIC0509_12NE3_time${YYYYMMDD}.nc
  469. setenv E2C_CHEM_YEST ${EPICpath}/2018r1_EPIC0509_12NE3_time${YESTERDAY}.nc
  470. setenv E2C_LU ${EPICpath}/beld4_12NE3_2011.nc
  471. endif
  472.  
  473. #> Inline Process Analysis
  474. setenv CTM_PROCAN N #> use process analysis [ default: N]
  475. if ( $?CTM_PROCAN ) then # $CTM_PROCAN is defined
  476. if ( $CTM_PROCAN == 'Y' || $CTM_PROCAN == 'T' ) then
  477. #> process analysis global column, row and layer ranges
  478. # setenv PA_BCOL_ECOL "10 90" # default: all columns
  479. # setenv PA_BROW_EROW "10 80" # default: all rows
  480. # setenv PA_BLEV_ELEV "1 4" # default: all levels
  481. setenv PACM_INFILE ${NMLpath}/pa_${MECH}.ctl
  482. setenv PACM_REPORT $OUTDIR/"PA_REPORT".${YYYYMMDD}
  483. endif
  484. endif
  485.  
  486. #> Integrated Source Apportionment Method (ISAM) Options
  487. setenv CTM_ISAM N
  488. if ( $?CTM_ISAM ) then
  489. if ( $CTM_ISAM == 'Y' || $CTM_ISAM == 'T' ) then
  490. setenv SA_IOLIST ${WORKDIR}/isam_control.2018_12NE3.txt
  491. setenv ISAM_BLEV_ELEV " 1 1"
  492. setenv AISAM_BLEV_ELEV " 1 1"
  493.  
  494. #> Set Up ISAM Initial Condition Flags
  495. if ($NEW_START == true || $NEW_START == TRUE ) then
  496. setenv ISAM_NEW_START Y
  497. setenv ISAM_PREVDAY
  498. else
  499. setenv ISAM_NEW_START N
  500. setenv ISAM_PREVDAY "$OUTDIR/CCTM_SA_CGRID_${RUNID}_${YESTERDAY}.nc"
  501. endif
  502.  
  503. #> Set Up ISAM Output Filenames
  504. setenv SA_ACONC_1 "$OUTDIR/CCTM_SA_ACONC_${CTM_APPL}.nc -v"
  505. setenv SA_CONC_1 "$OUTDIR/CCTM_SA_CONC_${CTM_APPL}.nc -v"
  506. setenv SA_DD_1 "$OUTDIR/CCTM_SA_DRYDEP_${CTM_APPL}.nc -v"
  507. setenv SA_WD_1 "$OUTDIR/CCTM_SA_WETDEP_${CTM_APPL}.nc -v"
  508. setenv SA_CGRID_1 "$OUTDIR/CCTM_SA_CGRID_${CTM_APPL}.nc -v"
  509.  
  510. #> Set optional ISAM regions files
  511. setenv ISAM_REGIONS $INPDIR/GRIDMASK_STATES_12NE3.nc
  512.  
  513. #> Options used to favor tracked species in reaction for Ozone-NOx chemistry
  514. setenv ISAM_O3_WEIGHTS 5 # weights for tracked species Default is 5
  515. # OPTIONS
  516. # 1 does not weight any species
  517. # 2 weights NOx and subset of NOz species
  518. # 3 uses with from option 2 plus weight OVOC species, organic radicals and operators
  519. # 4 weight OVOC species, organic radicals and operators
  520. # 5 toggles between two weighting set based on VOC and NOx limited ozone production
  521. # Below options only used if ISAM_O3_WEIGHTS set to 5
  522. setenv ISAM_NOX_CASE 2 # weights for tracked species when ozone production is NOx limited. Default is 2
  523. setenv ISAM_VOC_CASE 4 # weights for tracked species when ozone production is VOC limited. Default is 4
  524. setenv VOC_NOX_TRANS 0.35 # value of Prod H2O2 over Prod HNO3 less than where
  525. # ISAM_VOC_CASE weights are used. Otherwise, ISAM_NOX_CASE
  526. # weights are used. Default is 0.35
  527.  
  528. endif
  529. endif
  530.  
  531.  
  532. #> Sulfur Tracking Model (STM)
  533. setenv STM_SO4TRACK N #> sulfur tracking [ default: N ]
  534. if ( $?STM_SO4TRACK ) then
  535. if ( $STM_SO4TRACK == 'Y' || $STM_SO4TRACK == 'T' ) then
  536.  
  537. #> option to normalize sulfate tracers [ default: Y ]
  538. setenv STM_ADJSO4 Y
  539.  
  540. endif
  541. endif
  542.  
  543. #> Decoupled Direct Method in 3D (DDM-3D) Options
  544. setenv CTM_DDM3D N # Sets up requisite script settings for DDM-3D (default is N/F)
  545. # Additionally requires for CCTM to be compiled for DDM-3D simulations
  546.  
  547. set NPMAX = 1 # Number of sensitivity parameters defined in SEN_INPUT
  548. setenv SEN_INPUT ${WORKDIR}/sensinput.2018_12NE3.dat
  549.  
  550. setenv DDM3D_HIGH N # allow higher-order sensitivity parameters in SEN_INPUT [ T | Y | F | N ] (default is N/F)
  551.  
  552. if ($NEW_START == true || $NEW_START == TRUE ) then
  553. setenv DDM3D_RST N # begins from sensitivities from a restart file [ T | Y | F | N ] (default is Y/T)
  554. set S_ICpath = # sensitivity fields are initialized to 0.0 on the first hour of the first day
  555. set S_ICfile =
  556. else
  557. setenv DDM3D_RST Y # begins from sensitivities from a restart file [ T | Y | F | N ] (default is Y/T)
  558. set S_ICpath = $OUTDIR
  559. set S_ICfile = CCTM_SENGRID_${RUNID}_${YESTERDAY}.nc
  560. endif
  561.  
  562. setenv CTM_NPMAX $NPMAX
  563. setenv CTM_SENS_1 "$OUTDIR/CCTM_SENGRID_${CTM_APPL}.nc -v"
  564. setenv A_SENS_1 "$OUTDIR/CCTM_ASENS_${CTM_APPL}.nc -v"
  565. setenv CTM_SWETDEP_1 "$OUTDIR/CCTM_SENWDEP_${CTM_APPL}.nc -v"
  566. setenv CTM_SDRYDEP_1 "$OUTDIR/CCTM_SENDDEP_${CTM_APPL}.nc -v"
  567. setenv INIT_SENS_1 $S_ICpath/$S_ICfile
  568.  
  569.  
  570. # =====================================================================
  571. #> Output Files
  572. # =====================================================================
  573.  
  574. #> set output file names
  575. setenv S_CGRID "$OUTDIR/CCTM_CGRID_${CTM_APPL}.nc" #> 3D Inst. Concentrations
  576. setenv CTM_CONC_1 "$OUTDIR/CCTM_CONC_${CTM_APPL}.nc -v" #> On-Hour Concentrations
  577. setenv A_CONC_1 "$OUTDIR/CCTM_ACONC_${CTM_APPL}.nc -v" #> Hourly Avg. Concentrations
  578. setenv MEDIA_CONC "$OUTDIR/CCTM_MEDIA_CONC_${CTM_APPL}.nc -v" #> NH3 Conc. in Media
  579. setenv CTM_DRY_DEP_1 "$OUTDIR/CCTM_DRYDEP_${CTM_APPL}.nc -v" #> Hourly Dry Deposition
  580. setenv CTM_DEPV_DIAG "$OUTDIR/CCTM_DEPV_${CTM_APPL}.nc -v" #> Dry Deposition Velocities
  581. setenv B3GTS_S "$OUTDIR/CCTM_B3GTS_S_${CTM_APPL}.nc -v" #> Biogenic Emissions
  582. setenv BEIS_SOILOUT "$OUTDIR/CCTM_BSOILOUT_${CTM_APPL}.nc" #> Soil Emissions
  583. setenv MEGAN_SOILOUT "$OUTDIR/CCTM_MSOILOUT_${CTM_APPL}.nc" #> Soil Emissions
  584. setenv BDSNPOUT "$OUTDIR/CCTM_BDSNPOUT_${CTM_APPL}.nc" #> Soil Emissions
  585. setenv CTM_WET_DEP_1 "$OUTDIR/CCTM_WETDEP1_${CTM_APPL}.nc -v" #> Wet Dep From All Clouds
  586. setenv CTM_WET_DEP_2 "$OUTDIR/CCTM_WETDEP2_${CTM_APPL}.nc -v" #> Wet Dep From SubGrid Clouds
  587. setenv CTM_ELMO_1 "$OUTDIR/CCTM_ELMO_${CTM_APPL}.nc -v" #> On-Hour Particle Diagnostics
  588. setenv CTM_AELMO_1 "$OUTDIR/CCTM_AELMO_${CTM_APPL}.nc -v" #> Hourly Avg. Particle Diagnostics
  589. setenv CTM_RJ_1 "$OUTDIR/CCTM_PHOTDIAG1_${CTM_APPL}.nc -v" #> 2D Surface Summary from Inline Photolysis
  590. setenv CTM_RJ_2 "$OUTDIR/CCTM_PHOTDIAG2_${CTM_APPL}.nc -v" #> 3D Photolysis Rates
  591. setenv CTM_RJ_3 "$OUTDIR/CCTM_PHOTDIAG3_${CTM_APPL}.nc -v" #> 3D Optical and Radiative Results from Photolysis
  592. setenv CTM_SSEMIS_1 "$OUTDIR/CCTM_SSEMIS_${CTM_APPL}.nc -v" #> Sea Spray Emissions
  593. setenv CTM_DUST_EMIS_1 "$OUTDIR/CCTM_DUSTEMIS_${CTM_APPL}.nc -v" #> Dust Emissions
  594. setenv CTM_BUDGET "$OUTDIR/CCTM_BUDGET_${CTM_APPL}.txt -v" #> Budget [Default Off]
  595. setenv CTM_IPR_1 "$OUTDIR/CCTM_PA_1_${CTM_APPL}.nc -v" #> Process Analysis
  596. setenv CTM_IPR_2 "$OUTDIR/CCTM_PA_2_${CTM_APPL}.nc -v" #> Process Analysis
  597. setenv CTM_IPR_3 "$OUTDIR/CCTM_PA_3_${CTM_APPL}.nc -v" #> Process Analysis
  598. setenv CTM_IRR_1 "$OUTDIR/CCTM_IRR_1_${CTM_APPL}.nc -v" #> Chem Process Analysis
  599. setenv CTM_IRR_2 "$OUTDIR/CCTM_IRR_2_${CTM_APPL}.nc -v" #> Chem Process Analysis
  600. setenv CTM_IRR_3 "$OUTDIR/CCTM_IRR_3_${CTM_APPL}.nc -v" #> Chem Process Analysis
  601. setenv CTM_DRY_DEP_MOS "$OUTDIR/CCTM_DDMOS_${CTM_APPL}.nc -v" #> Dry Dep
  602. setenv CTM_DEPV_MOS "$OUTDIR/CCTM_DEPVMOS_${CTM_APPL}.nc -v" #> Dry Dep Velocity
  603. setenv CTM_VDIFF_DIAG "$OUTDIR/CCTM_VDIFF_DIAG_${CTM_APPL}.nc -v" #> Vertical Dispersion Diagnostic
  604. setenv CTM_VSED_DIAG "$OUTDIR/CCTM_VSED_DIAG_${CTM_APPL}.nc -v" #> Particle Grav. Settling Velocity
  605. setenv CTM_LTNGDIAG_1 "$OUTDIR/CCTM_LTNGHRLY_${CTM_APPL}.nc -v" #> Hourly Avg Lightning NO
  606. setenv CTM_LTNGDIAG_2 "$OUTDIR/CCTM_LTNGCOL_${CTM_APPL}.nc -v" #> Column Total Lightning NO
  607. setenv CTM_VEXT_1 "$OUTDIR/CCTM_VEXT_${CTM_APPL}.nc -v" #> On-Hour 3D Concs at select sites
  608.  
  609. #> set floor file (neg concs)
  610. setenv FLOOR_FILE ${OUTDIR}/FLOOR_${CTM_APPL}.txt
  611.  
  612. #> look for existing log files and output files
  613. ( ls CTM_LOG_???.${CTM_APPL} > buff.txt ) >& /dev/null
  614. ( ls ${LOGDIR}/CTM_LOG_???.${CTM_APPL} >> buff.txt ) >& /dev/null
  615. set log_test = `cat buff.txt`; rm -f buff.txt
  616.  
  617. set OUT_FILES = (${FLOOR_FILE} ${S_CGRID} ${CTM_CONC_1} ${A_CONC_1} ${MEDIA_CONC} \
  618. ${CTM_DRY_DEP_1} $CTM_DEPV_DIAG $B3GTS_S $MEGAN_SOILOUT $BEIS_SOILOUT $BDSNPOUT \
  619. $CTM_WET_DEP_1 $CTM_WET_DEP_2 $CTM_ELMO_1 $CTM_AELMO_1 \
  620. $CTM_RJ_1 $CTM_RJ_2 $CTM_RJ_3 $CTM_SSEMIS_1 $CTM_DUST_EMIS_1 $CTM_IPR_1 $CTM_IPR_2 \
  621. $CTM_IPR_3 $CTM_BUDGET $CTM_IRR_1 $CTM_IRR_2 $CTM_IRR_3 $CTM_DRY_DEP_MOS \
  622. $CTM_DEPV_MOS $CTM_VDIFF_DIAG $CTM_VSED_DIAG $CTM_LTNGDIAG_1 $CTM_LTNGDIAG_2 $CTM_VEXT_1 )
  623. if ( $?CTM_ISAM ) then
  624. if ( $CTM_ISAM == 'Y' || $CTM_ISAM == 'T' ) then
  625. set OUT_FILES = (${OUT_FILES} ${SA_ACONC_1} ${SA_CONC_1} ${SA_DD_1} ${SA_WD_1} \
  626. ${SA_CGRID_1} )
  627. endif
  628. endif
  629. if ( $?CTM_DDM3D ) then
  630. if ( $CTM_DDM3D == 'Y' || $CTM_DDM3D == 'T' ) then
  631. set OUT_FILES = (${OUT_FILES} ${CTM_SENS_1} ${A_SENS_1} ${CTM_SWETDEP_1} ${CTM_SDRYDEP_1} )
  632. endif
  633. endif
  634. set OUT_FILES = `echo $OUT_FILES | sed "s; -v;;g" | sed "s;MPI:;;g" `
  635. ( ls $OUT_FILES > buff.txt ) >& /dev/null
  636. set out_test = `cat buff.txt`; rm -f buff.txt
  637.  
  638. #> delete previous output if requested
  639. if ( $CLOBBER_DATA == true || $CLOBBER_DATA == TRUE ) then
  640. echo
  641. echo "Existing Logs and Output Files for Day ${TODAYG} Will Be Deleted"
  642.  
  643. #> remove previous log files
  644. foreach file ( ${log_test} )
  645. #echo "Deleting log file: $file"
  646. rm -f $file
  647. end
  648.  
  649. #> remove previous output files
  650. foreach file ( ${out_test} )
  651. #echo "Deleting output file: $file"
  652. rm -f $file
  653. end
  654. rm -f ${OUTDIR}/CCTM_DESID*${RUNID}_${YYYYMMDD}.nc
  655.  
  656. else
  657. #> error if previous log files exist
  658. if ( "$log_test" != "" ) then
  659. echo "*** Logs exist - run ABORTED ***"
  660. echo "*** To overide, set CLOBBER_DATA = TRUE in run_cctm.csh ***"
  661. echo "*** and these files will be automatically deleted. ***"
  662. exit 1
  663. endif
  664.  
  665. #> error if previous output files exist
  666. if ( "$out_test" != "" ) then
  667. echo "*** Output Files Exist - run will be ABORTED ***"
  668. foreach file ( $out_test )
  669. echo " cannot delete $file"
  670. end
  671. echo "*** To overide, set CLOBBER_DATA = TRUE in run_cctm.csh ***"
  672. echo "*** and these files will be automatically deleted. ***"
  673. exit 1
  674. endif
  675. endif
  676.  
  677. #> for the run control ...
  678. setenv CTM_STDATE $YYYYJJJ
  679. setenv CTM_STTIME $STTIME
  680. setenv CTM_RUNLEN $NSTEPS
  681. setenv CTM_TSTEP $TSTEP
  682. setenv INIT_CONC_1 $ICpath/$ICFILE
  683. setenv BNDY_CONC_1 $BCpath/$BCFILE
  684. setenv OMI $OMIpath/$OMIfile
  685. setenv OPTICS_DATA $OMIpath/$OPTfile
  686. #setenv XJ_DATA $JVALpath/$JVALfile
  687.  
  688. #> species defn & photolysis
  689. setenv gc_matrix_nml ${NMLpath}/GC_$MECH.nml
  690. setenv ae_matrix_nml ${NMLpath}/AE_$MECH.nml
  691. setenv nr_matrix_nml ${NMLpath}/NR_$MECH.nml
  692. setenv tr_matrix_nml ${NMLpath}/Species_Table_TR_0.nml
  693.  
  694. #> check for photolysis input data
  695. setenv CSQY_DATA ${NMLpath}/CSQY_DATA_$MECH
  696.  
  697. if (! (-e $CSQY_DATA ) ) then
  698. echo " $CSQY_DATA not found "
  699. exit 1
  700. endif
  701. if (! (-e $OPTICS_DATA ) ) then
  702. echo " $OPTICS_DATA not found "
  703. exit 1
  704. endif
  705.  
  706. # ===================================================================
  707. #> Execution Portion
  708. # ===================================================================
  709.  
  710. #> Print attributes of the executable
  711. if ( $CTM_DIAG_LVL != 0 ) then
  712. ls -l $BLD/$EXEC
  713. size $BLD/$EXEC
  714. unlimit
  715. limit
  716. endif
  717.  
  718. #> Print Startup Dialogue Information to Standard Out
  719. echo
  720. echo "CMAQ Processing of Day $YYYYMMDD Began at `date`"
  721. echo
  722.  
  723. #> Executable call for single PE, uncomment to invoke
  724. # ( /usr/bin/time -p $BLD/$EXEC ) |& tee buff_${EXECUTION_ID}.txt
  725.  
  726. #> Executable call for multi PE, configure for your system
  727. # set MPI = /usr/local/intel/impi/3.2.2.006/bin64
  728. # set MPIRUN = $MPI/mpirun
  729.  
  730.  
  731. ( /usr/bin/time -p srun -n $NPROCS $BLD/$EXEC ) |& tee buff_${EXECUTION_ID}.txt
  732.  
  733. #> Harvest Timing Output so that it may be reported below
  734. set rtarray = "${rtarray} `tail -3 buff_${EXECUTION_ID}.txt | grep -Eo '[+-]?[0-9]+([.][0-9]+)?' | head -1` "
  735. rm -rf buff_${EXECUTION_ID}.txt
  736.  
  737. #> Abort script if abnormal termination
  738. if ( ! -e $OUTDIR/CCTM_CGRID_${CTM_APPL}.nc ) then
  739. echo ""
  740. echo "**************************************************************"
  741. echo "** Runscript Detected an Error: CGRID file was not written. **"
  742. echo "** This indicates that CMAQ was interrupted or an issue **"
  743. echo "** exists with writing output. The runscript will now **"
  744. echo "** abort rather than proceeding to subsequent days. **"
  745. echo "**************************************************************"
  746. break
  747. endif
  748.  
  749. #> Print Concluding Text
  750. echo
  751. echo "CMAQ Processing of Day $YYYYMMDD Finished at `date`"
  752. echo
  753. echo "\\\\\=====\\\\\=====\\\\\=====\\\\\=====/////=====/////=====/////=====/////"
  754. echo
  755.  
  756. # ===================================================================
  757. #> Finalize Run for This Day and Loop to Next Day
  758. # ===================================================================
  759.  
  760. #> Save Log Files and Move on to Next Simulation Day
  761. mv CTM_LOG_???.${CTM_APPL} $LOGDIR
  762. if ( $CTM_DIAG_LVL != 0 ) then
  763. mv CTM_DIAG_???.${CTM_APPL} $LOGDIR
  764. endif
  765.  
  766. #> The next simulation day will, by definition, be a restart
  767. setenv NEW_START false
  768.  
  769. #> Increment both Gregorian and Julian Days
  770. set TODAYG = `date -ud "${TODAYG}+1days" +%Y-%m-%d` #> Add a day for tomorrow
  771. set TODAYJ = `date -ud "${TODAYG}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
  772.  
  773. end #Loop to the next Simulation Day
  774.  
  775. # ===================================================================
  776. #> Generate Timing Report
  777. # ===================================================================
  778. set RTMTOT = 0
  779. foreach it ( `seq ${NDAYS}` )
  780. set rt = `echo ${rtarray} | cut -d' ' -f${it}`
  781. set RTMTOT = `echo "${RTMTOT} + ${rt}" | bc -l`
  782. end
  783.  
  784. set RTMAVG = `echo "scale=2; ${RTMTOT} / ${NDAYS}" | bc -l`
  785. set RTMTOT = `echo "scale=2; ${RTMTOT} / 1" | bc -l`
  786.  
  787. echo
  788. echo "=================================="
  789. echo " ***** CMAQ TIMING REPORT *****"
  790. echo "=================================="
  791. echo "Start Day: ${START_DATE}"
  792. echo "End Day: ${END_DATE}"
  793. echo "Number of Simulation Days: ${NDAYS}"
  794. echo "Domain Name: ${GRID_NAME}"
  795. echo "Number of Grid Cells: ${NCELLS} (ROW x COL x LAY)"
  796. echo "Number of Layers: ${NZ}"
  797. echo "Number of Processes: ${NPROCS}"
  798. echo " All times are in seconds."
  799. echo
  800. echo "Num Day Wall Time"
  801. set d = 0
  802. set day = ${START_DATE}
  803. foreach it ( `seq ${NDAYS}` )
  804. # Set the right day and format it
  805. set d = `echo "${d} + 1" | bc -l`
  806. set n = `printf "%02d" ${d}`
  807.  
  808. # Choose the correct time variables
  809. set rt = `echo ${rtarray} | cut -d' ' -f${it}`
  810.  
  811. # Write out row of timing data
  812. echo "${n} ${day} ${rt}"
  813.  
  814. # Increment day for next loop
  815. set day = `date -ud "${day}+1days" +%Y-%m-%d`
  816. end
  817. echo " Total Time = ${RTMTOT}"
  818. echo " Avg. Time = ${RTMAVG}"
  819.  
  820. exit
  821.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement