{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Vertical diffusivity\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plot the depth dependence of vertical diffusivity from the various analytical methods\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\nimport matplotlib.pyplot as plt\nfrom opendrift.models.physics_methods import verticaldiffusivity_Sundby1983, verticaldiffusivity_Large1994, verticaldiffusivity_stepfunction\n\ndepth = np.linspace(0, 60, 100)\nwindspeed = np.arange(0, 20, 5)\ncolors = ['r', 'g', 'b', 'k']\n\nfor w, c in zip(windspeed, colors):\n plt.plot(np.ones(depth.shape)*verticaldiffusivity_Sundby1983(w, depth, 50),\n depth, c + '-', label='Sundby, wind = %sm MLD=50' % w)\n plt.plot(verticaldiffusivity_Large1994(w, depth, 50), depth,\n c + '--', label='Large, wind = %s, MLD=50' % w)\n plt.plot(verticaldiffusivity_Large1994(w, depth, 20), depth,\n c + '-.', label='Large, wind = %s, MLD=20' % w)\n\nplt.plot(verticaldiffusivity_stepfunction(depth), depth,\n '-m', label='Stepfunction')\n\nplt.xlabel('Vertical diffusivity [m2/s]')\nplt.ylabel('Depth [m]')\nplt.gca().set_ylim([0, depth.max()])\nplt.gca().set_xlim([0, None])\nplt.gca().invert_yaxis()\nplt.legend()\nplt.show()" ] } ], "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 }