Skip to content

Commit

Permalink
edit the code to update x_b_fld_dt in every iteration in brie from in…
Browse files Browse the repository at this point in the history
…let module
  • Loading branch information
roya sahraei committed Jul 29, 2024
1 parent d0b188e commit 73215f8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions brie/brie.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ def update(self):
self._inlets.shoreline_x = self._x_s
self._inlets.bay_shoreline_x = self._x_b
self._inlets.update(self._h_b, self._z)
self._x_b_fld_dt = self._inlets._x_b_fld_dt #get the updated values from inlet module
self._Qinlet = self._inlets._Qinlet


Expand Down
4 changes: 2 additions & 2 deletions brie/inlet_spinner.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ def inlet_morphodynamics(

# reset arrays
new_inlet = np.array([])
return inlet_idx, migr_up, delta, beta, alpha, Qs_in, inlet_age, Qinlet, inlet_y
return inlet_idx, migr_up, delta, beta, alpha, Qs_in, inlet_age, Qinlet, inlet_y, x_b_fld_dt #added x_b_fld_dt to the return values of the funtion to update the variable in brie


def inlet_statistics(
Expand Down Expand Up @@ -1048,7 +1048,7 @@ def update(self, h_b, z): #updated value of h_b, and z were only updated in brie
self._man_n, self._d_b, self._marsh_cover, self._basin_width
) # do "fluid mechanics" of inlets
# in paper they do sediment transport next, but I think it is okay to do it whenever
self._inlet_idx, migr_up, delta, beta, alpha, self._Qs_in, self._inlet_age, self._Qinlet, self._inlet_y = \
self._inlet_idx, migr_up, delta, beta, alpha, self._Qs_in, self._inlet_age, self._Qinlet, self._inlet_y, self._x_b_fld_dt = \
inlet_morphodynamics(
self._inlet_idx, self._new_inlet, self._time_index, wi_cell, self._ny, self._dy, self._x_b_fld_dt, w, # use time_index instead of time
self._q_s, self._h_b, di_eq, self._d_b, self._Qinlet, self._rho_w, ai_eq, wi_eq, self._wave_height,
Expand Down
5 changes: 0 additions & 5 deletions tests/test_brie_matlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def run_brie(n_steps, dt, dy, x_shoreline, wave_angle):
)

for _ in range(n_steps - 1):
print(brie.time)
brie.update() # update the model by a time step

# finalize by deleting variables and make Qinlet m^3/yr
Expand Down Expand Up @@ -90,7 +89,6 @@ def test_brie_matlab(test_case, n_steps):
assert actual_inlet_mean == pytest.approx(expected_inlet_mean, rel=0.1)

if __name__ == "__main__":
print("This is running")
test_case = ALL_CASES[5]
n_steps = 128
brie = run_brie(
Expand All @@ -100,9 +98,6 @@ def test_brie_matlab(test_case, n_steps):
test_case["x_shoreline"],
test_case["wave_angle"],
)
print("###")
print(test_case["dt"])
print("###")
actual_q_overwash_mean = brie._Qoverwash.mean()
actual_inlet_mean = brie._Qinlet.mean()

Expand Down

0 comments on commit 73215f8

Please sign in to comment.