USEPA/CMAQ

I/O API OPEN3 File Types

Closed this issue · 2 comments

Consider changing as many of the output files as possible from the FSNEW3 type to FSRDWR3 in the I/O API OPEN3 statement. Several of the output files are already opened as FSRDWR3, but some are still FSNEW3. The problem with the FSNEW3 type is that if the file is already on disk when someone tries to run the model (like for a restart after a failed run), the program will abort with a nebulous message about not being able to write to the offending file.

Here are the files that I'm seeing are opened as FSNEW3 for the CMAQ benchmark case

grep OPEN3 *.F | grep FSNEW

returns:

BIDI_MOD.F: If ( .Not. OPEN3( MEDIA_CONC, FSNEW3, PNAME ) ) Then
hrno.F: IF ( .NOT. OPEN3( SOILOUT, FSNEW3, PNAME ) ) THEN
MGEMIS.F: IF ( .NOT. OPEN3( CTM_MGEM_1, FSNEW3, PNAME ) ) THEN
opaconc.F: IF ( .NOT. OPEN3( A_CONC_1, FSNEW3, PNAME ) ) THEN
opapmdiag.F: IF ( .NOT. OPEN3( CTM_APMDIAG_1, FSNEW3, PNAME ) ) THEN
opavis.F: IF ( .NOT. OPEN3( CTM_AVIS_1, FSNEW3, PNAME ) ) THEN
opconc.F: IF ( .NOT. OPEN3( CTM_CONC_1, FSNEW3, PNAME ) ) THEN
opddep.F: IF ( .NOT. OPEN3( CTM_DRY_DEP_1, FSNEW3, PNAME ) ) THEN
opddep_fst.F: IF ( .NOT. OPEN3( CTM_DRY_DEP_FST, FSNEW3, PNAME ) ) THEN
opddep_mos.F: IF ( .NOT. OPEN3( CTM_DRY_DEP_MOS, FSNEW3, PNAME ) ) THEN
opdepv_diag.F: IF ( .NOT. OPEN3( CTM_DEPV_DIAG, FSNEW3, PNAME ) ) THEN
opdepv_fst.F: IF ( .NOT. OPEN3( CTM_DEPV_FST, FSNEW3, PNAME ) ) THEN
opdepv_mos.F: IF ( .NOT. OPEN3( CTM_DEPV_MOS, FSNEW3, PNAME ) ) THEN
openlayout.F: IF ( .NOT. OPEN3( LNAME( N ), FSNEW3, UPNAM3D ) ) THEN
opphot.F: IF ( .NOT. OPEN3( CTM_RJ_1, FSNEW3, PNAME ) ) THEN
opphot.F: IF ( .NOT. OPEN3( CTM_RJ_2, FSNEW3, PNAME ) ) THEN
oppmdiag.F: IF ( .NOT. OPEN3( CTM_PMDIAG_1, FSNEW3, PNAME ) ) THEN
oppt3d_diag.F: IF ( .NOT. OPEN3( PT3DNAME, FSNEW3, PNAME ) ) THEN
opvis.F: IF ( .NOT. OPEN3( CTM_VIS_1, FSNEW3, PNAME ) ) THEN
opwdep.F: IF ( .NOT. OPEN3( CTM_WET_DEP_1, FSNEW3, PNAME ) ) THEN
opwdep.F: IF ( .NOT. OPEN3( CTM_WET_DEP_2, FSNEW3, PNAME ) ) THEN
pa_init.F: IF ( OPEN3( OUTFNAME, FSNEW3, PNAME ) ) THEN ! open new
pa_init.F: IF ( OPEN3( OUTFNAME, FSNEW3, PNAME ) ) THEN ! open new
SSEMIS.F: IF ( .NOT. OPEN3( CTM_SSEMIS_1, FSNEW3, PNAME ) ) THEN
tmpbeis.F: IF ( .NOT. OPEN3( SNAME, FSNEW3, PNAME ) ) THEN
wr_cgrid.F: IF ( .NOT. OPEN3( S_CGRID, FSNEW3, PNAME ) ) THEN

This has been addressed, temporarily, with the run script option "DISP". Setting it to "delete" will get rid of all output and logs files before running CMAQ. That update is undergoing internal review currently and will then be pushed to the repo.

This should be a consistent FSUNKN3 all the way through:
From the I/O API documentation (https://www.cmascenter.org/ioapi/documentation/all_versions/html/OPEN3.html):

FSUNKN3==4 for read/write/update of unknown (new vs. old)
files. If file does not exist, create it;
else check for consistency with user-supplied
file description.
...
For FSUNKN3, if the file already exists, the file type, dimensions, time step and variables supplied by the caller must match those on the file. The caller-supplied starting date and time must be a legal output time step in the time step sequence found on the file: for example, if the starting time from the file header is 1997012:120000, and the time step is one hour (10000), then opening this file FSUNKN3 with a caller-supplied starting date and time of 1997012:180000 is OK (that would be time step number 7 for the file-header time step sequence) but a caller-supplied 1997011:120000 is not, since it is before the starting date and time from the file itself.