CliMT / climt

The official home of climt, a Python based climate modelling toolkit.
https://climt.readthedocs.io
Other
160 stars 46 forks source link

RRTMGShortwave not treating surface albedo correctly #119

Open edmundderby opened 4 years ago

edmundderby commented 4 years ago

Description

I've created a model with surface albedo for direct and diffuse SW radiation of 1. I would expect the downwelling and upwelling SW radiation at the surface to be equal, but the downwelling radiation is consistently about twice the upwelling radiation

What I Did

from sympl import (
    AdamsBashforth, PlotFunctionMonitor)
from climt import RRTMGShortwave, RRTMGLongwave, get_default_state, get_grid
from datetime import timedelta
import matplotlib.pyplot as plt
%matplotlib notebook

rad_sw = RRTMGShortwave()
rad_lw = RRTMGLongwave()
time_stepper = AdamsBashforth([rad_sw, rad_lw])
timestep = timedelta(hours=3)

grid = get_grid(nx=1, ny=1, nz=30)
state = get_default_state([rad_sw, rad_lw], grid_state=grid)
state['surface_albedo_for_diffuse_shortwave'].values[:]=1
state['surface_albedo_for_direct_shortwave'].values[:]=1

for i in range(1000):

    diagnostics, new_state = time_stepper(state, timestep)
    state.update(diagnostics)

    print(state['downwelling_shortwave_flux_in_air'].values[0]-state['upwelling_shortwave_flux_in_air'].values[0])

    state = new_state

The issue persists when run for more timesteps. I also get unexpected surface upwelling SW radiation when using other albedo values.

JoyMonteiro commented 4 years ago

Sorry for the delayed reply, has been a crazy few days.

it looks as if you have missed setting the Near-IR albedo.

if I add

state['surface_albedo_for_diffuse_near_infrared'].values[:]=1
state['surface_albedo_for_direct_near_infrared'].values[:]=1

The values for upwelling and downwelling radiation match. However, I see how the terminology can be confusing. This should be documented better.

Thanks for pointing this out.

edmundderby commented 4 years ago

Thanks for the reply, everything works great now! On a related note I've noticed the surface_ice component only modifies the shortwave surface_albedo not the near infrared one. I'm not sure what the exact wavebands are but I think the near infrared region should be affected too.

JoyMonteiro commented 4 years ago

Thanks for catching this. If you are actively thinking about this problem, would you consider creating a pull request to address this issue? I would be happy to integrate it.

edmundderby commented 4 years ago

I've made a pull request including the changes. I'm still not 100% on my understanding of git/github so let me know if I need to change anything!