Skip to content

Commit

Permalink
Easier unpacking from _wanted_rates
Browse files Browse the repository at this point in the history
  • Loading branch information
patnr committed Oct 23, 2023
1 parent f6bac81 commit f5c2b79
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions TPFA_ResSim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ def _set_Q(self, S, k):

def _wanted_rates_at(self, k):
"""Lookup nominal/specified rates. Allows constant-in-time (singleton) spec."""
return dict(inj=get_now(self.inj_rates.T),
prod=get_now(self.prod_rates.T))
get_now = lambda arr: np.copy(arr[k] if (len(arr) > 1) else arr[0])
return (get_now(self.inj_rates.T),
get_now(self.prod_rates.T))

def dynamic_rate(self, S, k):
"""Compute the `actual_rates` for time index `k`.
Expand All @@ -140,7 +140,8 @@ def dynamic_rate(self, S, k):
But you can overwrite (patch/inherit) it, for example to halt production wells
if water saturation is too high or simply if the suggested rate is near 0.
"""
return self._wanted_rates_at(k)
inj, prod = self._wanted_rates_at(k)
return dict(inj=inj, prod=prod)

# Pres() -- listing 5
def pressure_step(self, S):
Expand Down

0 comments on commit f5c2b79

Please sign in to comment.