Closed LiamBindle closed 4 years ago
Hi Liam. Thanks for writing.
This seems to be a classic instance of floating point error caused by the difference of two variables that are very close to each other.
<Dry Inorganic>
volInorg: 3.3898305084745676E-023
- H2Oinorg: 3.3898305084745681E-023
-----------------
= numerator_volRatioDry: -5.8774717541114375E-039
For reference, here are a few articles about this subject:
I think it might be OK to set the numerator to zero if it's smaller than e.g. 1e-32 or some other very small number. 1e-39 is essentially zero. Or you could test if the numerator is a certain number of orders of magnitude smaller than the smaller of the values.
Thanks Bob for the help and suggestion! I'll implement a fix like the one you suggest and open a PR.
Just following up on this. I talked with @emcduffie about this last Wednesday and she had some concerns regarding volDryRatio=0
. Specifically, I think the concern is water uptake on the inorganic is non-zero despite the inorganic itself being approximately non-zero (or at least, it's a lot less "non-zero"). She suggested I follow up with Chris Holmes so we can determine if this input to N2O5_InorgOrg()
is problematic, or whether this is input is valid and N2O5_InorgOrg()
is missing some logic.
(@emcduffie, please correct me if I've misexplained anything)
@cdholmes Do you have any thoughts on how to resolve this issue?
See this comment in aerosol_mod.F https://github.com/geoschem/geos-chem/blob/c4b68994f9720f246f38a76489bff4913cf489ed/GeosCore/aerosol_mod.F#L1994-L1997
This explains why the ISORROPIA water content can be non-zero when there is effectively zero sulfate-nitrate-ammonium. Until someone can provide the optical properties of organic-coated sulfate-nitrate-ammonium-seasalt aerosol, we are stuck using external mixing in aerosol_mod.F. Roundoff error could also contribute, as mentioned above.
volDryRatio
should not be less than 0.REFF <= 4 * RW(1)
Addressed in pull request #272
Thanks @cdholmes for the update
I will close out this issue. Feel free to reopen.
@yantosca I still recommend integrating my pull request #272 into the GC code. The pull request fixes the negative value issue and excessive growth identified by Liam. There's still a (longstanding) science issue regarding aerosol mixing state, but that shouldn't stop us from fixing these bugs.
Hi Chris, thanks for writing. Your pull request is slated for 12.9.0. It will go in very soon.
Report a GEOS-Chem bug or technical issue
Describe the bug
Recently I updated my stretched-grid test suite to GCHPctm 13.0.0-alpha.3 which uses GEOS-Chem 12.7.2. In my latest suite of tests about half of them crashed in
N2O5_InorgOrg()
because of floating point exceptions. These floating point exceptions where becauseH2Oinorg
>volInorg
(by a very small amount) which causedvolDryRatio
to be negative: https://github.com/geoschem/geos-chem/blob/c4b68994f9720f246f38a76489bff4913cf489ed/KPP/Standard/gckpp_HetRates.F90#L2127)This led to a FPE a bit later in N2O5_InorOrg. I added some print lines to
N2O5_InorgOrg()
to inspectvolInorg
andH2Oinorg
right before the model crashed. That output wasSo,
volInorg
andH2Oinorg
are approximately the same butH2Oinorg
is slightly bigger.For this to be the case, this means when
N2O5_InorgOrg()
is calledXH2O(8)
(inorganic aerosol water content) >XVOL(8)
(inorganic aerosol specific volume). These are calculated here: https://github.com/geoschem/geos-chem/blob/c4b68994f9720f246f38a76489bff4913cf489ed/KPP/Standard/gckpp_HetRates.F90#L598-L608and
AeroArea
,AeroRadi
, andAeroH2O
for sulfate are calculated here: https://github.com/geoschem/geos-chem/blob/c4b68994f9720f246f38a76489bff4913cf489ed/GeosCore/aerosol_mod.F#L1998-L2043I added some print lines after line 2043 in aerosol_mod.F to inspect
VH2O
,VDry
,RW(1)
,REFF
. Their values right before the model crashed were:So
VDry
is 16 orders of magnitude smaller thanVH2O
which causesREFF
to be huge: https://github.com/geoschem/geos-chem/blob/c4b68994f9720f246f38a76489bff4913cf489ed/GeosCore/aerosol_mod.F#L2018-L2019I tried to traceback the handling of near-zero inorganics, but I got confused. Does anyone know what might be happening here? It almost looks like a precision/truncation problem to me.
I found that if I forced
volDryRatio
to 0 or greater it fixed the floating-point-exceptions and all my simulations ran to completion. Does anyone have any ideas?Required information
Please include the following:
Additional context
volDryRatio
to 0 if it's value was negative the simulations run okay