o = OceanDrift(loglevel=20) # Set loglevel to 0 for debug information # Disable any 3D motion o.set_2d() # Define some constant current, wind and Stokes drift o.fallback_values['x_wind'] = 7 o.fallback_values['x_sea_water_velocity'] = .1 o.fallback_values['sea_surface_wave_stokes_drift_x_velocity'] = .2 o.fallback_values['sea_surface_wave_significant_height'] = 2 o.fallback_values[ 'sea_surface_wave_period_at_variance_spectral_density_maximum'] = 8 # Seed elements between surface and 5m depth time = datetime.now() z = -np.linspace(0, 5, 50) o.seed_elements(lon=4.5, lat=60.0, z=z, radius=0, number=len(z), time=time) # Running model for 6 hours o.run(duration=timedelta(hours=6), time_step=600) # To check that z is really kept constant for all particles o.plot_property('z') # Vertical profile of advection. Note the decaying importance of Stokes drift, and the additional windage of the element at surface o.animation_profile() #%% # .. image:: /gallery/animations/example_2d_0.gif
o.set_config('general:coastline_action', 'previous') shyfem = shyfem.Reader('https://iws.ismar.cnr.it/thredds/dodsC/emerge/shyfem_unstructured_adriatic.nc') o.add_reader(shyfem) print(shyfem) # Seed elements at defined positions, depth and time N = 1000 z = -15*np.random.uniform(0, 1, N) o.seed_elements(lon=12.4, lat=45.25, radius=1000, number=N, z=z, time=shyfem.start_time) #%% # Running model o.run(time_step=1800, duration=timedelta(hours=12)) #%% # Print and plot results print(o) #%% # Animations o.animation(color='z', markersize=5, corners=[12.2, 12.6, 45.1, 45.5]) o.animation_profile(color='z', markersize=5) #%% # .. image:: /gallery/animations/example_shyfem_0.gif o.plot(fast=True, buffer = 1., corners=[12.2, 12.6, 45.1, 45.5])