Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG/ISSUE] Error in resuspension for wet deposition #501

Closed
lfreese opened this issue Nov 2, 2020 · 24 comments
Closed

[BUG/ISSUE] Error in resuspension for wet deposition #501

lfreese opened this issue Nov 2, 2020 · 24 comments
Assignees
Labels
category: Bug Something isn't working

Comments

@lfreese
Copy link

lfreese commented Nov 2, 2020

Similar to the bug reported in #259 I am coming across issues with the wet dep on 12/30/15. In my scenario I am running 12.9.3, am using all of the regular input files and have not modified the code, other than to add emissions that will run in 2016 to replace the usual NEI emissions. This shouldn't be the problem, as those emissions files have worked in 2016 runs, and this error occurs in 2015. I am running a 6 month spinup, and this error is occuring right at the end of it.

Error messages

===============================================================================
WETDEP: ERROR at   85 118  41 for species   57 in area RESUSPENSION in middle le
vels
 LS          :  T
 PDOWN       :   0.000000000000000E+000
 QQ          :   0.000000000000000E+000
 ALPHA       :   0.000000000000000E+000
 ALPHA2      :   0.000000000000000E+000
 RAINFRAC    :   0.000000000000000E+000
 WASHFRAC    :   0.000000000000000E+000
 MASS_WASH   :   0.000000000000000E+000
 MASS_NOWASH :   0.000000000000000E+000
 WETLOSS     :   0.000000000000000E+000
 GAINED      :   0.000000000000000E+000
 LOST        :   0.000000000000000E+000
 DSpc(NW,:)  :   0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
  0.000000000000000E+000  0.000000000000000E+000  0.000000000000000E+000
 Spc(I,J,:N) :   1.072852611123207E-021  2.839116292930617E-021
  5.482257466754399E-021  1.228823682099759E-020  2.395922466242335E-020
  4.447687790087576E-020  7.159208434896031E-020  1.217895601662315E-019
  1.775940738225323E-019  2.447425186109845E-019  3.113221130465044E-019
  3.809901560772298E-019  7.045187706190350E-019  1.160574692746769E-018
  1.876957116502153E-018  3.851534048091209E-018  8.617458312727800E-018
  1.769548457498790E-017  5.543458139991769E-017  1.067789021237071E-016
  1.873786588429881E-016  2.943533044225179E-016  4.776923196386522E-016
  9.022651491892589E-016  2.301810370797183E-015  7.559199402558858E-015
  3.805747173974351E-014  3.007994673206834E-013  1.683897216925356E-018
  9.371481180082962E-024  5.087945532618216E-029  2.166089200835819E-041
  8.958640701124154E-047  2.940362660788172E-052  8.061236234416610E-058
  2.812966610545459E-063  3.469191361172601E-068  8.024679059976984E-063
  1.171859465590063E-057  1.248681229188077E-052 -5.100540729979787E-047
  3.574213422113700E-030  1.241983177876728E-023  6.018666657587535E-017
  1.374717359226336E-014  5.107445818386833E-015  1.124369644520480E-015
  1.775940738225323E-019  2.447425186109845E-019  3.113221130465044E-019
  3.809901560772298E-019  7.045187706190350E-019  1.160574692746769E-018
  1.876957116502153E-018  3.851534048091209E-018  8.617458312727800E-018
  1.769548457498790E-017  5.543458139991769E-017  1.067789021237071E-016
  1.873786588429881E-016  2.943533044225179E-016  4.776923196386522E-016
  9.022651491892589E-016  2.301810370797183E-015  7.559199402558858E-015
  3.805747173974351E-014  3.007994673206834E-013  1.683897216925356E-018
  9.371481180082962E-024  5.087945532618216E-029  2.166089200835819E-041
  8.958640701124154E-047  2.940362660788172E-052  8.061236234416610E-058
  2.812966610545459E-063  3.469191361172601E-068  8.024679059976984E-063
  1.171859465590063E-057  1.248681229188077E-052 -5.100540729979787E-047
  3.574213422113700E-030  1.241983177876728E-023  6.018666657587535E-017
  1.374717359226336E-014  5.107445818386833E-015  1.124369644520480E-015
===============================================================================
===============================================================================
GEOS-Chem ERROR: Error encountered in wet deposition!
 -> at SAFETY (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Error encountered in "Safety"!
 -> at Do_Complete_Reevap (in module GeosCore/wetscav_mod.F90)
===============================================================================

:
  1.775940738225323E-019  2.447425186109845E-019  3.113221130465044E-019
  3.809901560772298E-019  7.045187706190350E-019  1.160574692746769E-018
  1.876957116502153E-018  3.851534048091209E-018  8.617458312727800E-018
  1.769548457498790E-017  5.543458139991769E-017  1.067789021237071E-016
  1.873786588429881E-016  2.943533044225179E-016  4.776923196386522E-016
  9.022651491892589E-016  2.301810370797183E-015  7.559199402558858E-015
  3.805747173974351E-014  3.007994673206834E-013  1.683897216925356E-018
  9.371481180082962E-024  5.087945532618216E-029  2.166089200835819E-041
  8.958640701124154E-047  2.940362660788172E-052  8.061236234416610E-058
  2.812966610545459E-063  3.469191361172601E-068  8.024679059976984E-063
  1.171859465590063E-057  1.248681229188077E-052 -5.100540729979787E-047
  3.574213422113700E-030  1.241983177876728E-023  6.018666657587535E-017
  1.374717359226336E-014  5.107445818386833E-015  1.124369644520480E-015
===============================================================================
===============================================================================
GEOS-Chem ERROR: Error encountered in wet deposition!
 -> at SAFETY (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Error encountered in "Safety"!
 -> at Do_Complete_Reevap (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR:
 -> at WetDep (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Error encountered in "Wetdep"!
 -> at Do_WetDep (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-CHEM ERROR: Error encountered in "Do_WetDep"!
STOP at  -> at GEOS-Chem (in GeosCore/main.F90)
===============================================================================
~
(END)
  1.775940738225323E-019  2.447425186109845E-019  3.113221130465044E-019
  3.809901560772298E-019  7.045187706190350E-019  1.160574692746769E-018
  1.876957116502153E-018  3.851534048091209E-018  8.617458312727800E-018
  1.769548457498790E-017  5.543458139991769E-017  1.067789021237071E-016
  1.873786588429881E-016  2.943533044225179E-016  4.776923196386522E-016
  9.022651491892589E-016  2.301810370797183E-015  7.559199402558858E-015
  3.805747173974351E-014  3.007994673206834E-013  1.683897216925356E-018
  9.371481180082962E-024  5.087945532618216E-029  2.166089200835819E-041
  8.958640701124154E-047  2.940362660788172E-052  8.061236234416610E-058
  2.812966610545459E-063  3.469191361172601E-068  8.024679059976984E-063
  1.171859465590063E-057  1.248681229188077E-052 -5.100540729979787E-047
  3.574213422113700E-030  1.241983177876728E-023  6.018666657587535E-017
  1.374717359226336E-014  5.107445818386833E-015  1.124369644520480E-015
===============================================================================
===============================================================================
GEOS-Chem ERROR: Error encountered in wet deposition!
 -> at SAFETY (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Error encountered in "Safety"!
 -> at Do_Complete_Reevap (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR:
 -> at WetDep (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-Chem ERROR: Error encountered in "Wetdep"!
 -> at Do_WetDep (in module GeosCore/wetscav_mod.F90)
===============================================================================

===============================================================================
GEOS-CHEM ERROR: Error encountered in "Do_WetDep"!
STOP at  -> at GEOS-Chem (in GeosCore/main.F90)
===============================================================================

Required information:

Your GEOS-Chem version and runtime environment:

  • GEOS-Chem version: 12.9.3
  • Compiler version: intel/2017.0.1

Input and log files to attach

I've run it with the debug, bounds, traceback and fpex on so that I could debug it, but it isn't clear to me what is causing the sudden issue on this date after almost 6 months of successful runs.

my_runerr.txt
my_runout.txt

@lfreese lfreese added the category: Bug Something isn't working label Nov 2, 2020
@yantosca yantosca self-assigned this Nov 2, 2020
@yantosca yantosca changed the title [BUG/ISSUE] [BUG/ISSUE] Error in resuspension for wet depositon Nov 2, 2020
@yantosca
Copy link
Contributor

yantosca commented Nov 2, 2020

Hi @lfreese, thanks for writing.

There are a couple of things going on here. From the stderr output we have this traceback:

===============================================================================\
G E O S - C H E M   U S E R   I N P U T\
\
READ_INPUT_FILE: Opening ./input.geos\
\
forrtl: error (65): floating invalid\
Image              PC                Routine            Line        Source\
libintlc.so.5      00002B2250691BF1  tbk_trace_stack_i     Unknown  Unknown\
libintlc.so.5      00002B225068FD2B  tbk_string_stack_     Unknown  Unknown\
libifcoremt.so.5   00002B224E92FAC2  Unknown               Unknown  Unknown\
libifcoremt.so.5   00002B224E92F916  tbk_stack_trace       Unknown  Unknown\
libifcoremt.so.5   00002B224E888AB0  for__issue_diagno     Unknown  Unknown\
libifcoremt.so.5   00002B224E89AB11  for__signal_handl     Unknown  Unknown\
libpthread-2.23.s  00002B22508F5C20  Unknown               Unknown  Unknown\
libnetcdf.so.11.0  00002B224B3345A4  nc4_convert_type      Unknown  Unknown\
libnetcdf.so.11.0  00002B224B338FD7  nc4_get_vara          Unknown  Unknown\
libnetcdf.so.11.0  00002B224B34348A  NC4_get_vara          Unknown  Unknown\
libnetcdf.so.11.0  00002B224B29383A  NC_get_vara           Unknown  Unknown\
libnetcdf.so.11.0  00002B224B2919D0  nc_get_vara_float     Unknown  Unknown\
libnetcdff.so.6.1  00002B224AD950C2  nf_get_vara_real_     Unknown  Unknown\
geos               0000000001F226A5  m_netcdf_io_read_         825  m_netcdf_io_read.F90\
geos               0000000001F44C8E  ncdf_mod_mp_nc_re        1108  ncdf_mod.F90\
geos               0000000001812291  hcoio_read_std_mo         732  hcoio_read_std_mod.F90\
geos               0000000001969747  hcoio_dataread_mo         257  hcoio_dataread_mod.F90\
geos               00000000017FECBE  hco_readlist_mod_         510  hco_readlist_mod.F90\
geos               00000000017FE15A  hco_readlist_mod_         327  hco_readlist_mod.F90\
geos               00000000017F5DDD  hco_driver_mod_mp         163  hco_driver_mod.F90\
geos               00000000004E0F02  hcoi_gc_main_mod_         828  hcoi_gc_main_mod.F90\
geos               0000000000B75388  emissions_mod_mp_         202  emissions_mod.F90\
geos               00000000004C14AB  MAIN__                    766  main.F90\
geos               000000000040392E  Unknown               Unknown  Unknown\
libc-2.23.so       00002B2250D25731  __libc_start_main     Unknown  Unknown\

which seems to indicate a floating-point invalid (perhaps underflow) in reading data from netCDF (the m_netcdf_io_read.F90 is the module that reads data from disk. You might want to check your emissions files to make sure that there isn't a stray NaN in the data. Or if there isn't a NaN in the data, make sure that the data values are all representable by REAL*4 precision (i.e. nothing smaller than ~1e-38).

The error in wetdep may be a side-effect of the netCDF error. Species #57 is HI, one of the halogens, and it seems it is going to a very small negative value (-5.100540729979787E-047).

@yantosca yantosca changed the title [BUG/ISSUE] Error in resuspension for wet depositon [BUG/ISSUE] Error in resuspension for wet deposition Nov 2, 2020
@lfreese
Copy link
Author

lfreese commented Nov 3, 2020

Hi Bob,

Thanks for the help! I've checked the emission files, especially those that I modified for these runs from the normal NEI, and am not finding any NaNs in the data. Is it possible that it is an issue with the meteorology, or that I should find a way to work around such a small negative number?

Lyssa

@yantosca
Copy link
Contributor

yantosca commented Nov 5, 2020

Hi @lfreese. I wonder if the initial conditions may be causing this. If you use the GEOS-Chem restart file that ships with the run directory, that is quite old (we are replacing these in 13.0.0). It probably does not have accurate initial conditions for e.g. the isoprene chemistry species. Any species that isn't found in the restart file gets set to a very small number (e.g. 1e-30), so that can increase the chance of a value going negative.

You can try to take the restart file for your start month from the last 1-yr benchmark (download from: ftp.as.harvard.edu/gcgrid/geos-chem/1yr_benchmarks/GC_12/12.9.0/FullChem/GCC/restarts.tar.gz) and use that for your initial conditions. That might help.

@yantosca
Copy link
Contributor

Hi @lfreese, just checking if you are still encountering problems with this issue. If not let us know and we can close this issue out.

@lfreese
Copy link
Author

lfreese commented Nov 10, 2020

Sorry--our server was down for the week, so I just got to trouble shooting again. It does look like it is an issue with the emissions files as when I try running it with the 1-year benchmark and it still stops with the error of reading in NaNs from emissions files. I'm looking into the files that should be read in after my inventory (which looks like its the last one being read into HEMCO) to see if that is where the error occurs, or if my emissions inventory does have an issue.

@yantosca
Copy link
Contributor

Thanks for the update. One thing I've found is that if you use Python xarray to create files, then it seems to fill missing values with NaN's. I wonder if that is the cause of the error. You can also use xarray to strip out the NaNs and to convert those to zeros if that helps.

@yantosca
Copy link
Contributor

Also you might want to try using the HEMCO standalone to see if you can read the data properly. That might let you narrow down where the error is in the data files.

@eamarais
Copy link

Hi @lfreese and @yantosca , I'm experience the same issue using the same version (12.9.3) in the same year (2015), but in March 2015. I'm in the process of investigating which emissions are causing the problem, but I thought I'd check in to see if you've identified the source of the problem.

@lfreese
Copy link
Author

lfreese commented Nov 15, 2020

@eamarais I haven't solved it yet. Initially, this was a confluence of two errors--I had HEMCO files I made myself that looked to be pulling in some NaNs on this date, but once I fixed those the wetdep error continues to appear. I've re-run things using the restart file that was created for 20151230 on 20151231, and it works (so it's not the issue of a restart), so it must be an issue with a HEMCO emissions file for that specific day. I'm going to plug through looking at the different emissions inputs today and will update you when I find the source of NaNs. I didn't do my run in March 2015 (I started in June), so it would make sense that I didn't hit this error on the date you did.

@lfreese
Copy link
Author

lfreese commented Nov 15, 2020

Short update--the only input files that seem to have a NaN are:

ExtData/HEMCO/EDGARv42/v2015-02/NO/EDGAR_hourly_NOxScal.nc NOXscale nan found
ExtData/HEMCO/IODINE/v2017-09/CH3I_monthly_emissions_Ordonez_2012_COARDS.nc CH3I nan found

I'm testing runs with the NaNs replaced in each of these files to see if this is the source.

@eamarais
Copy link

eamarais commented Nov 15, 2020

I've performed tests turning off different emission inventories. When I turn off MEGAN I move past the point where the error occurs. I'm using online MEGAN emissions.

@eamarais
Copy link

@lfreese I think it's a meteorology issue, as you suspected earlier in the thread. I haven't identified the cause, but I've run a few tests now. When I run the model in 2015 using 2014 met fields I don't get the wet deposition error.

@yantosca
Copy link
Contributor

The error in MEGAN might be this. I recently fixed this for 13.0.0:

geoschem/HEMCO@c12a707

The problem in that where the FLUXACET array is allocated in the MEGAN extension, we had a typo right below that that assigned FLUXACETmo to zero. The problem being that at this point, FLUXACETmo was not allocated (it gets allocated below).

If you have that in your 12.9.3 code, try making the same fix there and then recompiling.

NOTE: In 13.0.0 and later, HEMCO will be a completely separate repository than GEOS-Chem.

@eamarais
Copy link

Thanks @yantosca. The version of the code I'm using doesn't include FLUXACET, just the three components: FLUXACETmo, FLUXACETmb, and FLUXACETbg, so I don't think this is the issue.

@eamarais
Copy link

Hi @yantosca and @lfreese. I've narrowed it down to an issue with MERRA-2 PRECIP fields, but I can't see an obvious cause (no NaNs or negative values in the file). When I run the simulation with 2014 instead of 2015 MERRA-2 precip fields the model progresses without an error.

@lfreese
Copy link
Author

lfreese commented Nov 17, 2020

I'm having similar occurrences--I used my 20151229 restart file to start a run on 20160101 to see if it ran forward fine, and it does, while it breaks if I run it through 20151230. I'm wondering if it is the gradients of the PRECIP fields as none of mine have NaNs either, but I wonder if a sharp gradient in combination with already very small halogen levels may cause negative values to arise. I'm looking into the gradients for the different precip fields to see if this could be the cause and will report back later. I'm looking at the total precip for this, but if you have suggestions on a better one to look at I'll do that as well.

@eamarais
Copy link

I get error messages for all the precip fields, so looking at total precip to diagnose the error should be sufficient.

@lfreese
Copy link
Author

lfreese commented Nov 19, 2020

Quick update--the precip fields do not have any really large gradients and I'm unclear where the error would be coming from for them. I am now looking into the linearized stratospheric chem as that is looking like a potential source of the error which is then propagating into the wetdep.

@lfreese
Copy link
Author

lfreese commented Nov 23, 2020

@yantosca and @eamarais I haven't yet figured out the true source of this error-- I'm attaching my latest debugging output in the case that it might help, but right now I'm looking into whether or not I should round all negative values to 0, as I'm not sure the next best steps for debugging this.

run_out.txt

@yantosca
Copy link
Contributor

Thanks @lfreese for the output. It seems like there are weird values in the restart file:

R E S T A R T   F I L E   I N P U T

Min and Max of each species in restart file [mol/mol]:
Species   1,     ACET: Min = 0.000000000E+00  Max = 1.125820681E-08
Species   2,     ACTA: Min = 0.000000000E+00  Max = 4.070461745E-10
Species   3,     AERI: Min = 0.000000000E+00  Max = 1.221035252E-11
Species   4,     ALD2: Min = ***************  Max = 2.943241650E-09
Species   5,     ALK4: Min = ***************  Max = 1.858315102E-07

those might be either NaN or underflow values. You might want to scan the restart file with Python and see what those values really are. If they are very low you can reset them to zero.

@lfreese
Copy link
Author

lfreese commented Nov 30, 2020

@yantosca thanks for the suggestion! I've fixed those and it is still giving a negative value at level 41 in the atmosphere for HI. My current understanding of the track of the errors is that:

  1. We get an error in resuspension in middle levels, which indicates there is precip entering the grid box but not leaving
  2. I end up with negative values of HI because of too much rainout
  3. there is an error in the SAFETY because it finds a negative value

Is there a way to in the SAFETY to just set anything that is really small and negative to a zero when it finds a negative value?

@yantosca
Copy link
Contributor

yantosca commented Dec 2, 2020

Hi @lfreese. Yes you could do this within SAFETY if you wish. The specific modifications you would need is to change the read-only attribute of the Spc vector in the argument list, i.e. change:

    REAL(fp),         INTENT(IN)  :: Spc(State_Grid%NZ)

to

    REAL(fp),         INTENT(INOUT)  :: Spc(State_Grid%NZ)

and then the easiest way to change negative values would be to do something like this:

WHERE ( Spc < 0.0_fp )
   Spc = 0.0_fp
ENDWHERE

@yantosca
Copy link
Contributor

Hi @lfreese. Just checking in if there you have found a solution for this. If so, we can close out this issue.

@lfreese
Copy link
Author

lfreese commented Jan 29, 2021

I did (although it is still somewhat a hack of setting this to zero, so if someone comes across this issue with these dates of meteo again, it might be worth revisiting). I ended up editing do_complete_reevap as that was the root of the error:

       ! Error checks
       !--------------------------------------------------------------------
       
       ! LFREESEFIX SMALL NEGATIVES TO BE 0
       !WHERE ( Spc < 0e+0_fp )
       !   Spc = 0e+0_fp
       !ENDWHERE
       
       IF ( Spc(I,J,L,N) < 0e+0_fp ) THEN
          Spc(I,J,L,N) = 0e+0_fp
       ENDIF ``` 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants