def __init__(self, grid, channel_mask="channel__mask"): """ Parameters ---------- grid : ModelGrid Landlab ModelGrid object channel_mask : field name, array of uint8 Logical map of nodes where drainage is present """ super().__init__(grid) if grid.at_node["flow__receiver_node"].size != grid.size("node"): msg = ( "A route-to-multiple flow director has been " "run on this grid. The landlab development team has not " "verified that HeightAboveDrainageCalculator is compatible with " "route-to-multiple methods. Please open a GitHub Issue " "to start this process.") raise NotImplementedError(msg) self._grid = grid self._channel_mask = return_array_at_node(self._grid, channel_mask) self._elev = grid.at_node["topographic__elevation"] self._receivers = grid.at_node["flow__receiver_node"] self._node_order = grid.at_node["flow__upstream_node_order"] # height above nearest drainage if "height_above_drainage__elevation" in grid.at_node: self._hand = grid.at_node["height_above_drainage__elevation"] else: self._hand = grid.add_zeros("height_above_drainage__elevation", at="node", dtype=float)
def __init__(self, grid, hydraulic_conductivity=0.005): self._grid = grid # Create fields: if "topographic__elevation" in self._grid.at_node: self.elev = self._grid.at_node["topographic__elevation"] else: self.elev = self._grid.add_ones("node", "topographic__elevation") if "aquifer_base__elevation" in self._grid.at_node: self.base = self._grid.at_node["aquifer_base__elevation"] else: self.base = self._grid.add_zeros("node", "aquifer_base__elevation") if "effective_saturated__thickness" in self._grid.at_node: self.Hs = self._grid.at_node["effective_saturated__thickness"] else: self.Hs = self._grid.add_zeros("node", "effective_saturated__thickness") if "linear_reservoir_constant" in self._grid.at_node: self.K = self._grid.at_node["linear_reservoir_constant"] else: self.K = self._grid.add_zeros("node", "linear_reservoir_constant") if "groundwater__discharge" in self._grid.at_node: self.Qgw = self._grid.at_node["groundwater__discharge"] else: self.Qgw = self._grid.add_zeros("node", "groundwater__discharge") if "surface_water__discharge" in self._grid.at_node: self.Qsw = self._grid.at_node["surface_water__discharge"] else: self.Qsw = self._grid.add_zeros("node", "surface_water__discharge") self.Ksat = return_array_at_node(grid, hydraulic_conductivity) self.H = self.elev - self.base self.S = grid.calc_grad_at_link(self.elev) self.S_node = map_max_of_node_links_to_node(grid, self.S) # subsurface transport capacity self.Qgw_total_capacity = self.Ksat * self.H * self.S_node * grid.dx
def n(self, new_val): """set aquifer drainable porosity (-)""" self._n = return_array_at_node(self._grid, new_val) self._n_link = map_mean_of_link_nodes_to_link(self._grid, self._n)
def recharge(self, new_val): """set recharge rate (m/s)""" self._recharge = return_array_at_node(self._grid, new_val)
def __init__( self, grid, hydraulic_conductivity=0.001, porosity=0.2, recharge_rate=1.0e-8, regularization_f=1e-2, ): """Initialize the GroundwaterDupuitPercolator. Parameters ---------- grid: ModelGrid Landlab ModelGrid object hydraulic_conductivity: float, field name, or array of float saturated hydraulic conductivity, m/s Default = 0.001 m/s porosity: float, field name or array of float the porosity of the aquifer [-] Default = 0.2 recharge_rate: float, field name, or array of float Rate of recharge, m/s Default = 1.0e-8 m/s regularization_f: float factor controlling the smoothness of the transition between surface and subsurface flow """ # Store grid self._grid = grid # Shorthand self._cores = grid.core_nodes # Create fields: if "topographic__elevation" in self.grid.at_node: self._elev = self.grid.at_node["topographic__elevation"] else: self._elev = self.grid.add_ones("node", "topographic__elevation") if "aquifer_base__elevation" in self.grid.at_node: self._base = self.grid.at_node["aquifer_base__elevation"] else: self._base = self.grid.add_zeros("node", "aquifer_base__elevation") if "water_table__elevation" in self.grid.at_node: self._wtable = self.grid.at_node["water_table__elevation"] else: self._wtable = self.grid.add_zeros("node", "water_table__elevation") self._wtable[grid.closed_boundary_nodes] = 0 if "aquifer__thickness" in self.grid.at_node: self._thickness = self.grid.at_node["aquifer__thickness"] else: self._thickness = self.grid.add_zeros("node", "aquifer__thickness") self._thickness[:] = self._wtable - self._base self._thickness[grid.closed_boundary_nodes] = 0 if "hydraulic__gradient" in self.grid.at_link: self._hydr_grad = self.grid.at_link["hydraulic__gradient"] else: self._hydr_grad = self.grid.add_zeros("link", "hydraulic__gradient") if "aquifer_base__gradient" in self.grid.at_link: self._base_grad = self.grid.at_link["aquifer_base__gradient"] else: self._base_grad = self.grid.add_zeros("link", "aquifer_base__gradient") if "groundwater__specific_discharge" in self.grid.at_link: self._q = self.grid.at_link["groundwater__specific_discharge"] else: self._q = self.grid.add_zeros("link", "groundwater__specific_discharge") if "groundwater__velocity" in self.grid.at_link: self._vel = self.grid.at_link["groundwater__velocity"] else: self._vel = self.grid.add_zeros("link", "groundwater__velocity") if "surface_water__specific_discharge" in self.grid.at_node: self._qs = self.grid.at_node["surface_water__specific_discharge"] else: self._qs = self.grid.add_zeros( "node", "surface_water__specific_discharge") if "water_table__velocity" in self.grid.at_node: self._dhdt = self.grid.at_node["water_table__velocity"] else: self._dhdt = self.grid.add_zeros("node", "water_table__velocity") # Convert parameters to fields if needed, and store a reference self._K = return_array_at_link(grid, hydraulic_conductivity) self._recharge = return_array_at_node(grid, recharge_rate) self._n = return_array_at_node(grid, porosity) self._n_link = map_mean_of_link_nodes_to_link(self._grid, self._n) self._r = regularization_f self._S = abs(grid.calc_grad_at_link(self._elev)) self._S_node = map_max_of_node_links_to_node(grid, self._S)
def __init__(self, grid, hydraulic_conductivity=0.01, recharge_rate=1.0e-8): """Initialize the GroundwaterDupuitPercolator. Parameters ---------- grid: ModelGrid Landlab ModelGrid object hydraulic_conductivity: float, field name (link), or array of float saturated hydraulic conductivity, m/s Default = 0.01 m/s recharge_rate: float, field name (node), or array of float Rate of recharge, m/s Default = 1.0e-8 m/s """ # Store grid self._grid = grid # Shorthand self._cores = grid.core_nodes self._inactive_links = np.where(grid.status_at_link != ACTIVE_LINK)[0] # Convert parameters to fields if needed, and store a reference self._K = return_array_at_link(grid, hydraulic_conductivity) self._recharge = return_array_at_node(grid, recharge_rate) # Create fields: if "topographic__elevation" in self._grid.at_node: self._elev = self._grid.at_node["topographic__elevation"] else: self._elev = self._grid.add_ones("node", "topographic__elevation") if "aquifer_base__elevation" in self._grid.at_node: self._base = self._grid.at_node["aquifer_base__elevation"] else: self._base = self._grid.add_zeros("node", "aquifer_base__elevation") if "water_table__elevation" in self._grid.at_node: self._wtable = self._grid.at_node["water_table__elevation"] else: self._wtable = self._grid.add_zeros("node", "water_table__elevation") if "aquifer__thickness" in self._grid.at_node: self._thickness = self._grid.at_node["aquifer__thickness"] else: self._thickness = self._grid.add_zeros("node", "aquifer__thickness") self._thickness[:] = self._wtable - self._base if "hydraulic__gradient" in self._grid.at_link: self._hydr_grad = self._grid.at_link["hydraulic__gradient"] else: self._hydr_grad = self._grid.add_zeros("link", "hydraulic__gradient") if "groundwater__specific_discharge" in self._grid.at_link: self._q = self._grid.at_link["groundwater__specific_discharge"] else: self._q = self._grid.add_zeros("link", "groundwater__specific_discharge") if "groundwater__velocity" in self._grid.at_link: self._vel = self._grid.at_link["groundwater__velocity"] else: self._vel = self._grid.add_zeros("link", "groundwater__velocity")
def __init__( self, grid, hydraulic_conductivity=0.001, porosity=0.2, recharge_rate=1.0e-8, regularization_f=1e-2, courant_coefficient=0.01, ): """ Parameters ---------- grid: ModelGrid Landlab ModelGrid object hydraulic_conductivity: float, field name, or array of float saturated hydraulic conductivity, m/s Default = 0.001 m/s porosity: float, field name or array of float the porosity of the aquifer [-] Default = 0.2 recharge_rate: float, field name, or array of float Rate of recharge, m/s Default = 1.0e-8 m/s regularization_f: float factor controlling the smoothness of the transition between surface and subsurface flow courant_coefficient: float (-) The muliplying factor on the condition that the timestep is smaller than the minimum link length over groundwater flow velocity. This parameter is only used with ``run_with_adaptive_time_step_solver`` and must be greater than zero. """ super(GroundwaterDupuitPercolator, self).__init__(grid) # Shorthand self._cores = grid.core_nodes # Create fields: self._elev = self._grid.at_node["topographic__elevation"] self._base = self._grid.at_node["aquifer_base__elevation"] self.initialize_output_fields() self._wtable = self._grid.at_node["water_table__elevation"] self._wtable[grid.closed_boundary_nodes] = 0 self._thickness = self._grid.at_node["aquifer__thickness"] self._thickness[:] = self._wtable - self._base self._thickness[grid.closed_boundary_nodes] = 0 self._hydr_grad = self._grid.at_link["hydraulic__gradient"] self._base_grad = self._grid.at_link["aquifer_base__gradient"] self._q = self._grid.at_link["groundwater__specific_discharge"] self._qs = self._grid.at_node["surface_water__specific_discharge"] self._qsavg = self.grid.at_node[ "average_surface_water__specific_discharge"] self._vel = self._grid.at_link["groundwater__velocity"] self._dhdt = self._grid.at_node["water_table__velocity"] # Convert parameters to fields if needed, and store a reference self._K = return_array_at_link(grid, hydraulic_conductivity) self._recharge = return_array_at_node(grid, recharge_rate) self._n = return_array_at_node(grid, porosity) self._n_link = map_mean_of_link_nodes_to_link(self._grid, self._n) self._r = regularization_f # save courant_coefficient (and test) self._courant_coefficient = courant_coefficient
def channel_mask(self, new_val): self._channel_mask = return_array_at_node(self._grid, new_val)