DeltaRCM / pyDeltaRCM

Delta model with a reduced-complexity approach
https://deltarcm.org/pyDeltaRCM/
MIT License
18 stars 11 forks source link

array to spatially modify sediment erodibility #257

Closed elbeejay closed 2 years ago

elbeejay commented 2 years ago

This PR adds two "method modifying arrays": mod_erosion and mod_sed_weight. mod_sed_weight is analogous modification to #255 except for sediment, while mod_erosion can be used to linearly modify the erodibility of cells within the domain. Both arrays are all 1s by default, thus leaving default behavior of the model unchangd.

Our current formula for erosion is: Vp_sed * (U_loc**beta - U_ero**beta) / U_ero**beta

This PR proposes changing that formula to: mod_erosion * Vp_sed * (U_loc**beta - U_ero**beta) / U_ero**beta

For weighting we now use the formula: (depth * mod_sed_weight)**theta_sed where previously this was just depth**theta_sed


Toy example of varying sediment erodibility across the basin. The model uses default parameters, except for the two rectangular sections, the red is 10x more erodible than normal, while the blue is 100x less erodible. Below is the topography after running the model for 2000 timesteps.

erodible_ex

codecov[bot] commented 2 years ago

Codecov Report

Merging #257 (c53d037) into develop (a73389d) will decrease coverage by 0.15%. The diff coverage is 41.66%.

@@             Coverage Diff             @@
##           develop     #257      +/-   ##
===========================================
- Coverage    78.98%   78.83%   -0.16%     
===========================================
  Files           12       12              
  Lines         2608     2617       +9     
===========================================
+ Hits          2060     2063       +3     
- Misses         548      554       +6     
Impacted Files Coverage Δ
pyDeltaRCM/iteration_tools.py 98.00% <ø> (ø)
pyDeltaRCM/model.py 89.44% <ø> (ø)
pyDeltaRCM/preprocessor.py 83.85% <ø> (-0.25%) :arrow_down:
pyDeltaRCM/sed_tools.py 44.12% <30.00%> (-0.36%) :arrow_down:
pyDeltaRCM/init_tools.py 97.17% <100.00%> (+0.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a73389d...c53d037. Read the comment docs.

elbeejay commented 2 years ago

Runtime, I believe, is largely unaffected by this change. The below loop was run on both the current "develop" branch, as well as the PR branch:

for i in range(10):
    print('start')
    t0 = time.time()
    mdl = DeltaModel()
    for _ in range(5):
        mdl.update()
    mdl.finalize()
    print('end')
    te = time.time() - t0
    print('elapsed time: ' + str(te))

Results for the develop branch:

start
end
elapsed time: 58.0141327381134
start
end
elapsed time: 29.012001752853394
start
end
elapsed time: 27.661343812942505
start
end
elapsed time: 27.84003520011902
start
end
elapsed time: 27.55450749397278
start
end
elapsed time: 24.5800518989563
start
end
elapsed time: 26.163628339767456
start
end
elapsed time: 26.005600690841675
start
end
elapsed time: 26.85622787475586
start
end
elapsed time: 26.34150528907776

Results for the PR branch:

start
end
elapsed time: 67.06967329978943
start
end
elapsed time: 25.85872459411621
start
end
elapsed time: 25.82465124130249
start
end
elapsed time: 26.194438457489014
start
end
elapsed time: 27.06920576095581
start
end
elapsed time: 27.861593008041382
start
end
elapsed time: 26.287869453430176
start
end
elapsed time: 25.184372663497925
start
end
elapsed time: 26.88888168334961
start
end
elapsed time: 28.15934157371521