H_max.append(5) diam.append(1.0) S_max.append(200000) L_spill.append(2.0) L_crest.append(5.0) elif dam in order_4: H_spill.append(4.5) H_max.append(5.0) diam.append(1.0) S_max.append(300000) L_spill.append(4.0) L_crest.append(10.0) # No dam scenario print('Running nodam case..') SSN1 = Watershed(Model=254) SSN1.init_custom(links=l_id, connectivity=connectivity, A_i=A_i, L_i=L_i, A_h=A_h) q, s_p, s_t, s_s = Set_InitialConditions(0.5, A_i[0], A_i) SSN1.initialize(q=q, s_p=s_p, s_t=s_t, s_s=s_s) dc_nodam = SSN1.Run_254( [0, te], forcing, rtol=1e-6, ) #Passive Scenario print('Running passive case..')
## INITIAL CONDITIONS with open('/Users/gurbuz/DamStudy/data/initial_conditions.pickle', 'rb') as ini_file: initial_conditions = pickle.load(ini_file) ## DESIGN STORMs dstorms = [67, 112, 163, 189] rate10 = [ 12, 30, 63, 75, 84, 87, 90, 93.5, 95, 96.01, 97.44, 97.44, 99.42, 99.42, 99.67, 100 ] print(f'Simulations started at {datetime.datetime.now().time()}') ## SCENARIO-4 ############################################################################# SSN5 = Watershed(Model=256) SSN5.init_custom(links=l_id, connectivity=connectivity, A_i=A_i, L_i=L_i, A_h=A_h) SSN5.dam_ids = dams4 H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest = PrepareDamParams( dams4) diam = [1.25 for _ in range(len(dams2))] + diam[4:] dam_params256 = SSN5.init_dam_params256(H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest) dc_passive_Peak_S4 = pd.DataFrame(columns=SSN5.__columns__()[0]) out_passive_Peak_S4 = pd.DataFrame(columns=SSN5.__columns__()[1])
#DAMS in scenario-5 dams5 = [ 27, 189, 216, 135, 108, ] + [ 9, 36, 45, 63, 90, 117, 126, 144, 153, 171, 198, 207, 225, 234 ] ## dams on order_3 and order_4 Note: dams on the links closer to the outlet included (SCENARIO-5) n_dams5 = len(dams5) ################################################################################################### start = time.time() print('Running No Dam..') SSN = Watershed(Model=256) SSN.init_custom(links=l_id, connectivity=connectivity, A_i=A_i, L_i=L_i, A_h=A_h) H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest = PrepareDamParams( dams5 ) #!! TODO: make the code run without this parameters when no dam introduced dam_params256 = SSN.init_dam_params256(H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest) # !! q = initial_condition['q'] s_p = initial_condition['s_p'] s_t = initial_condition['s_t'] s_s = initial_condition['s_s'] SSN.initialize(q=q, s_p=s_p, s_t=s_t, s_s=s_s)
# try: # dc_nodam, _ = SSN1.Run_256( [0, te], forcing, dam_params256,) # temp = dc_nodam[dc_nodam.index>120].max() # dc_nodam_Peak = dc_nodam_Peak.append(temp,ignore_index = True) # except IndexError: # pass # print(f'(NODAM)Storm:{dstorm} is simulated with given initial conditions!') # dc_nodam_Peak.to_csv('/Users/gurbuz/Supp_DamStudy/Dam_Configuration/dc_nodam_Peak_rand08.csv') # print('No dam scenario is done and results are saved!\n') # print(f'Time: {datetime.datetime.now().time()}') ## SCENARIO-1 ############################################################################# SSN2 = Watershed(Model=256) SSN2.init_custom(links=l_id, connectivity=connectivity, A_i=A_i, L_i=L_i, A_h=A_h) SSN2.dam_ids = dams1 H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest = PrepareDamParams( dams1) dam_params256 = SSN2.init_dam_params256(H_spill, H_max, S_max, _alpha, diam, c1, c2, L_spill, L_crest) dc_passive_Peak_S1 = pd.DataFrame(columns=SSN2.__columns__()[0]) out_passive_Peak_S1 = pd.DataFrame(columns=SSN2.__columns__()[1]) for dstorm in dstorms: