{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# Cod egg\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from opendrift.readers import reader_netCDF_CF_generic\nfrom opendrift.models.pelagicegg import PelagicEggDrift\nfrom datetime import datetime, timedelta\n\no = PelagicEggDrift(loglevel=20) # Set loglevel to 0 for debug information\n\n# Forcing with Topaz ocean model and MEPS atmospheric model\no.add_readers_from_list([\n 'https://thredds.met.no/thredds/dodsC/cmems/topaz6/dataset-topaz6-arc-15min-3km-be.ncml',\n 'https://thredds.met.no/thredds/dodsC/mepslatest/meps_lagged_6_h_latest_2_5km_latest.nc'])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Adjusting some configuration\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"o.set_config('drift:vertical_mixing', True)\no.set_config('vertical_mixing:diffusivitymodel', 'windspeed_Sundby1983') # windspeed parameterization for eddy diffusivity"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Vertical mixing requires fast time step\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"o.set_config('vertical_mixing:timestep', 60.) # seconds"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"spawn NEA cod eggs at defined position and time\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"time = datetime.utcnow()\no.seed_elements(14. , 68.1, z=-40, radius=2000, number=500,\n time=time, diameter=0.0014, neutral_buoyancy_salinity=31.25)\no.seed_elements(12.5, 68., z=-40, radius=2000, number=500,\n time=time, diameter=0.0014, neutral_buoyancy_salinity=31.25)\no.seed_elements(13.5, 68., z=-40, radius=2000, number=500,\n time=time, diameter=0.0014, neutral_buoyancy_salinity=31.25)\no.seed_elements(13., 67.8, z=-40, radius=2000, number=500,\n time=time, diameter=0.0014, neutral_buoyancy_salinity=31.25)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Running model\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"o.run(duration=timedelta(hours=48), time_step=3600)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Print and plot results.\nAt the end the wind vanishes, and eggs come to surface\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"print(o)\n\no.plot(fast=True)\no.animation(fast=True, color='z')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"o.animate_vertical_distribution()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n\n"
]
}
],
"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
}