.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/example_advection_schemes_eddy.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_advection_schemes_eddy.py: Advection schemes ================= Illustrating the difference between Euler and Runge-Kutta propagation schemes, using an idealised (analytical) eddy current field. .. GENERATED FROM PYTHON SOURCE LINES 8-31 .. image-sg:: /gallery/images/sphx_glr_example_advection_schemes_eddy_001.png :alt: OpenDrift - OceanDrift 2024-04-25 15:23 to 2024-05-04 15:23 UTC (433 steps) :srcset: /gallery/images/sphx_glr_example_advection_schemes_eddy_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Assuming time step of 1 hour for ArtificialOceanEddy euler, T=0.5h euler, T=3.0h runge-kutta, T=0.5h runge-kutta, T=3.0h runge-kutta4, T=0.5h runge-kutta4, T=3.0h (,
) | .. code-block:: Python from datetime import datetime, timedelta from opendrift.readers import reader_ArtificialOceanEddy from opendrift.models.oceandrift import OceanDrift fake_eddy = reader_ArtificialOceanEddy.Reader(2, 62) runs = [] leg = [] for scheme in ['euler', 'runge-kutta', 'runge-kutta4']: for time_step in [1800, 3600*3]: leg.append(scheme + ', T=%.1fh' % (time_step/3600.)) print(leg[-1]) o = OceanDrift(loglevel=50) o.set_config('environment:fallback:land_binary_mask', 0) o.set_config('drift:advection_scheme', scheme) o.set_config('drift:vertical_mixing', False) o.add_reader(fake_eddy) o.seed_elements(lon=2.0, lat=63.0, time=datetime.utcnow()) o.run(duration=timedelta(days=9), time_step=time_step) runs.append(o) runs[0].plot(compare=runs[1:], legend=leg, fast=True, buffer=.3) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 54.900 seconds) .. _sphx_glr_download_gallery_example_advection_schemes_eddy.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_advection_schemes_eddy.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_advection_schemes_eddy.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_