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

Incorrect formula in LUNA #953

Closed
ekluzek opened this issue Mar 30, 2020 · 1 comment · Fixed by #961
Closed

Incorrect formula in LUNA #953

ekluzek opened this issue Mar 30, 2020 · 1 comment · Fixed by #961
Assignees
Labels
bug something is working incorrectly science Enhancement to or bug impacting science

Comments

@ekluzek
Copy link
Collaborator

ekluzek commented Mar 30, 2020

Brief summary of bug

LUNA has a term where the night-time and day-time effect is averaged. The formula as implemented uses the day-time value for both night and day.

This was found by @lmbirch89. Thank you for figuring this out.

General bug information

CTSM version you are using: ctsm1.0.dev086
Does this bug cause significantly incorrect results in the model's science? Unknown
Configurations affected: Clm5.0

Details of bug

tleafd10 is the day-time value and tleafn10 is the night-time value. To get tleaf10 it averages the two over the length of time they both apply.

Important details of your setup / configuration so we can reproduce the bug

Anytime LUNA is on. LUNA is always off for Fates and normally off for CLM4.5

Important output or errors that show the problem

Here's the bug in the code:

git diff LunaMod.F90
diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90
index 35a38701..2fe5f1f8 100644
--- a/src/biogeophys/LunaMod.F90
+++ b/src/biogeophys/LunaMod.F90
@@ -332,7 +332,7 @@ module LunaMod
          hourpd = dayl(g) / 3600._r8             
          tleafd10 = t_veg10_day(p) - tfrz
          tleafn10 = t_veg10_night(p) - tfrz
-         tleaf10  = (dayl(g)*tleafd10 +(86400._r8-dayl(g)) * tleafd10)/86400._r8            
+         tleaf10  = (dayl(g)*tleafd10 +(86400._r8-dayl(g)) * tleafn10)/86400._r8            
          tair10 = t10(p)- tfrz
          relh10 = min(1.0_r8, rh10_p(p))  
         rb10v = rb10_p(p)   
@ekluzek
Copy link
Collaborator Author

ekluzek commented Apr 2, 2020

I checked the code history and this problem goes back to the very first version of Luna we had from 2015.

ekluzek added a commit to ekluzek/CTSM that referenced this issue Jun 4, 2020
@samsrabin samsrabin added the science Enhancement to or bug impacting science label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is working incorrectly science Enhancement to or bug impacting science
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants