Skip to content

Commit

Permalink
New tests for EBM with diurnal cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-rose committed Jul 10, 2023
1 parent 169d4ef commit a8b479b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions climlab/tests/test_domain2D.py
Expand Up @@ -70,7 +70,7 @@ def test_diurnal_cycle():

state_daily = climlab.surface_state(num_lat=num_lat,
water_depth=0.5)
deltat_daily = 3600.*24.
deltat_daily = 3600.*12. # 12 hour timestep
olr_daily = climlab.radiation.AplusBT(name='OLR (daily)',
state=state_daily,
timestep=deltat_daily)
Expand All @@ -88,8 +88,14 @@ def test_diurnal_cycle():
# zonal average diurnally-varying insolation should match daily mean insolation
assert np.allclose(ebm.ASR.mean(axis=1), ebm_daily.ASR)

# Now we will check to see if the average ASR over one day at each point in longitude
# Now we will check to see if the average ASR over one day and all longitudes
# is equal to ASR over a single one-day step in the daily insolation model
for model in [ebm, ebm_daily]:
model.integrate_days(1)
assert np.allclose(ebm.ti) # how do we access the time mean again?

# advance the daily model forward by half a day to align the calendars
ebm_daily.step_forward()
# and recalculate the diagnostics at the updated time
ebm_daily.compute_diagnostics()
# Now do one full day for the diurnal model
ebm.integrate_days(1.)
# Results should match within a small absolute tolerance in W/m2.
assert np.allclose(ebm.timeave['ASR'].mean(axis=1), ebm_daily.ASR, atol=0.05)

0 comments on commit a8b479b

Please sign in to comment.