Example #1
0
Kz = 0.01# m2/s-1
o.set_config('drift:horizontal_diffusivity',Kxy) # using new config rather than current uncertainty
o.set_config('environment:fallback:ocean_vertical_diffusivity', Kz) # specify constant ocean_vertical_diffusivity in m2.s-1
# seed
o.set_config('seed:ocean_only',True) # keep only particles from the "frame" that are on the ocean
# drift
o.set_config('drift:advection_scheme','runge-kutta4') # or 'runge-kutta'
o.set_config('drift:current_uncertainty', 0.0 ) # note current_uncertainty can be used to replicate an horizontal diffusion spd_uncertain = sqrt(Kxy*2/dt)  
o.set_config('drift:max_age_seconds', 3600*24*30) # 
o.set_config('drift:lift_to_seafloor',True)
#processes
o.set_config('drift:vertical_mixing', False)  
o.set_config('general:coastline_action','previous') # option('none', 'stranding', 'previous', default='stranding')
#o.set_config('drift:min_settlement_age_seconds', 3600*24*21) #

o.list_config()
# o.list_configspec()

###############################
# RUN 
###############################
# Running model (until end of driver data)

lons_start = o.elements_scheduled.lon
lats_start = o.elements_scheduled.lat

o.run(stop_on_error=False,
      end_time=reader_moana_2.end_time,
      time_step=900, 
      time_step_output = 86400.0,
      export_variables = [])
)  #if True, any particles seeded on land will try and auto move to the water, if False they will just be retired.

o.set_config(
    'drift:advection_scheme', 'runge-kutta4'
)  #some sort of math thing that I don't understand. Either 'runge-kutta4' or 'runge-kutta' should work.
o.set_config('drift:vertical_mixing', False)  #tbh idk what this does

#tell particles what to do when they hit the coast/floor
o.set_config('general:seafloor_action', 'lift_to_seafloor')
o.set_config('general:coastline_action', 'previous')

#decide how long you want your particles to float. min_settlement_age is a feature of BivalveLarvae
o.set_config('drift:max_age_seconds', 3600 * 24 * 35)
o.set_config('drift:min_settlement_age_seconds', 3600 * 24 * 21)

o.list_config()  #print out all your configs just for fun/help debugging

##############################
#SEED PARTICLES
##############################
#There's a bunch of different ways to seed particles, here's my go-to method
#give corners of a polygon to seed within
minlon = 173.2
maxlon = 173.3
minlat = -35.6
maxlat = -35.5
lons = [minlon, maxlon, maxlon, minlon]
lats = [maxlat, maxlat, minlat, minlat]

time0 = reader0.start_time
z = -5