Exemple #1
0
    
# grid
Lx = xRange
Ly = yRange
    
nx = 101
ny = 101
dx = Lx / float(nx-1)
dy = Ly / float(ny-1)

latGRID = np.zeros((nx,ny))
lonGRID = np.zeros((nx,ny))

filenameOut = "grid.nc"
write_out_grid(filenameOut, nx, ny, dx, dy, latGRID, lonGRID)





# load particles
particles = pydemsi.Particles.from_particle_netcdf(args.filenameIn)

# set element types
particles.type[:] = 1

# set coastal particles
for iParticle in range(0,len(particles.type)):
    if (particles.x[iParticle] > 1000000.0):
        particles.type[iParticle] = 2
Exemple #2
0

print("Particles to remove: %i" %(len(particlesToRemove)))
particles, keptIndices = particles.remove_particles(remove_ids = particlesToRemove)




#output
particles.x[:] = particles.x[:] + 250000.0
particles.y[:] = particles.y[:] + 250000.0
particles.type[:] = 1

particles.create_bonds(min_overlap = -1000.0)
particles.to_particle_netcdf("particles_in.nc")




# grid
nx = 11
ny = 11
dx = 50000
dy = 50000
lat = np.zeros((nx,ny))
lon = np.zeros((nx,ny))


filenameOut = "grid.nc"
write_out_grid(filenameOut, nx, ny, dx, dy, lat, lon)
Exemple #3
0
rmag = np.sqrt((ix * dx - xc)**2 + (iy * dy - yc)**2)
rmag[rmag == 0] = 1e-10

rxn = (ix * dx - xc) / rmag
ryn = (iy * dx - yc) / rmag
kx = -ryn
ky = rxn
prefac = np.minimum(omega * rmag, lda / rmag)
ugx = prefac * kx
ugy = prefac * ky

lat = np.zeros((nx, ny))
lon = np.zeros((nx, ny))

write_out_grid("grid.nc", nx, ny, dx, dy, lat, lon)

write_out_fixed_forcing("forcing_fixed.nc", nx, ny, ugx, ugy)

write_out_time_varying_forcing("forcing_varying.0001.nc", nx, ny, ugx, ugy)

make_particles("particles_in.nc")
make_particles("particles_in_random.nc", random=True)
make_particles("particles_in_random_init.nc",
               random=True,
               initDistribution=True)
make_particles("particles_in_stability.nc",
               random=True,
               initDistribution=False,
               hmin=0.0,
               hmax=1.0)
Exemple #4
0
yOffset = 0.5 * lyGrid - particlesRadius

particlesBonded.shift_particles(offset_x=xOffset, offset_y=yOffset)

particlesBonded.to_particle_netcdf("particles_in_bonded.nc")

# unbonded particles
particlesUnbonded = pydemsi.Particles.from_lattice(particlesNx, particlesNy,
                                                   particlesRadius)

particlesUnbonded.type[0] = 1
particlesUnbonded.type[1] = 2

xOffset = 0.5 * (lxGrid - 4.0 * particlesRadius)
yOffset = 0.5 * lyGrid - particlesRadius

particlesUnbonded.shift_particles(offset_x=xOffset, offset_y=yOffset)

particlesUnbonded.to_particle_netcdf("particles_in_unbonded.nc")

# grid
nxGrid = 2
nyGrid = 2

dxGrid, dyGrid = lxGrid / (nxGrid - 1), lyGrid / (nyGrid - 1)

latGrid = np.zeros((nxGrid, nyGrid))
lonGrid = np.zeros((nxGrid, nyGrid))

write_out_grid("grid.nc", nxGrid, nyGrid, dxGrid, dyGrid, latGrid, lonGrid)