I’m running a three-level nested case of CMAQ, and the first domain is already running using profile.Now, When I make a second level nested domain bcon fileWhen I make a second-level nested domain bcon file, I can only generate bcon for one day at a time. But the time of my simulation is 1 year, which is obviously not recommended. Is there any better way to batch processing please, I would appreciate it.
While the example run_bcon.csh
script released with the code is set up to process a single day, you can easily modify it to create a loop over an extended time period and then call the BCON executable for each day. This is the way the example CCTM run scripts are set up (e.g. run_cctm_Bench_2018_12NE3.csh
), so you can adapt the relevant script segments from there. Something like this should work:
diff run_bcon.csh run_bcon_loop_example.csh
116,120c116,132
<
< set DATE = "2016-07-01"
< set YYYYJJJ = `date -ud "${DATE}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
< set YYMMDD = `date -ud "${DATE}" +%y%m%d` #> Convert YYYY-MM-DD to YYMMDD
< set YYYYMMDD = `date -ud "${DATE}" +%Y%m%d` #> Convert YYYY-MM-DD to YYYYMMDD
---
>
> set START_DATE = "2016-07-01" #> beginning date (July 1, 2016)
> set END_DATE = "2016-07-15" #> ending date (July 1, 2016)
>
> set TODAYG = ${START_DATE}
> set TODAYJ = `date -ud "${START_DATE}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
> set START_DAY = ${TODAYJ}
> set STOP_DAY = `date -ud "${END_DATE}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
>
> while ($TODAYJ <= $STOP_DAY ) #>Compare dates in terms of YYYYJJJ
>
> #> Retrieve Calendar day Information
> set YYYYJJJ = $TODAYJ
> set YYMMDD = `date -ud "${TODAYG}" +%y%m%d` #> Convert YYYY-MM-DD to YYMMDD
> set YYYYMMDD = `date -ud "${TODAYG}" +%Y%m%d` #> Convert YYYY-MM-DD to YYYYMMDD
> set YYYYMM = `date -ud "${TODAYG}" +%Y%m` #> Convert YYYY-MM-DD to YYYYMM
>
157a170,176
>
> #> Increment both Gregorian and Julian Days
> set TODAYG = `date -ud "${TODAYG}+1days" +%Y-%m-%d` #> Add a day for tomorrow
> set TODAYJ = `date -ud "${TODAYG}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
>
> end #Loop to the next day
>
Also note that BCON opens the BNDY_CONC_1
output file in FSUNKN3 mode which means a new BCON run can add time steps to an existing output file. So, if you prefer to create (for example) one large BCON file with hourly data per month rather than multiple smaller BCON files with hourly data for each day in the month, you could change
setenv BNDY_CONC_1 "$OUTDIR/BCON_${VRSN}_${APPL}_${BCON_TYPE}_${YYYYMMDD} -v"
to
setenv BNDY_CONC_1 "$OUTDIR/BCON_${VRSN}_${APPL}_${BCON_TYPE}_${YYYYMM} -v"
Thank you very much for your advice, you are an angel. Due to my lack of experience, there was still an error. I hope you can check it out for me, best wishes.
Below are
run_bcon_xie_re_while2.csh (6.1 KB)
bcon_while.txt (87.1 KB)
my related documents.
Value for IOAPI_CHECK_HEADERS not defined;returning default: FALSE
"BNDY_CONC_1" opened as UNKNOWN(R-W)
File name "/home/u220220948411/wrf/cmaq532/data/xie_cr/d02/01_03/BCON_v532_2016_BJM_regrid_5_"
File type BNDARY3
Execution ID "BCON_v532.exe"
Grid name "2016_BJM"
Dimensions: 148 rows, 178 cols, 42 lays, 220 vbles, 1 cells thick
NetCDF ID: 196608 opened as VOLATILE READWRITE
Starting date and time 2017001:000000 (0:00:00 Jan. 1, 2017)
Timestep 010000 (1:00:00 hh:mm:ss)
Maximum current record number 25
Value for IOAPI_LOG_WRITE: F returning FALSE
Timestep written to BNDY_CONC_1 for date and time 2017001:000000
Timestep written to BNDY_CONC_1 for date and time 2017001:010000
Timestep written to BNDY_CONC_1 for date and time 2017001:020000
Timestep written to BNDY_CONC_1 for date and time 2017001:030000
Timestep written to BNDY_CONC_1 for date and time 2017001:040000
Timestep written to BNDY_CONC_1 for date and time 2017001:050000
Timestep written to BNDY_CONC_1 for date and time 2017001:060000
Timestep written to BNDY_CONC_1 for date and time 2017001:070000
Timestep written to BNDY_CONC_1 for date and time 2017001:080000
Timestep written to BNDY_CONC_1 for date and time 2017001:090000
Timestep written to BNDY_CONC_1 for date and time 2017001:100000
Timestep written to BNDY_CONC_1 for date and time 2017001:110000
Timestep written to BNDY_CONC_1 for date and time 2017001:120000
Timestep written to BNDY_CONC_1 for date and time 2017001:130000
Timestep written to BNDY_CONC_1 for date and time 2017001:140000
Timestep written to BNDY_CONC_1 for date and time 2017001:150000
Timestep written to BNDY_CONC_1 for date and time 2017001:160000
Timestep written to BNDY_CONC_1 for date and time 2017001:170000
Timestep written to BNDY_CONC_1 for date and time 2017001:180000
Timestep written to BNDY_CONC_1 for date and time 2017001:190000
Timestep written to BNDY_CONC_1 for date and time 2017001:200000
Timestep written to BNDY_CONC_1 for date and time 2017001:210000
Timestep written to BNDY_CONC_1 for date and time 2017001:220000
Timestep written to BNDY_CONC_1 for date and time 2017001:230000
Timestep written to BNDY_CONC_1 for date and time 2017002:000000
netCDF error number -40
>>--->> WARNING in subroutine RDTFLAG
Error reading netCDF time step flag for CTM_CONC_1
M3WARN: DTBUF 1:00:00 Jan. 2, 2017 (2017002:010000)
>>--->> WARNING in subroutine M3_BCOUT:INTERP3
Time step not available for "NO2" from CTM_CONC_1
M3WARN: DTBUF 1:00:00 Jan. 2, 2017 (2017002:010000)
*** ERROR ABORT in subroutine M3_BCOUT
Could not read input CTM Conc file CTM_CONC_1
Date and time 1:00:00 Jan. 2, 2017 (2017002:010000)
To output a multi-day BCON
file, the program needs the matching multi-day input CONC
file (or else needs to be making multiple runs, one for each input day, but with the same BCON
output file.
The “usual” way to do this is to modify the shell-script to loop over all the days executing single-day BCON
-program runs, as mentioned above.
An alternative is to use I/O API File-Set File Lists to have the I/O API treat the entire sequence of single-day CONC
files as though it were a single input file, and script a multi-day run that way, using a single list as the input file, and generating a single (multi-day) output file. (Note that programs like VERDI that treat the I/O Applications Programming Interface (API) as generating just a data format, rather than as the programming interface it is, are unable to use File-Set file lists ;-( )
A few observations:
-
YYYYJJJ, YYMMDD, YYYYMMDD, and YYYYMM all need to be set inside the “while” loop for this to work as intended, and need to work off of {TODAYG}. In the script you posted, you kept the original script setting of defining these variables prior to the start of the “while” loop, and working off of the static {DATE} variable rather than the {TODAYG} variable incremented in the loop.
-
the loop needs to encompass the call to the BCON executable.
-
moreover, in your situation you seem to be working with MCIP files containing three months of hourly data, and CCTM_CONC files just containing a single day. Therefore, you’ll need to define the optional SDATE, STIME, and RUNLEN environment variables to restrict the processing of each day to just the hours present in the CCTM_CONC files.
Something like this might work:
# set DATE = "2017-01-01"
# set YYYY = `date -ud "${TODAYG}" +%Y`
# set YYYYJJJ = `date -ud "${DATE}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
# set YYMMDD = `date -ud "${DATE}" +%y%m%d` #> Convert YYYY-MM-DD to YYMMDD
# set YYYYMMDD = `date -ud "${DATE}" +%Y%m%d` #> Convert YYYY-MM-DD to YYYYMMDD
# setenv SDATE ${YYYYJJJ}
# setenv STIME 000000
# setenv RUNLEN 240000
set START_DATE = "2017-01-01" #> beginning date (July 1, 2016)
set END_DATE = "2017-03-31" #> ending date (July 1, 2016)
set TODAYG = ${START_DATE}
set TODAYJ = `date -ud "${START_DATE}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
set START_DAY = ${TODAYJ}
set STOP_DAY = `date -ud "${END_DATE}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
while ($TODAYJ <= $STOP_DAY ) #>Compare dates in terms of YYYYJJJ
#> Retrieve Calendar day Information
set YYYYJJJ = $TODAYJ
set YYMMDD = `date -ud "${TODAYG}" +%y%m%d` #> Convert YYYY-MM-DD to YYMMDD
set YYYYMMDD = `date -ud "${TODAYG}" +%Y%m%d` #> Convert YYYY-MM-DD to YYYYMMDD
set YYYYMM = `date -ud "${TODAYG}" +%Y%m` #> Convert YYYY-MM-DD to YYYYMM
setenv SDATE ${TODAYJ}
setenv STIME 000000
setenv RUNLEN 250000
if ( $BCON_TYPE == regrid ) then
setenv CTM_CONC_1 /home/u220220948411/wrf/cmaq532/data/xie_cr/d01/normal2/output_CCTM_v532_intel_d01_0103_normal/CCTM_CONC_v532_intel_d01_0103_normal_${YYYYMMDD}.nc
setenv MET_CRO_3D_CRS /home/u220220948411/wrf/cmaq532/data/xie_cr/d01/01_03/METCRO3D_01.nc
setenv MET_BDY_3D_FIN /home/u220220948411/wrf/cmaq532/data/xie_cr/d02/01_03/METBDY3D_01.nc
setenv BNDY_CONC_1 "$OUTDIR/BCON_${VRSN}_${APPL}_${BCON_TYPE}_5_${YYYY} -v"
endif
if ( $BCON_TYPE == profile ) then
setenv BC_PROFILE $BLD/avprofile_cb6r3m_ae7_kmtbr_hemi2016_v53beta2_m3dry_col051_row068.csv
setenv MET_BDY_3D_FIN /home/u220220948411/wrf/cmaq532/data/xie_cr/d01/01_03/METBDY3D_01.nc
setenv BNDY_CONC_1 "$OUTDIR/BCON_${VRSN}_${APPL}_${BCON_TYPE}_${YYYYMMDD} -v"
endif
# =====================================================================
#> Output File
# =====================================================================
#>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ( ! -d "$OUTDIR" ) mkdir -p $OUTDIR
ls -l $BLD/$EXEC; size $BLD/$EXEC
unlimit
limit
#> Executable call:
time $BLD/$EXEC
#Increment both Gregorian and Julian Days
set TODAYG = `date -ud "${TODAYG}+1days" +%Y-%m-%d` #> Add a day for tomorrow
set TODAYJ = `date -ud "${TODAYG}" +%Y%j` #> Convert YYYY-MM-DD to YYYYJJJ
end #Loop to the next day
Good morning, I’m glad to see your reply at first glance today. Thank you very much for your patience and posting the code. I have successfully run the BCON script from 2017-01-01 to 2017-03-31 and CCTM is currently running normally.
Best wishes.
Thank you for your advice and guidance, the problem has been solved.
Best wishes