CMAQ-ISAM Initial condition error

Hi all,

I am running WRF-CMAQ with ISAM. When I ran CMAQ-ISAM, i got this error

 ============================================
 |>---   CHECK INITIAL CONCENTRATIONS   ---<|
 ============================================
 Variable name VNAME3D(   57  ) = "ASO4J_" duplicates VNAME3D(    1  ) = "ASO4J_" in file "SA_CONC_1"
 Variable name VNAME3D(   58  ) = "ASO4I_" duplicates VNAME3D(    2  ) = "ASO4I_" in file "SA_CONC_1"
 Variable name VNAME3D(   59  ) = "SO2_" duplicates VNAME3D(    3  ) = "SO2_" in file "SA_CONC_1"
 Variable name VNAME3D(   60  ) = "SULF_" duplicates VNAME3D(    4  ) = "SULF_" in file "SA_CONC_1"
 Variable name VNAME3D(   61  ) = "SULRXN_" duplicates VNAME3D(    5  ) = "SULRXN_" in file "SA_CONC_1"
 Variable name VNAME3D(   62  ) = "ANO3J_" duplicates VNAME3D(    6  ) = "ANO3J_" in file "SA_CONC_1"
 Variable name VNAME3D(   63  ) = "ANO3I_" duplicates VNAME3D(    7  ) = "ANO3I_" in file "SA_CONC_1"
 Variable name VNAME3D(   64  ) = "HNO3_" duplicates VNAME3D(    8  ) = "HNO3_" in file "SA_CONC_1"

 Error creating netCDF variable ASO4J_
 netCDF error number  -42  processing file "SA_CONC_1"
 NetCDF: String match to name in use

 *** ERROR ABORT in subroutine OP_SA on PE 000
 Could not create SA_CONC_1        file

PM3EXIT: DTBUF 0:00:00 Jan. 14, 2019
Date and time 0:00:00 Jan. 14, 2019 (2019014:000000)

CMAQ reads isam_cntrol.txt and the region file ok, but somehow the species name duplicate problem occurred.in the check initial concentration. Is this problem related to ICON ?

Any ideas ?

Thanks in advance

Hi,
Can you send your isam_control file? There should be an internal check to remove duplicates before the list of tagged model species is used to specify the output file, but it may have been bypassed somehow in the WRF-CMAQ system.
-Ben

Dear Ben,

Thank for the information. Here is the isam_control.txt file

!!! CMAQ-ISAM tag definition control file
!!! (lines begining with !!! - three exclamaition marks - are ignored by the text parser)
!!!
!!! Example file provided with CMAQ v5.3 release
!!! 05 June 2019: Sergey L. Napelenok
!!!
!!!
!!! The following line defines the tag classes to track for the simulation. Species in NITRATE and VOC classes depend on the
!!! the chemical mechanism used. The below definitions apply for the cb6r3_ae7_aq mechanism.
!!! Choose any/all from the list of nine: SULFATE, NITRATE, AMMONIUM, EC, OC, VOC, PM25_IONS, CO, OZONE
!!! SULFATE - ASO4J, ASO4I, SO2, SULF, SULRXN
!!! NITRATE - ANO3J, ANO3I, HNO3, NO, NO2, NO3, HONO, N2O5, PNA, PAN, PANX, NTR1, NTR2, INTR, CLNO2, CLNO3
!!! AMMONIUM - ANH4J, ANH4I, NH3
!!! EC - AECJ, AECI
!!! OC - APOCI, APOCJ, APNCOMI, APNCOMJ
!!! VOC - 22 species, check CCTM/src/isam/SA_DEFN.F for species names
!!! PM25_IONS - ANAI, ANAJ, AMGJ, AKJ, ACAJ, AFEJ, AALJ, ASIJ, ATIJ, AMNJ, AOTHRI, AOTHRJ
!!! CO - CO
!!! OZONE - all NITRATE species + all VOC species
!!! CHLORINE - ACLI, ACLJ, HCL

!!! The following are source definition text blocks in the format:
!!! TAG NAME |Three character text string
!!! REGION(S) |Keyword EVERYWHERE or variable names from the region file (multiple regions need to be comma delimited)
!!! FILENAME(S) |Emissions labels (multiple labels need to be comma delimited)

!!!TAG CLASSES | SULFATE, OZONE
TAG CLASSES | OZONE

TAG NAME | GR1
REGION(S) | CENSYD
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME | GR2
REGION(S) | ILLA
EMIS STREAM(S) |GMRELEV

ENDLIST eof

My runctm scripts has this reference to this isam_control.txt file

#> Integrated Source Apportionment Method (ISAM) Options
setenv CTM_ISAM Y
if ( $?CTM_ISAM ) then
if ( $CTM_ISAM == ‘Y’ || $CTM_ISAM == ‘T’ ) then

   setenv SA_IOLIST ${WORKDIR}/isam_control.txt
   setenv ISAM_BLEV_ELEV " 1 1"
   setenv AISAM_BLEV_ELEV " 1 1"

   #> Set Up ISAM Initial Condition Flags
   if ($NEW_START == true || $NEW_START == TRUE ) then
      setenv ISAM_NEW_START Y
      setenv ISAM_PREVDAY
   else
      setenv ISAM_NEW_START N
      setenv ISAM_PREVDAY "$OUTDIR/CCTM_SA_CGRID_${RUNID}_${YESTERDAY}.nc"
   endif

   #> Set Up ISAM Output Filenames
   setenv SA_ACONC_1      "$OUTDIR/CCTM_SA_ACONC_${CTM_APPL}.nc -v"
   setenv SA_CONC_1       "$OUTDIR/CCTM_SA_CONC_${CTM_APPL}.nc -v"
   setenv SA_DD_1         "$OUTDIR/CCTM_SA_DRYDEP_${CTM_APPL}.nc -v"
   setenv SA_WD_1         "$OUTDIR/CCTM_SA_WETDEP_${CTM_APPL}.nc -v"
   setenv SA_CGRID_1      "$OUTDIR/CCTM_SA_CGRID_${CTM_APPL}.nc -v"

   #> Set optional ISAM regions files
   setenv CMAQ_REGIONS /home/duch/repository/5.3.1/ioapi-3.2/make_mask/output/reg_allmask_d01.ncf

endif

endif

As this CMAQ application is run on the domain in Sydney, Australia, I created the region mask file using m3tool (m3mask and m3merge). The header of this mask file (reg_allmask_d01.ncf) is followed

