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

Short-circuit logic NOT avoiding FPE (Floating Point Exception) #11

Closed
j34ni opened this issue Feb 15, 2021 · 4 comments
Closed

Short-circuit logic NOT avoiding FPE (Floating Point Exception) #11

j34ni opened this issue Feb 15, 2021 · 4 comments

Comments

@j34ni
Copy link

j34ni commented Feb 15, 2021

@ctsm-core
@MichaelSchulzMETNO

I found another bug in release-clm5.0.14-Nor_v1.0.1, but the option to raise an issue has not been activated for the repository https://github.com/NorESMhub/CTSM

This is one of those bugs which make NorESM crash randomly, and it is not result changing otherwise

Notice that it has been recently fixed in ESCOMP/CTSM (before release-cesm2.2)

Can someone indicate me the "official" procedure to make this correction for NorESM?

@MichaelSchulzMETNO
Copy link

To my understanding Issue tracking is enabled for NorESMhub/CTSM.

@MichaelSchulzMETNO MichaelSchulzMETNO transferred this issue from NorESMhub/NorESM Apr 23, 2021
@MichaelSchulzMETNO
Copy link

@huitang-earth @DirkOlivie
This bug needs to be fixed in branch release-clm5.0.14-Nor. It is not answer changing.
@j34ni Jean can you please point to the code which needs to be changed.

@j34ni
Copy link
Author

j34ni commented Apr 23, 2021

I suggest that in components/clm/src/biogeochem/ch4Mod.F90 this test:

3605                   else if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8 .and. &
3606                        h2osfc(c)/frac_h2osfc(c) > capthick) then ! Assuming short-circuit logic will avoid FPE here.
3607                      ! assume surface ice is impermeable
3608                      pondres = 1/smallnumber
3609                   end if

is written as:

                  else if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8) then 
                          if (h2osfc(c)/frac_h2osfc(c) > capthick) then ! Since short-circuit logic will NOT avoid FPE here.
                             ! assume surface ice is impermeable
                             pondres = 1/smallnumber
                          end if
                  end if

to prevent random crashes when frac_h2osfc(c)=0

@huitang-earth
Copy link

huitang-earth commented Apr 23, 2021

@j34ni Could you make a pull request for these changes?

MichaelSchulzMETNO added a commit to MichaelSchulzMETNO/CTSM that referenced this issue Apr 27, 2021
Update according to issue NorESMhub#11 , non answer changing, split 'and' statement, so that code is not crashing.
mvdebolskiy pushed a commit that referenced this issue Sep 25, 2024
Updates to the ctsm5.3.0 ChangeLog and README files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants