USEPA / CMAQ

Code for U.S. EPA’s Community Multiscale Air Quality Model (CMAQ) which helps in conducting air quality model simulations
https://epa.gov/CMAQ
MIT License
284 stars 203 forks source link

CMAQ-DDM-3D Control File can not exceed 80 characters per line, when the need to control a large number of sectors and species will report errors #216

Open ArcherAccelerator opened 7 months ago

ArcherAccelerator commented 7 months ago

Description A clear and concise description of the issue. Below is the control file I use when running DDM-3D, I found that CMAQ 5.4 and 5.3.2 give the following error when using the control file below, indicating that the control file only supports 80 characters per line, and this greatly limits the use of DDM-3D.

============= CMAQ-DDM-3D Control File ================

EN1
 EMIS
  GRIDDED_EMIS,GR_RES_FIRES,PT_NONEGU,PT_OILGAS,PT_EGU,PT_RXFIRES,PT_FIRES,PT_OTHFIRES,PT_AGFIRES,PT_OTHER,PT_CMV_C1C2,PT_CMV_C3
 SPECIES
  NO,NO2
 REGION
  USA_ALL

EN2
 EMIS
  GRIDDED_EMIS,GR_RES_FIRES,PT_NONEGU,PT_OILGAS,PT_EGU,PT_RXFIRES,PT_FIRES,PT_OTHFIRES,PT_AGFIRES,PT_OTHER,PT_CMV_C1C2,PT_CMV_C3
 SPECIES
  TOL,NAPH,IOLE,PRPA,MEOH,APIN,ISOP,TERP,BENZENE,ETOH,OLE,ACET,FORM,KET,ETHY,XYLMN,ETH,PAR,ALD2,ETHA,ALDX,GLY
 REGION
  USA_ALL

============= Error Messages ================

     *** ERROR ABORT in subroutine ISAM_STREAMS on PE 047    
      User specified DDM Emissions Stream - PT_OT - not found in available emissions streams
 PM3EXIT:  DTBUF 0:00:01   Jan. 1, -000  
     Date and time 0:00:01   Jan. 1, -000   (      1:000001)

Scope and Impact A description of how other users might be impacted by this issue. All users of DDM-3D are affected, and I have found that the problem is present in both CMAQ 5.3.2 and CMAQ 5.4.

Solution Is there a known solution for the issue? If so, how/when will it be shared with other users.

I found that the problem lies in the following file, the 106th, 163rd, 188th and 215th lines of the file have "A80" field, which means that the length of the read field is limited to 80, replacing it with 255 can solve the above problem. I hope this problem can be fixed in the subsequent version, thank you!

/CMAQ-CMAQv5.4_14Oct2022/CCTM/src/ddm3d/sinput.F /CMAQ-CMAQv5.3.2_12Oct2020/CCTM/src/ddm3d/sinput.F

============= Sinput.F Code Excerpts ================

      ! Read in the type of sensitivity 
      ! (only ICON, EMIS, BCON, RATE, HIGH, and PVO3 implemented so far)
      READ( JVUNIT, '(A80)', END = 999 ) TXT

CCCCCCC Sensitivity to Emissions CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
        IF ( INDEX( TXT, 'EMIS' ) .NE. 0 ) THEN
          IPT( NPSEN ) = 3
          S_NSTREAMS( NPSEN ) = 99 ! assume all streams at first
          S_STREAMLBL( NPSEN,: ) = 'all'
  30      CONTINUE

          ! Check if an emissions label has been specified. Otherwise, assume total.
          READ( JVUNIT, '(A80)', END = 999 ) EMISTYPE

          IF ( INDEX(EMISTYPE,'SPECIES') .NE. 0 )  THEN ! start reading species
            GOTO 35 ! 
          ELSE IF ( INDEX(EMISTYPE,'TOTA') .NE. 0 ) THEN ! all streams
            GOTO 30
          ELSE !
            S_STREAMLBL( NPSEN,: ) = 'empty'
            S_NSTREAMS( NPSEN ) = 1 + COUNT(TRANSFER(EMISTYPE, 'A', LEN(EMISTYPE)) == "," )
            READ(EMISTYPE,*) S_STREAMLBL( NPSEN, 1:S_NSTREAMS( NPSEN ) )
            GOTO 30
          END IF

Additional context Add any other context about the problem here.

kmfoley commented 5 months ago

Thank you for outlining this issue. As applications of DDM-3D have increased in scope, the code needs to change to accommodate larger combinations of emissions streams. We will implement larger string sizes in a future release of the code. Thank you for your contribution!