.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_sediments_resuspension.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_example_sediments_resuspension.py: Sediment drift with resuspension ================================ .. GENERATED FROM PYTHON SOURCE LINES 6-11 .. code-block:: Python from datetime import timedelta, datetime from opendrift.readers import reader_oscillating from opendrift.models.sedimentdrift import SedimentDrift .. GENERATED FROM PYTHON SOURCE LINES 12-13 Constructing an artificial current field where x- and y-components are oscilating with different amplitude and period .. GENERATED FROM PYTHON SOURCE LINES 13-29 .. code-block:: Python reader_oscx = reader_oscillating.Reader('x_sea_water_velocity', amplitude=0.6, zero_time=datetime.utcnow()) reader_oscy = reader_oscillating.Reader('y_sea_water_velocity', amplitude=.3, period_seconds=3600*5, zero_time=datetime.utcnow()) o = SedimentDrift(loglevel=50) # 0 for debug output if True: o.add_reader([reader_oscx, reader_oscy]) o.set_config('environment:fallback:y_wind', -6) o.set_config('environment:fallback:x_wind', -3) o.set_config('environment:fallback:sea_floor_depth_below_sea_level', 30) # 100m depth else: # Using live data from Thredds instead of oscillating currents o.add_readers_from_list([ 'https://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be']) .. GENERATED FROM PYTHON SOURCE LINES 30-31 Set threshold for bottom resuspension .. GENERATED FROM PYTHON SOURCE LINES 31-39 .. code-block:: Python o.set_config('vertical_mixing:resuspension_threshold', .5) # Adding some horizontal and vertical diffusion o.set_config('drift:current_uncertainty', 0.1) o.set_config('drift:wind_uncertainty', 1) o.set_config('vertical_mixing:diffusivitymodel', 'windspeed_Large1994') #o.set_config('vertical_mixing:diffusivitymodel', 'environment') .. GENERATED FROM PYTHON SOURCE LINES 40-41 Seeding sediments .. GENERATED FROM PYTHON SOURCE LINES 41-47 .. code-block:: Python o.seed_elements(lon=4.65, lat=60, number=10000, time=[datetime.utcnow(), datetime.utcnow()+timedelta(hours=6)], terminal_velocity=-.01) # 1 cm/s settling speed o.run(time_step=1800, time_step_output=1800, duration=timedelta(hours=72)) .. GENERATED FROM PYTHON SOURCE LINES 48-49 Plotting the depth vs time .. GENERATED FROM PYTHON SOURCE LINES 49-51 .. code-block:: Python o.plot_property('z') .. image-sg:: /gallery/images/sphx_glr_example_sediments_resuspension_001.png :alt: z :srcset: /gallery/images/sphx_glr_example_sediments_resuspension_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 52-53 Animate sediment particles .. GENERATED FROM PYTHON SOURCE LINES 53-56 .. code-block:: Python o.animation(color='moving', colorbar=False, legend=['Sedimented', 'Moving'], fast=True, buffer=.01) #o.animation_profile() .. GENERATED FROM PYTHON SOURCE LINES 57-58 .. image:: /gallery/animations/example_sediments_resuspension_0.gif .. rst-class:: sphx-glr-timing **Total running time of the script:** (2 minutes 19.644 seconds) .. _sphx_glr_download_gallery_example_sediments_resuspension.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_sediments_resuspension.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_sediments_resuspension.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_