{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# Seafloor oil spill\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from datetime import timedelta\nfrom opendrift.readers import reader_netCDF_CF_generic\nfrom opendrift.models.openoil import OpenOil\n\no = OpenOil(loglevel=20) # Set loglevel to 0 for debug information\n\n# Norkyst\nreader_norkyst = reader_netCDF_CF_generic.Reader(o.test_data_folder() + '14Jan2016_NorKyst_z_3d/NorKyst-800m_ZDEPTHS_his_00_3Dsubset.nc')\n#reader_norkyst = reader_netCDF_CF_generic.Reader('https://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be')\n\no.add_reader([reader_norkyst])\no.set_config('environment:fallback:x_wind', 3)\no.set_config('environment:fallback:y_wind', 7)\no.set_config('drift:vertical_mixing', True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Setting the range of droplet sizes for the seafloor release\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"o.set_config('seed:droplet_size_distribution','uniform')\no.set_config('seed:droplet_diameter_min_subsea', 0.0001)\no.set_config('seed:droplet_diameter_max_subsea', 0.0005)\n\n# 'normal' and 'lognormal' distributions can also be specified\n# o.set_config('seed:droplet_size_distribution','lognormal')\n# o.set_config('seed:droplet_diameter_mu',0.001) # 1 mm\n# o.set_config('seed:droplet_diameter_sigma',0.0008) # 0.8 mm"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Seeding some particles\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"time = [reader_norkyst.start_time,\n reader_norkyst.start_time + timedelta(hours=1)]\no.seed_elements(lon=4.5, lat=62.0, z='seafloor', radius=0, number=3000,\n time=time, oil_type='GENERIC DIESEL')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Running model with a small timestep to resolve the boyant rising\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"o.run(duration=timedelta(hours=6), time_step=60, time_step_output=60)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Print and plot results\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"print(o)\n\no.animation_profile(markersize='z', color='z')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"o.animate_vertical_distribution(bins=30, subsamplingstep=5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"o.plot_oil_budget()"
]
}
],
"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
}