Skip to content

Incorrect formula in LUNA #953

@ekluzek

Description

@ekluzek

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)   

Metadata

Metadata

Assignees

Labels

bugsomething is working incorrectlyscienceEnhancement to or bug impacting science

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions