CliMA / ClimaLand.jl

Clima's Land Model
Apache License 2.0
36 stars 9 forks source link

Roundoff error in two stream scheme #645

Open kmdeck opened 3 months ago

kmdeck commented 3 months ago

Describe the bug

We get incorrect absorbed/reflected/transmitted radiation from plant_absorbed_pfd for both of our radiation schemes when the zenith angle is pi/2 or the sun is below the horizon, and when LAI is very small. This is because we have things like: K = 1/cos(theta), where theta = zenith angle and exp(-K*LAI)

We should be able to remove the LAI clipping done in the global run once we do this.

For now, I clip LAI in the TimeVaryingInput so that if LAI < 0.05, LAI = 0 exactly. Then exp(-K*LAI) =1.

To Reproduce

see failing test in kd/radiation_roundoff_bug

juliasloan25 commented 1 week ago

We should be able to remove the LAI clipping done in the global run once we do this.

What is the change that will allow us to remove the LAI clipping?