{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Oil budget (NOAA)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from datetime import datetime\nfrom opendrift.readers import reader_netCDF_CF_generic\nfrom opendrift.models.openoil import OpenOil\n\no = OpenOil(loglevel=20, weathering_model='noaa')\n\n# Using constand wind and current\n#o.set_config('environment:fallback:x_wind', 7)\n#o.set_config('environment:fallback:x_sea_water_velocity', .7)\n#o.set_config('environment:fallback:y_sea_water_velocity', .3)\n#o.set_config('environment:fallback:land_binary_mask', 0)\n\n# Arome atmospheric model\nreader_arome = reader_netCDF_CF_generic.Reader(o.test_data_folder() + '16Nov2015_NorKyst_z_surface/arome_subset_16Nov2015.nc')\n# Norkyst ocean model\nreader_norkyst = reader_netCDF_CF_generic.Reader(o.test_data_folder() + '16Nov2015_NorKyst_z_surface/norkyst800_subset_16Nov2015.nc')\n\no.add_reader([reader_arome, reader_norkyst])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Adjusting some configuration\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.set_config('processes:dispersion', False)\no.set_config('processes:evaporation', True)\no.set_config('processes:emulsification', True)\no.set_config('drift:vertical_mixing', True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Seeding some oil particles\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "oil_type='MARTIN LINGE CRUDE 2016'\no.seed_elements(lon=4.88, lat=60.1, z=0, radius=3000, number=500,\n time=reader_norkyst.start_time, oil_type=oil_type)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Running model\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.run(steps=4*24, time_step=900, time_step_output=3600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Print and plot results\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.plot_oil_budget()\no.plot(fast=True)\no.animation(fast=True)\n#o.plot_oil_budget('oil_budget_MartinLingeCrude.png')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "o.plot_property('fraction_evaporated')\no.plot_property('density')\no.plot_property('water_fraction')\no.plot_property('viscosity')\no.plot_property('interfacial_area')\no.plot_property('z')" ] } ], "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 }