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

Adding check for zone height that is less than water height #38

Closed rqthomas closed 2 years ago

rqthomas commented 3 years ago

If the user sets a max zone height that is less than the water height, the code segment faults here. This commit gives the user a reason for the crash.

rqthomas commented 2 years ago

@matthipsey @casper-boon I wanted to check in about this PR. I have found that if you run the model for only a single day, it doesn't get any inflow or outflow. This is because the time index advances when the subdaily routine ends and the inflow/outflow occurs after the subdaily routine. I have applied a fix to the non_avg = true case and tested. it works as expected. Daily data assimilation can not work as expected without this fix. If you approve of the fix, I can also add it to the non_avg = false case. My notes from email exchanges are below.

email 1 I have run into an issue with GLM related that you might have an answer to. I am running the GLM-AED for one day. One of the inflows is a submerged inflow that adds a lot of oxygen. It seems that if I start the run at mid-night (00:00) and run to the next mid-night, the large amount of oxygen is not in the output (but the output is generated with the oxygen amount you would expect without the inflow). However, if I start the run at 1 am or any other non-midnight time, it does have the large amount of oxygen. Additionally, if I run a simulation that starts at 00:00 and runs for two days, the large amount of oxygen shows up in the second day. The key differences may be that a non-midnight time means that the simulation does over two different dates. Maybe there is something associated with only having one date from the inflow file? Based on adding print states to the code, I can confirm that it does have the correct value for Inflows[2].FlowRate and Inflows[2].WQInf[0] (which is the oxygen). I am using the non_avg = true.

email 2 think I figured out the issue

email 3 I had to add an if statement so that it does not do inflows on the last day if the last day isn’t a full day - this was necessary to reproduce the prior behavior. The changes allows inflows to be included in the output if one only runs over a single calendar day.