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] Potential div-by-zero error in emissions_mod (routine MMR_Compute_Flux) #1215
Comments
NOTE: I think this issue does not affect GEOS-Chem Classic, because the domain is global. But it is possible that one core might have all grid boxes where the mask is zero, and thus, a division-by-zero error will happen on that core. Recall that in the standard cubed-sphere grid (without stretching or rotation), one of the faces is completely in the southern hemisphere, and another face is completely in the northern hemisphere. |
Actually I think we should leave this line as-is: ! Compute flux [mol/m2]
Flux(:,:) = ( Total_Spc / Total_Area ) * MASK(:,:) |
Just realized that for GCHP, we do not yet use the 90 day passive species (GlobEmis90DayTracer, NHEmis90DayTracer, SHEmis90DayTracer). So this is not as critical of a fix, but it should go into the code at some point (probably for 14.0.0). |
This commit fixes the issue reported in geoschem/geos-chem #1215. We now make sure to skip computation of Flux if Total_Area = 0, in order to avoid a div-by-zero condition. We also now use logical variables to indicate if the current species is the 90-day global, NH, or SH passive species. This will reduce the number of string comparisons, and is more efficient. Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
Further discussion will be in PR #1216 |
This issue has been automatically marked as stale because it has not had recent activity. If there are no updates within 7 days it will be closed. You can add the "never stale" tag to prevent the Stale bot from closing this issue. |
This fix has now been pushed to |
What institution are you from?
GCST
Overview
While working on GCHP, I discovered a potential issue in the routine
MMR_Compute_Flux
, which is used for certain passive species in the TransportTracers simulation. The code could potentially lead to a div-by-zero error if theTotal_Area
variable is zero in this code block:geos-chem/GeosCore/emissions_mod.F90
Lines 488 to 550 in 9ab6931
Total_Area
is multiplied by MASK here, which can be zero for certain passive species depending on latitude.Solution
We can rearrange the code so that we avoid the div-by-zero condition as such:
Also note, I believe the multiplication of
Flux
byMASK(:,:)
is now redundant, as the mask has already been multiplied by total area. So whenMASK=0
,Total_Area=0
as well.The text was updated successfully, but these errors were encountered: