{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Sediment drift with resuspension\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import timedelta, datetime\nfrom opendrift.readers import reader_oscillating\nfrom opendrift.models.sedimentdrift import SedimentDrift" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Constructing an artificial current field where x- and y-components are oscilating with different amplitude and period\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "reader_oscx = reader_oscillating.Reader('x_sea_water_velocity',\n amplitude=0.6, zero_time=datetime.utcnow())\nreader_oscy = reader_oscillating.Reader('y_sea_water_velocity',\n amplitude=.3, period_seconds=3600*5, zero_time=datetime.utcnow())\n\no = SedimentDrift(loglevel=50) # 0 for debug output\n\nif True:\n o.add_reader([reader_oscx, reader_oscy])\n o.set_config('environment:fallback:y_wind', -6)\n o.set_config('environment:fallback:x_wind', -3)\n o.set_config('environment:fallback:sea_floor_depth_below_sea_level', 30) # 100m depth\nelse: # Using live data from Thredds instead of oscillating currents\n o.add_readers_from_list([\n 'https://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set threshold for bottom resuspension\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.set_config('vertical_mixing:resuspension_threshold', .5)\n\n# Adding some horizontal and vertical diffusion\no.set_config('drift:current_uncertainty', 0.1)\no.set_config('drift:wind_uncertainty', 1)\no.set_config('vertical_mixing:diffusivitymodel', 'windspeed_Large1994')\n#o.set_config('vertical_mixing:diffusivitymodel', 'environment')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seeding sediments\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.seed_elements(lon=4.65, lat=60, number=10000, \n time=[datetime.utcnow(), datetime.utcnow()+timedelta(hours=6)],\n terminal_velocity=-.01) # 1 cm/s settling speed\n\no.run(time_step=1800, time_step_output=1800, duration=timedelta(hours=72))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plotting the depth vs time\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.plot_property('z')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Animate sediment particles\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.animation(color='moving', colorbar=False, legend=['Sedimented', 'Moving'], fast=True, buffer=.01)\n#o.animation_profile()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.6" } }, "nbformat": 4, "nbformat_minor": 0 }