RHESSys/RHESSys — pull request #29 by xiaoli-chen (2014-03-12 22:13:07+00:00)
Title: Newstrata

This branch has been merged with the hourly version of RHESSys. Here I have a little summery about what has been updated for the hourly version of RHESSys:
1. move the compute_subsurface_routing.c from basin_daily_F.c to basin_hourly.c

2. use patch[0].rain_throughfall_24hours to record the 24 hours rain_throughfall aggregation, like the variable zone[0].rain_hourly_total.

3. create output_24hours_basin.c to print the daily output of hourly simulation, with rain_throughfall_24hours for daily rain_throughfall aggregation

4. add zone[0].rain_hourly_total to zone_daily_F.c line 344&374 for the if statement, which determine the calculation of cloud fraction and daytime_rain_duration.

5. add hourly rain duration counter in zone_hourly.c line 191 to account the daytime_rain_duration

6. add function update_gw_drainage to patch_hourly.c before infiltration

7. add function update_soil_moisture to patch_hourly.c after infiltration

8. issues about patch[0].recharge. In previous version, this value is given by the infiltration (patch[0].recharge = infiltration)in patch_daily_F.c once a day. In the hourly version, however, we need to initialize this recharge to 0 in patch_daily_I.c, then accumulate the daily recharge by using patch[0].recharge += infiltration;

9. add new if statement in patch_daily_F.c, if there is hourly rainfall, don't run infiltration

10. initialize patch[0].rz_drainage and patch[0].unsat_drainage in patch_daily_I.c, use temporal variable rz_drainage and unsat_drainage to save the value from function compute_unsat_zone_drainage(), then add these values to patch[0].rz_drainage and patch[0].unsat_drainage

11. create compute_hourly_litter_rain_stored.c to calculate the litter interception in surface_daily_F.c

12. create surface_hourly.c to insert in patch_hourly.c. It is the hourly version of surface_daily_F.c, but it only keep the litter interception calculation function.

13. update codes in construct_dated_clim_sequence.c so it could read hourly input correctly. (change '%d%d%d%d%f' to %ld %ld %ld %ld %f')

14. update the throughfall in output_24hours_basin.c in line 131 to include both hourly_total and daily throughfall.

15. update statement in zone_hourly.c (clim_event.edate.hour/24.0) to read hourly rainfall input. Otherwise it just read the first hour of that day.

16. change code in patch_hourly.c, let the throughfall accumulate in patch[0].detention_store, and use the detention_store for update_gw_drainage, then do the infiltration. it fix the gw issue.

17. bring the calculation of field_capacity from patch_daily_F.c to patch_hourly.c.

18. solve the issue of hourly RHESSys in snow area. copy the codes which divide rain into snow and rain from zone_daily_F.c to zone_hourly.c line 106 to line 164. add element (zone[0].hourly[0].snow) to the class of zone[0].hourly[0]. Add another element (zone[0].snow_hourly_total) to the class of zone, to accumulate the daily summation of hourly snow in zone_hourly.c. this variable will be initialized to 0 in zone_daily_I.c, and then collect the hourly snow in zone_hourly.c, then give these values to the zone[0].snow in the zone_daily_F.c routing.
Flow Chart of Daily RHESSys
![rhessys daily](https://f.cloud.github.com/assets/5122970/2403815/4af3467c-aa33-11e3-9404-d16c78687f89.png)

Flow Chart of Hourly RHESSys
![rhessys hourly](https://f.cloud.github.com/assets/5122970/2403818/54a1c96e-aa33-11e3-9539-da7f9a126f03.png)