AquaticEcoDynamics / GLM

Code for the General Lake Model
http://aquatic.science.uwa.edu.au/research/models/GLM/
GNU General Public License v3.0
35 stars 29 forks source link

Fixes for time bugs #16

Closed oatnewguo closed 7 months ago

oatnewguo commented 5 years ago

Hi! I'm working with Professors Quinn Thomas and Cayelan Carey at Virginia Tech, and I've developed some bug fixes regarding time that you might be interested in. Currently, GLM seems to have bugs that arise when we try to run it from any time except midnight to midnight, and we wanted to be able to run it at other times of day. We believe these bug fixes allow GLM to be run from any time of day to any time of day. I've added a list explaining the changes we made below, as well as some testing results that appear to show the correctness of these changes.

Changes

Commit 1049231

Commit 36999f9

Commit 7811929

Commit 06ead88

Commit 13935ac

Commit 142522b

Testing

I ran several tests comparing results from my modified code and the unmodified code; here are just three tests (with non_avg = .true.) demonstrating that this appears to be correct. For each, I've included a graph of shortwave radiation (I_0), which is read directly from an input file, and a graph of surface temperature, which is derived from calculations. Green represents results from my modified GLM code, and red is results from the original unmodified GLM code. Although these tests are with AED off, Professor Thomas has also tested the modifications with AED on and confirmed that it seems to work.

Test 1: 1 day, 12am to 12am on both unmodified and modified code. Results match up perfectly, as expected. i_0_1 surface_temp_1

Test 2: 15 days, 12am to 12am on unmodified code, 12pm to 12pm on modified code. I_0 matches up, as expected, while surface temp starts off relatively different (as the unmodified code has had an extra 12 hours to run) but converges after both models have had some time to run. i_0_2 surface_temp_2

Test 3: 1 day, 12am to 12am on unmodified code, 12pm to 12pm on modified code. This is identical to the beginning of Test 2, but it shows clearly that I_0 matches up, even with the time difference. i_0_3 surface_temp_3

We conclude that the changes I made seem to lead to correct results. I'm happy to answer questions or make any corrections.

rqthomas commented 5 years ago

The changes in this pull request are now in commit 8ecfcb6 in the GLM repo. Thanks @oatnewguo @casper-boon for getting this fixed!