parcels icon indicating copy to clipboard operation
parcels copied to clipboard

Particles stuck near the ocean boundary

Open Novaoceans opened this issue 2 years ago • 0 comments

Hi, I am new to the OceanParticles. I tried to do a particle tracking test by using NEMO output. I found the particles stuck near one of the ocean boundaries. What should I do to avoid this problem? I got the information like "Correct cell not found for (-66.384997, 44.906770) after 1000000 iterations Debug info: old particle indices: (yi, xi) 0 48 new particle indices: (yi, xi) 0 48" during the run.

image image

This is the code I used: #1 Set up the parameters and data folders #Set up main parameters output_dt = 60 # output interval in minutes run_time = 48 # total running time in hours dt_time = 5 # time step in minutes output_path = 'Output/Test2_1hr-repeat_tj.nc' #U and V velocity fields and model mesh file data_path = 'SJ100/2016040400/' filepath_const = 'SJ100/' ufiles = sorted(glob(data_path+'NEMO_RPN_1h_grid_U_20*.nc')) vfiles = sorted(glob(data_path+'NEMO_RPN_1h_grid_V_20*.nc')) wfiles = data_path+'NEMO_RPN_1h_grid_U_20160331-20160331.nc' mesh_mask = filepath_const + 'mesh-mask_SJ100_consistent.nc'

#2 Set up FieldSet #Names for the U and V files, opens multiple filenames = {'U': {'lon': mesh_mask, 'lat': mesh_mask, 'depth': wfiles, 'data': ufiles}, 'V': {'lon': mesh_mask, 'lat': mesh_mask, 'depth': wfiles, 'data': vfiles}}

variables = {'U': 'uo', 'V': 'vo'}

dimensions = {'U': {'lon': 'glamf', 'lat': 'gphif', 'depth': 'depthu', 'time': 'time_counter'}, 'V': {'lon': 'glamf', 'lat': 'gphif', 'depth': 'depthu', 'time': 'time_counter'}} #Take the depth at 0m indices = { 'U': {'depth': [0]}, 'V': {'depth': [0]} }

fieldset = FieldSet.from_nemo(filenames, variables, dimensions, indices=indices, allow_time_extrapolation=True)

#3 Set up the particle set pfile = xr.open_dataset('partciles.nc') lons = pfile.lons.values[0] lats = pfile.lats.values[0] pset = ParticleSet.from_list(fieldset=fieldset, pclass=JITParticle, lon=lons, lat=lats)

#4 Set up kernels kernels = pset.Kernel(AdvectionRK4) def DeleteParticle(particle, fieldset, time): particle.delete()

#5 Run the OP output for 2 days output_file = pset.ParticleFile(name=output_path,outputdt=timedelta(minutes=output_dt))

pset.execute(kernels, runtime = timedelta(hours = run_time), dt = timedelta(minutes = dt_time), recovery= {ErrorCode.ErrorOutOfBounds: DeleteParticle}, output_file=output_file) output_file.export()

Novaoceans avatar Oct 17 '22 20:10 Novaoceans