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

Added catch for unusual case of (hicen_init(n+1) - hicen_init(n))>0 #337

Merged
merged 3 commits into from
Mar 17, 2021
Merged

Added catch for unusual case of (hicen_init(n+1) - hicen_init(n))>0 #337

merged 3 commits into from
Mar 17, 2021

Conversation

proteanplanet
Copy link
Contributor

@proteanplanet proteanplanet commented Sep 2, 2020

Summary: This draft pull request addresses, in part, issue #333, where an erroneous initial condition of (hicen_init(n+1) - hicen_init(n))=0 made its way to the thermodynamic redistribution code.

Developers: @proteanplanet, @dabail10, @whlipscomb, @eclare108213

Testing: Testing has not been completed until feedback is obtained on whether we desire this solution to part of the referred issue.

Changes: The code should be BFB with this change.

Dependencies: None added.

Documentation: None needs to be added with this change.

Additional information: Note that the issue also highlighted the problem of a CFL-like violation in ice thickness redistribution, but this PR does not address that larger science issue. Instead, the CFL-like violation is currently catered for by switching to rebinning redistribution (remap_flag = .false.) when linear redistribution occasionally breaks down. Fixing this is a different problem.

Copy link
Contributor

@eclare108213 eclare108213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this solution, for now, except that it doesn't compile and the warnings implementation (setabort) isn't quite right...

columnphysics/icepack_therm_itd.F90 Outdated Show resolved Hide resolved
@eclare108213
Copy link
Contributor

@proteanplanet
The plan is to simply abort a run if/when this situation occurs, and save the science project to properly fix it for later. I'd be happy to add this error-catch and abort into the code for the next release, which is imminent. Please respond to the comments above and confirm that this is your recommendation for the fix, or alternatively tidy up your code modifications and change this from a draft to a regular PR. Thanks!

@proteanplanet proteanplanet marked this pull request as ready for review March 15, 2021 06:01
@proteanplanet
Copy link
Contributor Author

This is ready for review. Thanks for your patience.

Copy link
Contributor

@eclare108213 eclare108213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @proteanplanet.
@dabail10, does this catch the original error (#333)? Is this also related to #338 or is that a different problem?

@eclare108213 eclare108213 linked an issue Mar 15, 2021 that may be closed by this pull request
Copy link
Contributor

@dabail10 dabail10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good for a short-term fix.

! interpolate between adjacent category growth rates
slope = (dhicen(n+1) - dhicen(n)) / &

if (hicen_init(n+1) - hicen_init(n))>0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be c0 I believe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try compiling this? I believe it should be:

if ((hicen_init(n+1) - hicen_init(n))>c0) then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe even "puny" here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fortran issues were fixed earlier - looks like you needed to refresh, @dabail10 ?


else

write(warnstr,*) subname,...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we want the code to abort in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be an ampersand for continuation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was also fixed.

@apcraig
Copy link
Contributor

apcraig commented Mar 15, 2021

Has anyone run with this change? Is it bit-for-bit?

@eclare108213
Copy link
Contributor

eclare108213 commented Mar 15, 2021

It should be BFB but I don't think it's been tested other than the automated check above. Would be good to do a full suite on it, for sanity's sake. Maybe pull in the other presumed-BFB Icepack change and test both at the same time?
#352

@proteanplanet
Copy link
Contributor Author

Has anyone run with this change? Is it bit-for-bit?

Yes. I have. It is BFB for a one-year test of Icepack on Cori.

@apcraig
Copy link
Contributor

apcraig commented Mar 17, 2021

The icepack test suite is bit-for-bit with this PR. Will test this in CICE next.

https://github.com/CICE-Consortium/Test-Results/wiki/icepack_by_hash_forks#8d68802687d01cf7224a2803be88394c8c3e5ced

@apcraig
Copy link
Contributor

apcraig commented Mar 17, 2021

@apcraig apcraig merged commit 7223366 into CICE-Consortium:master Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Divide by zero bug
4 participants