Skip to content

Commit

Permalink
Bug fix! Swapped parcel_vol and parcel_D in D50 calculation in W&C
Browse files Browse the repository at this point in the history
how did I not find that earlier?
  • Loading branch information
pfeiffea committed Feb 7, 2025
1 parent 62aa786 commit b6b6f56
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def _calculate_mean_D_and_rho(self) -> None:
parcel_vol = self._parcels.dataset.volume.values[mask_here & mask_active,-1]
parcel_D = self._parcels.dataset.D.values[mask_here & mask_active,-1]

self._d50_active[link] = calculate_x_percentile_grain_size(parcel_vol,parcel_D,50)
self._d50_active[link] = calculate_x_percentile_grain_size(parcel_D,parcel_vol,50)

if np.any(np.asarray(self._d50_active < 0)):

Expand Down Expand Up @@ -912,6 +912,8 @@ def _calc_transport_wilcock_crowe_d50(self) -> None:

b = 0.67 / (1.0 + np.exp(1.5 - Darray / D50_activearray))

#b = 0 # sensitivity analysis 11/3/24 AP for CSDMS talk

tau = self._fluid_density * self._g * Harray * Sarray
tau = np.atleast_1d(tau)

Expand Down Expand Up @@ -1095,7 +1097,7 @@ def _move_parcel_downstream(self, dt: float) -> None:
# arrival time in link
self._parcels.dataset.time_arrival_in_link[
active_parcel_ids, self._time_idx
] = self._time_idx
] = self._time_idx # XX should edit to add rng uniform here..

# location in link
self._parcels.dataset.location_in_link[active_parcel_ids, self._time_idx] = (
Expand Down Expand Up @@ -1143,7 +1145,7 @@ def run_one_step(self, dt: float) -> None:
if self._this_timesteps_parcels.any():
self._partition_active_and_storage_layers()
self._adjust_node_elevation()
self._update_channel_slopes()
self._update_channel_slopes()
self._update_transport_time()
self._move_parcel_downstream(dt)

Expand Down

0 comments on commit b6b6f56

Please sign in to comment.