def setup_inlets(domain, project): """ Add inlets to domain """ inlet_data = project.inlet_data for i in range(len(inlet_data)): name = inlet_data[i][0] line_file = inlet_data[i][1] timeseries_file = inlet_data[i][2] start_time = inlet_data[i][3] # Add inlet timeseries = numpy.genfromtxt(timeseries_file, delimiter=',', skip_header=1) # Adjust start time timeseries[:, 0] = timeseries[:, 0] - start_time # Make discharge function qfun = scipy.interpolate.interp1d(timeseries[:, 0], timeseries[:, 1], kind='linear') # Make cross-section line line = su.read_polygon(line_file) anuga.Inlet_operator(domain, line, qfun, label='Inlet: ' + str(name)) return
center=(craterlength/2.0,craterwidth/2.0) radius=(0.1) region0 = anuga.Region(domain, center=center, radius=radius) outletregion0=anuga.Region(domain, polygon=outletregion) lakeregion0=anuga.Region(domain, polygon=lakeregion) nextregion0=anuga.Region(domain, polygon=nextregion) endregion0=anuga.Region(domain, polygon=endregion) #operatezero = suspension_erosion_operator(domain, outletregion,grainD=grainD, gravity=anuga.g) #NO SUSPENSION IN THESE EXPERIMENTS operateone = bedloadtransport_operator(domain) #operatetwo = friction_operator(domain) #FRICTION IS CONSTANT operatethree = AoR_operator(domain) #no grainsize or gravity dependence for the angle of repose change #operatefour = stagelimiter_operator(domain,polygon=endregion) #probably a bad idea #pumprate=1L/min = 0.001m^3/min = 1.667e-5 m3/s fixed_inflow = anuga.Inlet_operator(domain, region0 , Q=50.0*0.00001667) #Add water to domain in lake count=0 ystep=1.0 ftime=80.0 for t in domain.evolve(yieldstep=ystep, finaltime=ftime): print domain.timestepping_statistics() volume = (domain.quantities['stage'].get_integral()-domain.quantities['elevation'].get_integral()) volume2 = domain.quantities['stage'].get_integral(region=lakeregion0)-domain.quantities['elevation'].get_integral(region=lakeregion0) volume3 = domain.quantities['stage'].get_integral(region=nextregion0)-domain.quantities['elevation'].get_integral(region=nextregion0) volume4 = domain.quantities['stage'].get_integral(region=endregion0)-domain.quantities['elevation'].get_integral(region=endregion0) print str(t)+","+str(volume)+","+str(volume2)+","+str(volume3)+","+str(volume4) if t==21: fixed_inflow.set_Q(1.0*0.00001667)
#Set quantities for domain, set dry bed domain.set_quantity('elevation', filename='11_fbe_c.pts') domain.set_quantity('friction', 0.040) domain.set_quantity('stage', expression='elevation') #Define and set boundaries Br = anuga.Reflective_boundary(domain) # Solid reflective wall Bt = anuga.Transmissive_boundary(domain) # Continue all values on boundary domain.set_boundary({'exterior': Bt}) # Setup inlet flow center = (538416.0, 4190718.0) radius = 10.0 region0 = anuga.Region(domain, center=center, radius=radius) fixed_inflow = anuga.Inlet_operator(domain, region0, Q=20) else: domain = None #------------------------------------------------------------------------------ # Now produce parallel domain #------------------------------------------------------------------------------ domain = distribute(domain) domain.set_store_vertices_uniquely(False) for t in domain.evolve(yieldstep=500, finaltime=20000): if myid == 0: print domain.timestepping_statistics() domain.sww_merge(delete_old=True)
#===================================================== # Parallel Domain #===================================================== domain = distribute(domain) #--------------------------------------------------------------------- # Define inlet operator #--------------------------------------------------------------------- flow_in_yval = 5.0 line1 = [ [floodplain_width/2. - chan_width/2., flow_in_yval],\ [floodplain_width/2. + chan_width/2., flow_in_yval] ] Qin = 0.5*(floodplain_slope*(chan_width*chan_initial_depth)**2.*man_n**(-2.)\ *chan_initial_depth**(4./3.) )**0.5 anuga.Inlet_operator(domain, line1, Qin) if myid == 0 and verbose: print 'Discharge in = ', Qin #--------------------------------------------------------------------- # Setup boundary conditions #--------------------------------------------------------------------- Br = anuga.Reflective_boundary(domain) # Solid reflective wall def outflow_stage_boundary(t): return -floodplain_length*floodplain_slope \ + chan_initial_depth - chan_bankfull_depth