netcdf reg_allmask_d01 {
dimensions:
TSTEP = 1 ;
LAY = 1 ;
ROW = 373 ;
COL = 373 ;
DATE-TIME = 2 ;
VAR = 2 ;
variables:
float CENSYD(TSTEP, LAY, ROW, COL) ;
CENSYD:units = “None” ;
CENSYD:var_desc = "1==mask region, 0==outside-mask region " ;
CENSYD:long_name = "CENSYD " ;
float ILLA(TSTEP, LAY, ROW, COL) ;
ILLA:units = “None” ;
ILLA:var_desc = "1==mask region, 0==outside-mask region " ;
ILLA:long_name = "ILLA " ;
int TFLAG(TSTEP, VAR, DATE-TIME) ;
TFLAG:units = “<YYYYDDD,HHMMSS>None” ;
TFLAG:long_name = "TFLAG " ;
TFLAG:var_desc = "Timestep-valid flags: (1) YYYYDDD or (2) HHMMSS " ;

I carefully followed the previous tips and instruction in this forum on the creation of the mask file.

Thanks for your help

Best
Hiep Nguyen
Senior Atmospheric Scientist
Department of Planning, Industry and Environment, NSW, Sydney

It may have something to do with ICON tag. In the error messages, the duplicate species names, such as ASO4J_, do not have tag at the end. Why don’t the tags attached to the species names in the check initial concentration check ?

I looked into the source code in isam directory. I found the sa_array_init.F has this section on checking ICON tag

  DO JSPCTAG = 1, NSPCTAG
    !KRT: extract sa_conc_1 from previous day
    IF ( .NOT. XTRACT3( INNAME, VNAME3D( JSPCTAG ),
 &       1, NLAYS3D, STARTROW, ENDROW, STARTCOL, ENDCOL,
 &       JDATE, JTIME, TEMP ) ) THEN
      Print*,  PNAME, JDATE, JTIME,
 &       'Read failure:  file ' // INNAME //
 &       ' variable ' // VNAME3D( JSPCTAG )
      stop ' end of file...'
    END IF
    !KRT: identify isam indices from input species names
    IBGN = INDEX( VNAME3D( JSPCTAG ),'_', .FALSE. )
    S = INDEX1( VNAME3D( JSPCTAG )( 1:IBGN-1 ),NSPC_SA,SPCNAME1 )
    K = INDEX1( VNAME3D( JSPCTAG )( IBGN+1:LEN_TRIM(VNAME3D(JSPCTAG))),
 &        NTAG_SA, TAGNAME )
    IF ( S .GT. 0 ) THEN
      IF ( K .GT. 0 ) THEN
        DO C = 1, NCOLS
          DO R = 1, NROWS
            DO L = 1, NLAYS3D
              ISAM( C,R,L,S,K ) = TEMP( C,R,L )
            END DO
          END DO
        END DO
      ELSE ! bcon, othr, or icon tags
        CK_SUFFX: SELECT CASE ( VNAME3D(JSPCTAG)(IBGN+1:LEN_TRIM(VNAME3D(JSPCTAG))) )
        CASE ( 'BCON' )
          K = NTAG_SA - 2
        CASE ( 'OTHR' )
          K = NTAG_SA - 1
        CASE ( 'ICON' )
          K = NTAG_SA
        END SELECT CK_SUFFX
        DO L = 1, NLAYS3D
          DO R = 1, NROWS
            DO C = 1, NCOLS
              ISAM( C,R,L,S,K ) = TEMP( C,R,L )
            END DO
          END DO
        END DO
      ENDIF ! emission tags
    ENDIF ! species exist in tags
  END DO ! jspctag

How can I set this tag (ICON) on or do something to avoid the duplicate errors in creating the SA_CONC_1 file ?.

Thanks in advance

Hiep

This is indeed odd. You’ve only declared one Tag Class (ozone), so I wouldn’t expect ISAM to be requiring ASO4 at all in the first place. Try adding sulfate to the Tag Classes to see if that straightens things out.

-Ben

I agree with Ben - it should not have anything to do with the sulfate related species. Is this the first day and first hour of the simulation or are you reading some kind of initial conditions for the apportionment?

Sergey

Hi Ben and Sergey,

The above error messages were from the run with TAG CLASSES | SULPHATE, OZONE.
With TAG CLASSES | OZONE, errors as followed

 CTM_WET_DEP_1   :/mnt/scratch3/CMAQ_installation/data/CTM-hd/casestudy1/2019-01-14/d01/CCTM_WETDEP1_v531_intel_d01_20190114.nc

 ============================================
 |>---   CHECK INITIAL CONCENTRATIONS   ---<|
 ============================================
 Variable name VNAME3D(   52  ) = "ANO3J_" duplicates VNAME3D(    1  ) = "ANO3J_" in file "SA_CONC_1"
 Variable name VNAME3D(   53  ) = "ANO3I_" duplicates VNAME3D(    2  ) = "ANO3I_" in file "SA_CONC_1"
 Variable name VNAME3D(   54  ) = "HNO3_" duplicates VNAME3D(    3  ) = "HNO3_" in file "SA_CONC_1"
 Variable name VNAME3D(   55  ) = "NO_" duplicates VNAME3D(    4  ) = "NO_" in file "SA_CONC_1"
 Variable name VNAME3D(   56  ) = "NO2_" duplicates VNAME3D(    5  ) = "NO2_" in file "SA_CONC_1"
 Variable name VNAME3D(   57  ) = "NO3_" duplicates VNAME3D(    6  ) = "NO3_" in file "SA_CONC_1"
 Variable name VNAME3D(   58  ) = "HONO_" duplicates VNAME3D(    7  ) = "HONO_" in file "SA_CONC_1"
 Variable name VNAME3D(   59  ) = "N2O5_" duplicates VNAME3D(    8  ) = "N2O5_" in file "SA_CONC_1"
 Variable name VNAME3D(   60  ) = "PAN_" duplicates VNAME3D(    9  ) = "PAN_" in file "SA_CONC_1"
 Variable name VNAME3D(   61  ) = "XO2N_" duplicates VNAME3D(   10  ) = "XO2N_" in file "SA_CONC_1"
 Variable name VNAME3D(   62  ) = "NTR1_" duplicates VNAME3D(   11  ) = "NTR1_" in file "SA_CONC_1"
 Variable name VNAME3D(   63  ) = "NTR2_" duplicates VNAME3D(   12  ) = "NTR2_" in file "SA_CONC_1"
 Variable name VNAME3D(   64  ) = "INTR_" duplicates VNAME3D(   13  ) = "INTR_" in file "SA_CONC_1"
 Variable name VNAME3D(   65  ) = "PNA_" duplicates VNAME3D(   14  ) = "PNA_" in file "SA_CONC_1"

Sergey, this is the first day and first hour of the simulation.

Thanks
Hiep

Can you post the exact control file you used for the run that resulted in the errors? The “duplicates” text normally results from having non-unique tag names specified in the control file.

Sergey

Thank you, Sergey. I post here the isam_control.txt file for your information
!!! CMAQ-ISAM tag definition control file
!!! (lines begining with !!! - three exclamaition marks - are ignored by the text parser)
!!!
!!! Example file provided with CMAQ v5.3 release
!!! 05 June 2019: Sergey L. Napelenok
!!!
!!!
!!! The following line defines the tag classes to track for the simulation. Species in NITRATE and VOC classes depend on the
!!! the chemical mechanism used. The below definitions apply for the cb6r3_ae7_aq mechanism.
!!! Choose any/all from the list of nine: SULFATE, NITRATE, AMMONIUM, EC, OC, VOC, PM25_IONS, CO, OZONE
!!! SULFATE - ASO4J, ASO4I, SO2, SULF, SULRXN
!!! NITRATE - ANO3J, ANO3I, HNO3, NO, NO2, NO3, HONO, N2O5, PNA, PAN, PANX, NTR1, NTR2, INTR, CLNO2, CLNO3
!!! AMMONIUM - ANH4J, ANH4I, NH3
!!! EC - AECJ, AECI
!!! OC - APOCI, APOCJ, APNCOMI, APNCOMJ
!!! VOC - 22 species, check CCTM/src/isam/SA_DEFN.F for species names
!!! PM25_IONS - ANAI, ANAJ, AMGJ, AKJ, ACAJ, AFEJ, AALJ, ASIJ, ATIJ, AMNJ, AOTHRI, AOTHRJ
!!! CO - CO
!!! OZONE - all NITRATE species + all VOC species
!!! CHLORINE - ACLI, ACLJ, HCL

!!! The following are source definition text blocks in the format:
!!! TAG NAME |Three character text string
!!! REGION(S) |Keyword EVERYWHERE or variable names from the region file (multiple regions need to be comma delimited)
!!! FILENAME(S) |Emissions labels (multiple labels need to be comma delimited)

!!!TAG CLASSES | SULFATE, OZONE
TAG CLASSES | OZONE

TAG NAME | GR1
!!!REGION(S) | CENSYD
!!!REGION(S) | reg_sydcen
REGION(S) | EVERYWHERE
!!!REGION(S) | WATER, CENSYD
EMIS STREAM(S) |GRIDDED_EMIS

TAG NAME | GR2
!!!REGION(S) | ILLA
!!!REGION(S) | reg_ill
REGION(S) | EVERYWHERE
!!!REGION(S) | WATER, ILLA
!!!EMIS STREAM(S) |GRIDDED_EMIS, GMRELEV
EMIS STREAM(S) |GMRELEV

ENDLIST eof

The run file contains this reference to the above file

#> Integrated Source Apportionment Method (ISAM) Options
setenv CTM_ISAM Y
if ( $?CTM_ISAM ) then
if ( $CTM_ISAM == ‘Y’ || $CTM_ISAM == ‘T’ ) then

   setenv SA_IOLIST ${WORKDIR}/isam_control.txt
   setenv ISAM_BLEV_ELEV " 1 1"
   setenv AISAM_BLEV_ELEV " 1 1"

   #> Set Up ISAM Initial Condition Flags
   if ($NEW_START == true || $NEW_START == TRUE ) then
      setenv ISAM_NEW_START Y
      setenv ISAM_PREVDAY
   else
      setenv ISAM_NEW_START N
      setenv ISAM_PREVDAY "$OUTDIR/CCTM_SA_CGRID_${RUNID}_${YESTERDAY}.nc"
   endif

   #> Set Up ISAM Output Filenames
   setenv SA_ACONC_1      "$OUTDIR/CCTM_SA_ACONC_${CTM_APPL}.nc -v"
   setenv SA_CONC_1       "$OUTDIR/CCTM_SA_CONC_${CTM_APPL}.nc -v"
   setenv SA_DD_1         "$OUTDIR/CCTM_SA_DRYDEP_${CTM_APPL}.nc -v"
   setenv SA_WD_1         "$OUTDIR/CCTM_SA_WETDEP_${CTM_APPL}.nc -v"
   setenv SA_CGRID_1      "$OUTDIR/CCTM_SA_CGRID_${CTM_APPL}.nc -v"

   #> Set optional ISAM regions files

setenv ISAM_REGIONS /work/MOD3EVAL/nsu/isam_v53/CCTM/scripts/input/RGN_ISAM.nc

   setenv CMAQ_REGIONS /home/duch/repository/5.3.1/ioapi-3.2/make_mask/output/reg_allmask_d01.ncf

endif

endif

I don’t see any problems with what you are trying to do. Perhaps, try to simplify to just one and see if it works?

The other thing to check is to make sure you are moving out all existing output files and writing out to a clean directory.

Sergey

Dear Sergey,

I tried your suggestion using TAG CLASSES | CO which has only one species (CO). Still the error as followed

 |>---   CHECK INITIAL CONCENTRATIONS   ---<|
 ============================================
 Variable name VNAME3D(    2  ) = "CO_" duplicates VNAME3D(    1  ) = "CO_" in file "SA_CONC_1"
 Error creating netCDF variable CO_
 netCDF error number  -42  processing file "SA_CONC_1"
 NetCDF: String match to name in use

 *** ERROR ABORT in subroutine OP_SA on PE 000
 Could not create SA_CONC_1        file

The SA_CONC_1 file should have species name as “CO_ICON” rather than “CO_”. The error message tells me that the problem is in subroutine OP_SA.

I looked into the source code, the file op_sa.F contains this relevant code
IF ( ITAG .EQ. BCONTAG ) THEN
CSUFFX = 'BCON ’
CALL WR_VARNAME( SPECIE_NAME, LENGTH, NTAG_SA, NSPC_SA,
& CSUFFX, VNAME( JSPC,ITAG ) )
ELSEIF ( ITAG .EQ. OTHRTAG ) THEN
CSUFFX = 'OTHR ’
CALL WR_VARNAME( SPECIE_NAME, LENGTH, NTAG_SA, NSPC_SA,
& CSUFFX, VNAME( JSPC,ITAG ) )
ELSEIF ( ITAG .EQ. ICONTAG ) THEN
CSUFFX = 'ICON ’
CALL WR_VARNAME( SPECIE_NAME, LENGTH, NTAG_SA, NSPC_SA,
& CSUFFX, VNAME( JSPC,ITAG ) )

It tells us that when there is an icontag then the suffix would be 'ICON ’ (16 characters). And then add this suffix to the species name by calling the subroutine WR_VARNAME.

The subroutine WR_VARNAME is as follows

ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c this subroutine must be implemented to overcome Character1 X 16
c to Character
16 conversion.
c new varname will be created by this way.
c
c by bo wang
c
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

  subroutine wr_varname(input, length, ntag_tssa, nspc_tssa,
 &     src_name, varname)

c …argument
integer length
character1 :: input(length)
integer ntag_tssa, nspc_tssa
character
16 src_name
character*16 varname

c …local variable
integer i
CHARACTER7 CHAR1
Ckrt CHARACTER(len=16-length) :: CHAR1
character(len=length) output
character
16 temp

c …external function
integer len_trim

c…

  do i = 1, length
     output(i:i) = input(i)
  end do

  temp = src_name

!0711 do i = 1, 7
do i = 1, min( 7, 16-length-1 )
char1(i:i) = temp(i:i)
end do

  VARNAME = output // '_' // char1

end

So somewhere the ‘ICON’ suffix tag failed to be added to the species name (CO) to become ‘CO_ICON’ to be created in the SA_CONC_1 file.

I don’t know how this happened.

Please, try running only 1 parameter. Something like this:

TAG CLASSES | CO

TAG NAME | GR1
REGION(S) | EVERYWHERE
EMIS STREAM(S) |GRIDDED_EMIS

Are you writing output to a an empty directory?

Sergey