geoschem / HEMCO

The Harmonized Emissions Component (HEMCO), developed by the GEOS-Chem Support Team.
https://hemco.readthedocs.io
Other
15 stars 31 forks source link

Errors of adding new EFs in GFED4 extension code #238

Closed jinlx closed 9 months ago

jinlx commented 9 months ago

Name and Institution (Required)

Name: Lixu Jin Institution: University of Montana

Description of your issue or question

Hi there,

I was trying to add new fire species by editing the source code in hcox_gfed_include_gfed4.H. Any addtional lines in the GFED4 extension code lead to a crash when running the GC. For example, the GC get stucks after reading GFED4 TOLU after I adding RCHO emission information. The GC.log and addtional lines are provided. Any inputs on fixing the error are welcome!

Thanks, Lixu

GC.log

   - Emit GFED species BC     as model species BCPO
      --> Will use scale factor:    1.00000000
      --> Will use scale field : none
   - Emit GFED species BC     as model species BCPI
      --> Will use scale factor:    1.00000000
      --> Will use scale field : none
   - Emit GFED species OC     as model species OCPO
      --> Will use scale factor:    1.00000000
      --> Will use scale field : none
   - Emit GFED species OC     as model species OCPI
      --> Will use scale factor:    1.00000000
      --> Will use scale field : none
   - Emit GFED species MTPA     as model species MTPA
      --> Will use scale factor:    1.00000000
      --> Will use scale field : none
   - Emit GFED species BENZ     as model species BENZ
      --> Will use scale factor:    1.00000000
      --> Will use scale field : none
   - Emit GFED species TOLU     as model species TOLU

Added lines in the hcox_gfed_include_gfed4.H:

! RCHO
GFED4_SPEC_NAME(36)="RCHO" ! This is from Tess Carter (not sure if the value is right)
Inst%GFED4_EMFAC(36,1)=1.2E-03_hp !SAV - Savannah
Inst%GFED4_EMFAC(36,4)=1.4E-03_hp !DEFO - Tropical
Inst%GFED4_EMFAC(36,3)=8.6E-04_hp !TEMP - Temperate
Inst%GFED4_EMFAC(36,2)=9.4E-04_hp !BORF - Boreal
Inst%GFED4_EMFAC(36,5)=1.4E-03_hp !PET -  Peatland
Inst%GFED4_EMFAC(36,6)=1.7E-03_hp !AGW - Crop residue

The core output is provided as well just in case.

SLURM_NODELIST: hgcpu6-[2-5]
Loading gfortran 11.2.0 and related libraries ...
Loading gcc@11.2.0
Loading cmake%gcc@11.2.0
Loading openmpi%gcc@11.2.0
Loading netcdf-fortran%gcc@11.2.0
Loading netcdf-c%gcc@11.2.0
Loading hdf5%gcc@11.2.0
Loading gdb%gcc@11.2.0
Loading flex%gcc@11.2.0
Loading cdo%gcc@11.2.0
Loading nco%gcc@11.2.0
Loading ncview%gcc@11.2.0
Loading perl@5.38.0%gcc@11.2.0
Number of OpenMP threads: 24

Important environment variables:
CC  (C compiler)       : gcc
CXX (C++ compiler)     : g++
FC  (Fortran compiler) : gfortran
NETCDF_HOME            : /projects/atmoschem/lixujin/spack/opt/spack/linux-rocky8-x86_64/gcc-11.2.0/netcdf-c-4.9.2-bga7lhebxai5iep3kbwl7ppmc5x7wiax
NETCDF_INCLUDE         : /projects/atmoschem/lixujin/spack/opt/spack/linux-rocky8-x86_64/gcc-11.2.0/netcdf-c-4.9.2-bga7lhebxai5iep3kbwl7ppmc5x7wiax/include
NETCDF_LIB             : /projects/atmoschem/lixujin/spack/opt/spack/linux-rocky8-x86_64/gcc-11.2.0/netcdf-c-4.9.2-bga7lhebxai5iep3kbwl7ppmc5x7wiax/lib
NETCDF_FORTRAN_HOME    : /projects/atmoschem/lixujin/spack/opt/spack/linux-rocky8-x86_64/gcc-11.2.0/netcdf-fortran-4.6.1-jgs4w7db2xupt2aet5mvjsbtmwbr5g5d
NETCDF_FORTRAN_INCLUDE : /projects/atmoschem/lixujin/spack/opt/spack/linux-rocky8-x86_64/gcc-11.2.0/netcdf-fortran-4.6.1-jgs4w7db2xupt2aet5mvjsbtmwbr5g5d/include
NETCDF_FORTRAN_LIB     : /projects/atmoschem/lixujin/spack/opt/spack/linux-rocky8-x86_64/gcc-11.2.0/netcdf-fortran-4.6.1-jgs4w7db2xupt2aet5mvjsbtmwbr5g5d/lib

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f1318872b4f in ???
geoschem/geos-chem#1  0x9b58a1 in __hcox_gfed_mod_MOD_hcox_gfed_init
        at /hellgate/home/lj152920/GEOS-CHEM/rundir/MERRA2_4x5_BCs/CodeDir/src/HEMCO/src/Extensions/hcox_gfed_mod.F90:962
/var/spool/slurmd/job327061/slurm_script: line 33: 2811558 Segmentation fault      (core dumped) ./gcclassic > GC.log
real 6.07
user 4.03
sys 1.34
yantosca commented 9 months ago

I will transfer this issue to the HEMCO issue tracker.

yantosca commented 9 months ago

Thanks for writing @jinlx. The seg fault may be an out-of-bounds error. Check to see if you need to also update the N_SPEC parameter in hcox_gfed_mod.F90.

  !=================================================================
  ! MODULE PARAMETERS
  !
  ! N_EMFAC : Number of emission factors per species
  ! N_SPEC  : Max. number of species
  !=================================================================
  INTEGER,           PARAMETER :: N_EMFAC = 6
  INTEGER,           PARAMETER :: N_SPEC  = 35 ! increase from 34 (v12.5.0 default)
                                               ! to 35 for MOH
jinlx commented 9 months ago

Thanks Bob! This is exactly the reason why GC cannot process after adding a new EF in hcox_gfed_include_gfed4.H. I will go ahead and close the issue for now.

yantosca commented 9 months ago

Thanks @jinlx!

Perhaps in the future we can abstract the stuff out of hcox_include_gfed4.H and put it in a YAML file that gets read at startup. Then it'd be easier to change emission factors. I'll put it on the to-do list... :-)