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

Noah MP Glacier: should snowalb_bats_glacier be called even if cosz<0? #227

Open
climbfuji opened this issue Oct 7, 2024 · 5 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@climbfuji
Copy link

climbfuji commented Oct 7, 2024

Description

Tracking a bug in NEPTUNE/CCPP physics where I am getting a FPE invalid from Noah MP Glacier line 974 because:

DH DEBUG: sl1, sl2, cosz:   0.5000000E+00   0.4000000E+01  -0.2500000E+00

just before

cf1=((1.+sl1)/(1.+sl2*cosz)-sl1)

According to the note in

this calculation is only valid for cosz>0. Looking through the entire file, there are notes all over the place that cosz should be between 0 and 1, but there are also if statements, for example in glacier_atm, that set swdown to zero if cosz < 0.

I am hoping for some feedback/suggestions from the NoahMP developers before I spend hours debugging this further (and fixing it the wrong way). Thanks!

@dustinswales
Copy link
Collaborator

That sure looks like a bug to me.

@rhaesung
Copy link
Collaborator

rhaesung commented Oct 8, 2024

@HelinWei-NOAA @barlage Could you please provide any suggestions or feedback on this issue?

@HelinWei-NOAA
Copy link
Collaborator

I agree it is a bug. My suggestion is to add if (cosz > 0) block before calling both snowalb_bats_glacier and snowalb_class_glacier at line 845

@climbfuji
Copy link
Author

Thanks @HelinWei-NOAA and everyone else. This is resolved by NCAR#1091 in NCAR ccpp-physics main.

@barlage
Copy link
Collaborator

barlage commented Oct 9, 2024

Though I don't have an issue with this if statement proposed in NCAR#1091, this should probably be dealt with in the same way that it is in the non-glacier code (similar to what @HelinWei-NOAA said above). Unfortunately, that is done with a goto statement which I assume we want to avoid and should be replaced with an if block around the albedo calculation section, i.e., replace the goto 100 with then and 100 continue with end if.

However, I see another potential issue with this as a solution in the glacier code since the ice albedo is fixed. This means the albedo at night will be >0 and will then get replaced at the driver level. And will then get used on the time step when the sun comes up (if the land model is not called before the radiation time step). Unless the initialization of sag,fsa,fsr are moved up above the albedo calculation.

So, apologies for thinking through this here, but probably the solution proposed by @HelinWei-NOAA is good for now and we can deal with the timing issue later.

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

No branches or pull requests

7 participants