Skip to content

Commit

Permalink
Add in sandbags to CASCADE
Browse files Browse the repository at this point in the history
  • Loading branch information
franklin1895 committed Mar 25, 2024
1 parent a2e4c04 commit ea437b9
Show file tree
Hide file tree
Showing 17 changed files with 20,790 additions and 11 deletions.
7 changes: 7 additions & 0 deletions cascade/brie_coupler.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ def update_ast(self, barrier3d, x_t_dt, x_s_dt, h_b_dt):
iB3D
]


def offset_shoreline(self, enable_shoreline_offset, offset_values, ny):
if enable_shoreline_offset == True:
for i in range(ny):
self._brie.x_t[i] = self._brie.x_t[i] + offset_values[i]
self._brie.x_s[i] = self._brie.x_s[i] + offset_values[i]

def update_brie_for_human_modifications(self, x_t, x_s, x_b, h_b, s_sf):
"""Reset all the save variables and current variables for barrier geometry
to account for human modifications in the cascade modules
Expand Down
21 changes: 20 additions & 1 deletion cascade/cascade.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
from joblib import Parallel, delayed

from .beach_dune_manager import BeachDuneManager
from .beach_dune_manager import BeachDuneManager, check_sandbag_need
from .brie_coupler import BrieCoupler, batchB3D, initialize_equal
from .chom_coupler import ChomCoupler
from .roadway_manager import RoadwayManager, set_growth_parameters
Expand Down Expand Up @@ -152,6 +152,8 @@ def __init__(
house_footprint_x=15,
house_footprint_y=20,
beach_full_cross_shore=70,
sandbag_management_on = False,
sandbag_elevation = 1.5,
):
"""
CASCADE: The CoAStal Community-lAnDscape Evolution model
Expand Down Expand Up @@ -305,6 +307,9 @@ def __init__(
self._trigger_dune_knockdown = trigger_dune_knockdown
self._initial_beach_width = [0] * self._ny
self._group_roadway_abandonment = group_roadway_abandonment
self._sandbag_management_on = sandbag_management_on
self._sandbag_elevation = sandbag_elevation
self._sandbag_need = [False] * self._ny

# initialization errors
if (
Expand Down Expand Up @@ -356,6 +361,7 @@ def __init__(
storm_file=self._storm_file,
dune_file=self._dune_file, # can be array
elevation_file=self._elevation_file, # can be array
sandbag_elevation = self._sandbag_elevation,
)

###############################################################################
Expand Down Expand Up @@ -557,6 +563,7 @@ def update(self):
# updates the time_index after update_dune_domain). Set n_jobs=1 for no
# parallel processing (debugging) and -2 for all but 1 CPU; note that
# joblib uses a threshold on the size of arrays passed to the workers

batch_output = Parallel(n_jobs=self._num_cores, max_nbytes="10M")(
delayed(batchB3D)(self._barrier3d[iB3D]) for iB3D in range(self._ny)
)
Expand Down Expand Up @@ -636,6 +643,7 @@ def update(self):

else:
self._road_break[iB3D] = 1
self._sandbag_need[iB3D] = False

# set dune growth rates back to original only when dune
# elevation is less than equilibrium
Expand All @@ -650,6 +658,17 @@ def update(self):

else:
# manage that road!
if self._sandbag_management_on[iB3D] == True: # Check if sandbags are needed() returning TRUE / FALSE given distance between dunes and roadway
self._sandbag_need[iB3D] = check_sandbag_need(dune_road_distance = self._roadways[iB3D]._road_setback)

if self._sandbag_need[iB3D] == True:
self._barrier3d[iB3D]._sandbag_need = True
print('Sandbags are needed in Section '+str(iB3D))
elif self._sandbag_need[iB3D] == False:
print('Sandbags are not needed in Section '+str(iB3D))
self._barrier3d[iB3D]._sandbag_need = False


self._roadways[iB3D].road_relocation_width = self._road_width[
iB3D
] # type: float
Expand Down
4 changes: 2 additions & 2 deletions cascade/roadway_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ def get_road_relocation_elevation(

return road_ele, roadway_drown


def road_relocation_checks(
time_index,
dune_migrated,
Expand Down Expand Up @@ -403,16 +402,17 @@ def road_relocation_checks(
# initialize the break booleans as False
relocation_break = 0
road_relocated = 0

# if dune line eroded or prograded, subtract (erode) or add (prograde) to
# the setback to keep road in the same place
if dune_migrated != 0:
road_setback = road_setback + dune_migrated

# with this shoreline change and dune migration, check if the roadway needs
# to be relocated

if road_setback < 0:
road_relocated = 1
print('Roadway relocated')

# relocate the road only if the width of the island allows it
if (
Expand Down
67 changes: 67 additions & 0 deletions data/Ocracoke_init_data/Ocracoke-CASCADE-parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
BarrierLength: 500
BayDepth: 3.0
BermEl: 1.9
BurialLimit: 0.75
C1: 8.8
C2: 4.6
Cbb_i: 0.85
Cbb_r: 0.7
Cx: 10.0
DShoreface: 8.9
Dmaxel: 3.4
Dshrub: 2.75
Dstart: 0.5
DuneParamStart: true
DuneRestart: 0.075
DuneWidth: 20.0
Female: 0.5
GermRate: 0.6
GrowthParamStart: false
HdDiffu: 0.75
Ki: 7.5e-06
Kr: 7.5e-05
LShoreface: 524.236278118052
MHW: 0.46
MaxShrubHeight: 5.3
MaxUpSlope: 0.25
OWss_i: 2
OWss_r: 1
Qs_bb_min: 1
Qs_min: 1.0
Qshrub_max: 0.15
RSLR_Constant: true
RSLR_const: 0.004
Rat: -1.0
Rin_i: 0.1
Rin_r: 2.0
SalineLimit: 5
SeededRNG: true
Seedmax: 1000.0
Seedmin: 100.0
ShorefaceToe: 1099.9999999999995
ShrubEl_max: 2.3
ShrubEl_min: 1.2
Shrub_ON: 0
SprayDist: 170
StormSeries: []
StormStart: 2
TMAX: 50
TideAmp: 1.2
TimeFruit: 5.0
UprootLimit: -0.2
beta: 0.04
disp_mu: -0.721891
disp_sigma: 1.5
dune_file: C:\Users\frank\PycharmProjects\CASCADE\data\Ocracoke_init_data\b3d_high-elevations.csv
elevation_file: C:\Users\frank\PycharmProjects\CASCADE\data\Ocracoke_init_data\b3d_high-elevations.csv
growth_param_file: growthparam_1000dam.npy
k_sf: 19324.753176079226
mm: 2.0
nn: 0.5
rmax: 0.95
rmin: 0.55
s_sf_eq: 0.01698590034494604
sandbag_elevation: 1.8
sandbag_need: false
storm_file: C:\Users\frank\PycharmProjects\CASCADE\data\Ocracoke_init_data\s1.npy
threshold_in: 0.25
Empty file.
1 change: 1 addition & 0 deletions data/Ocracoke_init_data/b3d_high-dunes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.03443271940399183,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.009116198883187385,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.008633164166329348,0.009209096953102036,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.008694511080717131,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.0070999999999999995,0.042892201538865915,0.036561802670233755
Loading

0 comments on commit ea437b9

Please sign in to comment.