.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_parameterized_stokesdrift.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_parameterized_stokesdrift.py: Parameterised Stokesdrift ========================= .. GENERATED FROM PYTHON SOURCE LINES 8-11 If surface Stokes drift is not available from a wave model, there are two alternatives: - one can increase the wind_drift_factor by e.g. 1.5%, as the Stokes Drift is typically 1.5% of the wind speed - or the surface Stokes drift can be parameterized from wind speed and fetch distance .. GENERATED FROM PYTHON SOURCE LINES 13-15 The latter option is activated in OpenDrift with the config setting `o.set_config('drift:use_tabularised_stokes_drift', True)` .. GENERATED FROM PYTHON SOURCE LINES 17-20 This activates a paramterisation of Stokes drift with the following method, as implemented by Petter Nygren from SMHI: https://opendrift.github.io/_modules/opendrift/models/physics_methods.html#wave_stokes_drift_parameterised The code and corresponding plot below shows how the Stokes drift factor (fraction of wind speed) varies with wind speed and fetch (3 different tabulated fetch distances). .. GENERATED FROM PYTHON SOURCE LINES 20-33 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from opendrift.models.physics_methods import wave_stokes_drift_parameterised for fetch in ['5000', '25000', '50000']: wind = ([np.arange(1, 35), np.array([0])]) sx, sy = wave_stokes_drift_parameterised(wind=wind, fetch=fetch) plt.plot(wind[0], sx/wind[0], label=f'Fetch: {fetch[:-3]} km') plt.xlabel('Wind speed [m/s]') plt.ylabel('Stokes drift / wind speed [ratio]') plt.legend() plt.show() .. image-sg:: /gallery/images/sphx_glr_example_parameterized_stokesdrift_001.png :alt: example parameterized stokesdrift :srcset: /gallery/images/sphx_glr_example_parameterized_stokesdrift_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.626 seconds) .. _sphx_glr_download_gallery_example_parameterized_stokesdrift.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_parameterized_stokesdrift.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_parameterized_stokesdrift.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_parameterized_stokesdrift.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_