Skip to content

Commit

Permalink
Add stage--depth offset for Q-->h.
Browse files Browse the repository at this point in the history
  • Loading branch information
awickert committed Sep 13, 2023
1 parent 4d1a7d8 commit b12f30c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ottar/ottar.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ def dynamic_time_step(self, max_fract_to_equilib=0.1):
# Currently part of a big, messy "update" step
pass

def initialize_flow_calculations(self, channel_n, fp_k, fp_P, use_Rh ):
def initialize_flow_calculations(self, channel_n, fp_k, fp_P,
stage_offset, use_Rh ):
"""
Hard-code for double Manning
"""
self.channel_n = channel_n
self.hclass = FlowDepthDoubleManning(use_Rh)
self.hclass.initialize( channel_n, fp_k, fp_P,
self.hclass.initialize( channel_n, fp_k, fp_P, stage_offset,
self.h_banks, self.b[-1], self.S)


Expand Down Expand Up @@ -796,6 +797,9 @@ def set_k(self, _var):

def set_P(self, _var):
self.P = _var

def set_stage_offset(self, _var):
self.stage_offset = _var

def set_h_bank(self, _var):
self.h_bank = _var
Expand All @@ -809,7 +813,9 @@ def set_S(self, _var):
def set_Q(self, _var):
self.Q = _var

def flow_depth_from_Manning_discharge( self, h ):
def flow_depth_from_Manning_discharge( self, stage ):
# flow depth
h = stage - self.stage_offset
# Does the flow go overbank?
ob = h > self.h_bank
if self.use_Rh:
Expand All @@ -827,10 +833,11 @@ def compute_depth(self, Q=None):
else:
return fsolve( self.flow_depth_from_Manning_discharge, 1. )[0]

def initialize(self, n, k, P, h_bank, b, S):
def initialize(self, n, k, P, stage_offset, h_bank, b, S):
self.set_n(n)
self.set_k(k)
self.set_P(P)
self.set_stage_offset(stage_offset)
self.set_h_bank(h_bank)
self.set_b(b)
self.set_S(S)
Expand Down

0 comments on commit b12f30c

Please sign in to comment.