subroutine reservoir_deallocate_reservoir
! should be called by main program at the end of the simulation
integer :: res
! close reservoir output files
do res = 1, rsv_nReservoirs
close(rsv_funit(res))
end do
deallocate(bRsvHydrograph)
deallocate(rsvSubbasin)
deallocate(rsv_funit)
deallocate(rsv_dead_stor_act)
deallocate(rsv_Inflow)
deallocate(rsv_frac_sr)
deallocate(rsv_B)
deallocate(Rsv)
deallocate(rsv_seepage)
deallocate(rsv_Outflow)
deallocate(rsv_gwq)
deallocate(rsv_Day_Cap_Act)
deallocate(rsv_Day_Fill_Min)
deallocate(rsv_Day_ann_cycle)
deallocate(rsv_Day_Disch_Min)
deallocate(rsv_act_withdrawal)
deallocate(rsv_water_level)
deallocate(rsv_height_hpp)
deallocate(rsv_Prod_HPP)
deallocate(rsv_tot_area)
deallocate(rsv_ResSubbasins)
deallocate(rsv_ResNames)
deallocate(rsv_Capac_Max)
deallocate(rsv_dead_stor_capac)
deallocate(rsv_Start_Fill)
deallocate(rsv_active)
deallocate(rsv_activate_thresh)
deallocate(rsv_level_max)
deallocate(rsv_level_min)
deallocate(rsv_level_hpp)
deallocate(rsv_cap_hpp)
deallocate(rsv_eff_hpp)
deallocate(rsv_loss_seepage)
deallocate(rsv_gwc)
deallocate(rsv_evapc)
deallocate(rsv_start_year)
deallocate(rsv_start_day)
deallocate(rsv_Mngmt)
deallocate(rsv_shr_withdr)
deallocate(rsv_Cap_Act)
deallocate(rsv_Fill_Min)
deallocate(rsv_Dis_Min_Fill)
deallocate(rsv_Dis_Min_Act)
deallocate(rsv_Withdr_Mon)
deallocate(rsv_ann_cycle)
deallocate(rsv_Disch_Min)
deallocate(rsv_pol_L)
deallocate(rsv_pol_L2)
deallocate(rsv_pol_A)
deallocate(rsv_pol_V)
deallocate(rsv_pol_HP)
! previous day arrays
deallocate(pd_outflow)
deallocate(pd_seepage)
deallocate(pd_area_wet)
deallocate(pd_et)
deallocate(pd_gwq)
deallocate(pd_gwseep)
deallocate(pd_gwchrg)
deallocate(pd_wysb)
end subroutine reservoir_deallocate_reservoir