def init_substances(self): subs=super(AgeTracers,self).init_substances() # source tracer: subs['moke']=dwaq.Substance(initial=0.0) # DWAQ age tracer (exponential decay approach) subs['cTr1']=dwaq.Substance(initial=0.0) subs['dTr1']=dwaq.Substance(initial=0.0) # And integrating age subs['NO3']=dwaq.Substance(0) subs['ZNit']=dwaq.Substance(0) return subs
def setup_tracer_continuity(self): # continuity tracer: self.wm.substances['continuity'] = dwaq.Substance(initial=1.0) # This adds a concentration=1.0 boundary condition on all the boundaries. all_bcs = [ b.decode() for b in np.unique(self.hydro.boundary_defs()['type']) ] self.wm.add_bc(all_bcs, 'continuity', 1.0)
def setup_tracers(self): # boundary condition will default to 0.0 for i, x0 in enumerate(self.X0): ctr = "cTr%d" % (1 + i) dtr = "dTr%d" % (1 + i) proc = "ACTIVE_Age%d" % (1 + i) self.wm.parameters['RcDecTR%d' % (1 + i)] = self.decay_rate self.wm.substances[ctr] = dwaq.Substance(initial=0.0) self.wm.substances[dtr] = dwaq.Substance(initial=0.0) elt = self.hydro.grid().select_cells_nearest(x0) discharge = self.wm.add_discharge(element=elt, k=0) self.wm.add_load([discharge], [ctr, dtr], 100.0) # Somehow, DWAQ is coming up with dTr1 values greater than cTr1 # in some cases. Maybe related to the integration scheme. # Even though I don't use the Age output, I'm keeping the process # on as a way to make sure that decay is turned on. It should be # possible to directly turn decay on, and not calculate age. # no big difference... self.wm.parameters[proc] = 1 # I think it's actually possible to have 5, but only 3 age # tracers. And there are probably some other decaying processes # that could be co-opted if necessary. assert i < 5, "Only 5 decay tracers allowed"
# Set up the DWAQ run, pointing it to the hydro instance: wm=dwaq.WaqModel(overwrite=True, base_path='dwaq_run', hydro=base_hydro) # Model will default to running for the full period of the hydro. # Adjust start time to get a short spinup... wm.start_time += np.timedelta64(2*3600,'s') # Create the dye tracer with initial condition. # Note that C was calculated as a 2D tracer above, but here # it is used as a 3D per-segment tracer. For 2D you could get # away with that, but safer to have the Hydro instance convert # 2D (element) to 3D (segment) C_3d=base_hydro.extrude_element_to_segment(C) # boundary condition will default to 0.0 wm.substances['dye1']=dwaq.Substance(initial=C_3d) # uniform tracer: wm.substances['unity']=dwaq.Substance(initial=1.0) # and a tracer set on the boundary flows. Initial defaults to 0.0 wm.substances['boundary_dye']=dwaq.Substance() wm.add_bc(['inflow'],'boundary_dye',1.0) wm.cmd_write_hydro() wm.cmd_write_inp() wm.cmd_delwaq1() wm.cmd_delwaq2() wm.write_binary_map_nc() ## # Open the map output
def setup_tracers(self): # boundary condition will default to 0.0 C_3d = self.release_conc_3d() self.wm.substances['dye1'] = dwaq.Substance(initial=C_3d)
def init_substances(self): # allocate the substance dictionary subs = super(AgeTracers, self).init_substances() # then add tracers for this run # source tracers -- default to an initial condition of 0 # these will be associated with specific boundary locations # later subs['moke'] = dwaq.Substance() subs['sac'] = dwaq.Substance() subs['mokesj'] = dwaq.Substance() subs['lps'] = dwaq.Substance() subs['snodlambert'] = dwaq.Substance() subs['middle'] = dwaq.Substance() subs['lost'] = dwaq.Substance() subs['ic'] = dwaq.Substance(initial=1.0) # DWAQ age tracer (exponential decay approach). DWAQ # has a built-in process for this subs['cTr1'] = dwaq.Substance() subs['dTr1'] = dwaq.Substance() # And integrating age -- this requires "repurposing" some # nutrient processes # The simplest approach would use NO3 and ZNit, a zeroth order # process creating NO3. #subs['NO3']=dwaq.Substance(0) #subs['ZNit']=dwaq.Substance(0) # To allow for partial age approaches, track RcNit # and optionally specify a variable NH4. # TODO: this is currently aging at 0.7 the nominal rate. # SWVnNit defaults to 0, "pragmatic" kinetics # subs['NO3'] = dwaq.Substance(0) subs['RcNit'] = dwaq.Substance(0) # RcNit20=0.0 return subs
def init_substances(self): subs = super(BasicTag, self).init_substances() subs['moke'] = dwaq.Substance(initial=0.0) return subs