OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
231 stars 113 forks source link

Deactivation of elements #1271

Closed Yoavp81 closed 2 months ago

Yoavp81 commented 2 months ago

Hello,

I've run OpenDrift in the past and obtained results which take into account seafloor deactivation and shoreline stranding: SCN_4_1

However, when I run the same script now, elements are not deactivated as before: test2

I have uninstalled and reinstalled OpenDrift to the newest version and nothing seems to solve the issue. I'm attaching my script (minus the readers part):

import os import numpy as np from datetime import datetime,timedelta from opendrift.models.oceandrift import OceanDrift from opendrift.readers import reader_netCDF_CF_generic from opendrift.models.openoil import OpenOil from opendrift.readers.reader_constant import Reader as ConstantReader from opendrift.models.physics_methods import verticaldiffusivity_Sundby1983, verticaldiffusivity_Large1994, verticaldiffusivity_stepfunction

o = OpenOil(loglevel=20) # Set loglevel to 0 for debug information

o.set_config('general:use_auto_landmask', True) o.set_config('general:seafloor_action', 'deactivate') o.set_config('general:coastline_action', 'stranding')

o.set_config('general:time_step_minutes', 60)

o.set_config('general:time_step_output_minutes', 180)

o.set_config('drift:advection_scheme', 'euler') # ['euler', 'runge-kutta', 'runge-kutta4'] o.set_config('drift:horizontal_diffusivity', 2) o.set_config('drift:vertical_advection', True) o.set_config('drift:vertical_mixing', True) o.set_config('vertical_mixing:TSprofiles', True) o.set_config('vertical_mixing:background_diffusivity', 0.001)

o.set_config('vertical_mixing:timestep', 3600)

o.set_config('vertical_mixing:diffusivitymodel', 'windspeed_Sundby1983') # ['environment', 'stepfunction', 'windspeed_Sundby1983', 'windspeed_Large1994', 'gls_tke', 'constant'] o.set_config('drift:deactivate_north_of', 34) o.set_config('seed:droplet_diameter_min_subsea', 0.0001) o.set_config('seed:droplet_diameter_max_subsea', 0.0005) o.set_config('processes:dispersion', True) o.set_config('processes:evaporation', True) o.set_config('processes:emulsification', True) o.set_config('environment:constant:land_binary_mask', 0)

Seeding particles

o.seed_elements(lon=34.29097, lat=33.23201, radius=1, number=30000, z='seafloor+1', time=[datetime(2007,9,25,00,00,0),datetime(2007,10,24,00,00,0)], m3_per_hour= 44.38, oil_type='Gippsland Blend', wind_drift_factor=0.031)

Run

o.run(duration=timedelta(days=30), time_step=timedelta(hours=3), time_step_output=timedelta(hours=3),export_variables=['mass_oil', 'status', 'lat', 'lon','z'])

Output

o.plot(buffer=.2, fast=True,filename='test2.jpeg')

Thank you for your help!

knutfrode commented 2 months ago

Hi,

With this line you are saying that landmask should always be 0, i.e. no land at all: o.set_config('environment:constant:land_binary_mask', 0)

So maybe this line has changed or sneaked in in the meantime?

Yoavp81 commented 2 months ago

Yes, that was the problem! While experimenting with the code this line probably remained. Thank you