Skip to content

Start indices #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pyDeltaRCM/init_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ def set_constants(self) -> None:

# kernels for topographic smoothing
self.kernel1 = np.array([[1, 1, 1], [1, -8, 1], [1, 1, 1]]).astype(np.int64)

self.kernel2 = np.array([[1, 1, 1], [1, 0, 1], [1, 1, 1]]).astype(np.int64)

def create_boundary_conditions(self) -> None:
Expand Down Expand Up @@ -434,7 +433,7 @@ def create_boundary_conditions(self) -> None:

# at inlet
self.qw0 = self.u0 * self.h0 # water unit input discharge
self.Qp_water = self.Qw0 / self._Np_water # volume each water parcel
self.Qp_water = self.Qw0 / self._Np_water # discharge each water parcel
self.qs0 = self.qw0 * self.C0 # sed unit discharge
self.dVs = 0.1 * self.N0**2 * self.V0 # total sed added per timestep
self.Qs0 = self.Qw0 * self.C0 # sediment total input discharge
Expand Down
16 changes: 10 additions & 6 deletions pyDeltaRCM/water_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
self.pad_depth = np.pad(self.depth, 1, "edge")
self.pad_cell_type = np.pad(self.cell_type, 1, "edge")

# configure the starting indices for each parcel
inlet_weights = self.get_inlet_weights_water()
self.start_indices = shared_tools.get_start_indices(
self.inlet, inlet_weights, self._Np_water
)

def get_inlet_weights_water(self, **kwargs):
"""Get weight for inlet cells for water parcels.

Expand Down Expand Up @@ -91,11 +97,8 @@
_msg = "Beginning stepping of water parcels"
self.log_info(_msg, verbosity=2)

# configure the starting indices for each parcel
inlet_weights = self.get_inlet_weights_water()
start_indices = shared_tools.get_start_indices(
self.inlet, inlet_weights, self._Np_water
)
# grab from initialization step
start_indices = self.start_indices

Check warning on line 101 in pyDeltaRCM/water_tools.py

View check run for this annotation

Codecov / codecov/patch

pyDeltaRCM/water_tools.py#L101

Added line #L101 was not covered by tests

# init parcel step number counter
_step = 0
Expand Down Expand Up @@ -691,7 +694,8 @@
weight[~wall] = 1 / nnotwall
else:
raise RuntimeError(
"No non-wall cells surrounding cell. " "Please report error."
"No non-wall cells surrounding cell."
"Please report error including logfile."
)

weight = weight / np.sum(weight)
Expand Down