geoschem / geos-chem

GEOS-Chem "Science Codebase" repository. Contains GEOS-Chem science routines, run directory generation scripts, and interface code. This repository is used as a submodule within the GCClassic and GCHP wrappers, as well as in other modeling contexts (external ESMs).
http://geos-chem.org
Other
167 stars 163 forks source link

Model level check in GC Classic 14.3.1 #2293

Closed YanshunLi-washu closed 4 months ago

YanshunLi-washu commented 5 months ago

Name: Yanshun Li Institution: WashU

Dear Support Team,

I found GCC 14.3.1 can run with NEI2016 v2021-06 but can't run with NEI2011 v2015-03. Running with NEI2011 v2015-03 got me error message Invalid level standard time...Cannot read sigma levels of ....

By checking with the source code, I found the source code of GCC 14.3.1 only support vertically-resolved emissions of specified number of layers. See the below codes in ./HEMCO/src/Core/hco_interp_mod.F90 in the ModelLev_Check subroutine:

IF ( nlev == nz .OR. nlev == nz + 1 ) THEN
       IsModelLev = .TRUE.

 ! If input is 72 layer (or 3/11/36 layer) and output is 47 layer
 ELSEIF ( nz == 47 ) THEN
     IsModelLev = ( nlev == 72 .OR. nlev == 73 .OR. nlev == 36 .OR. nlev == 3 .OR. nlev == 11)

 ! If input is 102 layer and output is 74 layer
   ELSEIF ( nz == 74 ) THEN
   IsModelLev = ( nlev == 102 .OR. nlev == 103 )

  ! If input is 47 layer (or 3/11/36 layer) and output is 72 layer
  ELSEIF ( nz == 72 ) THEN
  IsModelLev = ( nlev == 47 .OR. nlev == 48 .OR. nlev == 36 .OR. nlev == 3 .OR. nlev == 11)

  ELSE
     IsModelLev = .FALSE.
  ENDIF

I'm kind of confused why GCC 14.3.1 only support emissions with levels of these numbers.

But apparently, NEI2016 files got 3 or 11 levels and got a true value of the IsModelLev variable and runs well with the model.

However NEI2011 files has levels like 4 or 6 which are not included here. As a result, the variable IsModelLev become false which require the lev variable in NEI2011 nc files to have the long_time/standard_time attribute to be atmosphere_hybrid_sigma_pressure_coordinate . And the NEI2011 files have the attribute being "GEOS-Chem levels" and therefore leading the error message.

The lev info from ncdump is listed as below:

ncdump -h NEI11_0.1x0.1_20110116_oilgas.nc
netcdf NEI11_0.1x0.1_20110116_oilgas {
dimensions:
    time = 24 ;
    lev = 4 ;
    lat = 400 ;
    lon = 900 ;
variables:
    float time(time) ;
        time:calendar = "standard" ;
        time:units = "hours since 2011-01-16 00:00:00" ;
        time:long_name = "Time" ;
    int lev(lev) ;
        lev:long_name = "GEOS-Chem levels" ;
        lev:units = "model level" ;
        lev:positive = "up" ;

I'm not so sure about the mechanism, but if I want to use the NEI2011 data, what's the best option in GCC 14.3.1? (1)Should I change the long_name attribute to "atmosphere_hybrid_sigma_pressure_coordinate"? (2)Or should I modified the source code to force GCC 14.3.1 to support emission vertical levels of 4 or 6 in NEI2011? (3)Or should I rebuild NEI2011 files to 72 levels?

Interestingly, I'm also testing NEI2011 in GCHP14.3.1, and there are no such error messages. But not sure if the vertical allocation in NEI2011 is correctly used in GCHP14.3.1. (If not, please let me know!)

Thanks, Yanshun

yantosca commented 5 months ago

HI @YanshunLi-washu, thanks for writing. We added a fix for NEI2016 in this issue https://github.com/geoschem/HEMCO/issues/264, but I wonder if this is clobbering the NEI2011 functionality. I think it may work if you change the NEI2011 entries from xyz to xy in the HEMCO_Config.rc file. Tagging @nicholasbalasus, who provided the fix described in this issue.

NEI2011 by now is an old inventory and we haven't had much call for its use anymore. So I'm not surprised there may be an issue with the latest code.

nicholasbalasus commented 5 months ago

Hi @YanshunLi-washu - for the quickest fix, you could modify the code in the same fashion as this commit https://github.com/geoschem/HEMCO/commit/2a4bb1261153842715854ca7a0df1672c10385ee but for the 4 and 6 levels that you need. I'm not sure how GCHP handles vertical regridding.

YanshunLi-washu commented 5 months ago

Got it, thanks! @yantosca @nicholasbalasus

yantosca commented 4 months ago

Closing out this issue. Thanks all!