diff --git a/analysis/Map_origin_particles_surface.ipynb b/analysis/Map_origin_particles_surface.ipynb index 8e9d5fd..3c3bedb 100644 --- a/analysis/Map_origin_particles_surface.ipynb +++ b/analysis/Map_origin_particles_surface.ipynb @@ -68,7 +68,7 @@ "metadata": {}, "outputs": [], "source": [ - "mask = xr.open_dataset('/storage/shared/oceanparcels/input_data/MOi/domain_ORCA0083-N006/PSY4V3R1_mask.nc')\n", + "mask = xr.open_dataset('../data/PSY4V3R1_mask.nc')\n", "indices = {'lat': range(400, 1600), 'lon': range(2000, 4300)}\n", "landmask = mask['tmask'][0, 0, indices['lat'], indices['lon']]\n", "xlon = mask['nav_lon'][indices['lat'], indices['lon']].values\n", diff --git a/analysis/size_distribution.py b/analysis/size_distribution.py index fe078ba..b74ae6f 100644 --- a/analysis/size_distribution.py +++ b/analysis/size_distribution.py @@ -34,7 +34,7 @@ for ft in tqdm(simulations): # print('Computing fragmentation timescale: ', ft) - local_path = f'/storage/shared/oceanparcels/output_data/data_Claudio/hc13_3/hc13_{ft}.zarr' + local_path = f'../data/simulations/hc13_{ft}.zarr' sim = xr.open_zarr(local_path) sim = sim.where(sim.time >= np.datetime64('2007-01-01'), drop=True) # analysis stops at 2007-01-01 diff --git a/analysis/supplementary_material_plots.ipynb b/analysis/supplementary_material_plots.ipynb index b8ff2be..c9a7a93 100644 --- a/analysis/supplementary_material_plots.ipynb +++ b/analysis/supplementary_material_plots.ipynb @@ -48,7 +48,7 @@ "\n", "depth_bins = np.linspace(-5500, 0, 56) # creates a 100m bins\n", "\n", - "simulations = ['_k2', '', '_k4']\n", + "simulations = ['_k2', '_k3', '_k4']\n", "sim_names = ['k2', 'k3', 'k4']" ] }, @@ -113,7 +113,7 @@ "\n", "for k, ft in enumerate(tqdm(simulations)):\n", " # print('Computing fragmentation timescale: ', ft)\n", - " local_path = f'/storage/shared/oceanparcels/output_data/data_Claudio/hc13_2/hc13_1000{ft}.zarr'\n", + " local_path = f'../data/simulations/hc13_1000{ft}.zarr'\n", " sim = xr.open_zarr(local_path)\n", " nano = sim.where(sim.radius < 1e-6/2, drop=False)\n", " sim_dict = {}\n", @@ -196,7 +196,7 @@ "\n", "for k, ft in enumerate(tqdm(simulations)):\n", " # print('Computing fragmentation timescale: ', ft)\n", - " local_path = f'/storage/shared/oceanparcels/output_data/data_Claudio/hc13_2/hc13_1000{ft}.zarr'\n", + " local_path = f'../data/simulations/hc13_1000{ft}.zarr'\n", " sim = xr.open_zarr(local_path)\n", "\n", " # loading fields as np arrays to do some nasty indexing\n", diff --git a/analysis/surface_and_near_shore_particles_stats.ipynb b/analysis/surface_and_near_shore_particles_stats.ipynb index 47ee03e..040a3cd 100644 --- a/analysis/surface_and_near_shore_particles_stats.ipynb +++ b/analysis/surface_and_near_shore_particles_stats.ipynb @@ -85,7 +85,7 @@ "\n", "for k, ft in enumerate(tqdm(simulations)):\n", " # print('Computing fragmentation timescale: ', ft)\n", - " local_path = f'/storage/shared/oceanparcels/output_data/data_Claudio/hc13_3/hc13_{ft}.zarr'\n", + " local_path = f'../data/simulations/hc13_{ft}.zarr'\n", " sim = xr.open_zarr(local_path)\n", "\n", " # loading fields as np arrays to do some nasty indexing\n", diff --git a/analysis/vertical_Kz_profiles.py b/analysis/vertical_Kz_profiles.py deleted file mode 100644 index ed9bb0f..0000000 --- a/analysis/vertical_Kz_profiles.py +++ /dev/null @@ -1,79 +0,0 @@ -import numpy as np -import xarray as xr -import matplotlib.pyplot as plt -from glob import glob -from datetime import datetime -from tqdm import tqdm - -location = 'HC11' -if location == 'HC13': - start_time = datetime.strptime('2019-01-20 12:00:00', '%Y-%m-%d %H:%M:%S') - lat_obs = -32.171 - lon_obs = 6.287 - -elif location == 'HC11': - start_time = datetime.strptime('2019-01-16 12:00:00', '%Y-%m-%d %H:%M:%S') - lon_obs = -3.822 - lat_obs = -29.992 - -path_flow = '/storage/shared/oceanparcels/input_data/MOi/psy4v3r1/' -files = sorted(glob(path_flow + 'psy4v3r1-daily_KZ_*.nc')) - -end_time = datetime.strptime('2006-10-11 12:00:00', '%Y-%m-%d %H:%M:%S') -start_index = 0 -end_index = 0 - -for file in files: - if file[-13:-3] == start_time.strftime('%Y-%m-%d'): - end_index = files.index(file) - - if file[-13:-3] == end_time.strftime('%Y-%m-%d'): - start_index = files.index(file) - -files = files[start_index:end_index+1] - -mesh_mask = xr.open_dataset(files[0]) -z_depths = mesh_mask['depthw'].values - -lon_rest = abs(mesh_mask['nav_lon'][0,:] - lon_obs) -lat_rest = abs(mesh_mask['nav_lat'][:,0] - lat_obs) -lon_index = np.where(lon_rest == lon_rest.min())[0][0] -lat_index = np.where(lat_rest == lat_rest.min())[0][0] - -flow = xr.open_dataset(files[10]) - -d_deg = 5 - -indices = {'lat': range(lat_index-d_deg, lat_index+d_deg), - 'lon': range(lon_index-d_deg, lon_index+d_deg)} -flow['votkeavt'][44, indices['lat'], indices['lon']].plot() - -Kz = np.zeros((len(files), 50, len(indices['lat']), len(indices['lon']))) -# Kz_std = np.zeros((len(files), 50)) - -time = np.zeros(len(files),dtype='datetime64[ns]') - -for i, filename in enumerate(tqdm(files)): - T = xr.open_dataset(filename) - Kz[i] = T['votkeavt'][:, indices['lat'], indices['lon']].values - - time[i] = T['time_counter'].values - -Kz_mean = np.nanmean(Kz, axis=(0,2,3)) -Kz_std = np.nanstd(Kz, axis=(0,2,3)) -Kz_median = np.nanmedian(Kz, axis=(0,2,3)) - -np.save(f'../data/Kz_profile_{location}.npy', Kz) - -fig, ax = plt.subplots(figsize=(3,4)) -ax.plot(Kz_mean, -z_depths, color='k', label='mean') -ax.plot(Kz_std, -z_depths, label='std', ls=':', color='k') -ax.plot(Kz_median, -z_depths, label='median', ls='--', color='k') -ax.semilogx() -ax.legend(shadow=True, fancybox=True, fontsize=8) -ax.set_xlabel('$K_z$ [m$^2$/s]') -ax.set_ylabel('Depth [m]') -ax.set_title('HC13') -ax.set_xticks([1e-7,1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1]) -fig.savefig(f'../article_figs/Kz_profile_{location}.png', dpi=300, - facecolor=(1, 0, 0, 0)) \ No newline at end of file diff --git a/analysis/vertical_histograms.py b/analysis/vertical_histograms.py index 19f07dc..7fdcf51 100644 --- a/analysis/vertical_histograms.py +++ b/analysis/vertical_histograms.py @@ -46,7 +46,7 @@ sim_dict = {} # Load the data from the simulation - local_path = f'/storage/shared/oceanparcels/output_data/data_Claudio/hc13_3/hc13_{ft}.zarr' + local_path = f'../data/simulations/hc13_{ft}.zarr' sim = xr.open_zarr(local_path) sim = sim.where(sim.time >= np.datetime64('2007-01-01'), drop=True) # analysis stops at 2007-01-01 nano = sim.where(sim.radius < 1e-6/2, drop=False) diff --git a/article_figs/Figure3_legend_patch.png b/article_figs/Figure3_legend_patch.png deleted file mode 100644 index 9536ed4..0000000 Binary files a/article_figs/Figure3_legend_patch.png and /dev/null differ diff --git a/article_figs/stats_frag_into_NPs.csv b/article_figs/stats_frag_into_NPs.csv deleted file mode 100644 index c7cc5ee..0000000 --- a/article_figs/stats_frag_into_NPs.csv +++ /dev/null @@ -1,5 +0,0 @@ -,Particles,z median,z min,z max,T_s mean,T_s std,T_s median,T_s min,T_s max,X mean,X std,X median,X min,X max -100,8192.0,-4950.0222879551675,-5492.897725732681,-3115.6953769159486,119.045166015625,116.4921805779782,85.0,0.0,1105.0,212247.33552554937,156129.74960796727,187006.27768894134,154.62232183589518,1195266.8880830365 -1000,8192.0,-4634.582599658053,-5495.58294032956,-1140.9295256698006,1141.559814453125,1053.1294018066226,807.5,0.0,4402.0,545775.3617649877,375534.1180765641,468681.3736023853,649.6496115458041,3872416.2886222294 -10000,8192.0,-4123.204920216056,-5484.762455489719,-9.0,3674.337890625,1287.3911723347012,4402.0,3.0,4402.0,956081.8747460541,682707.0896657215,789449.2975281788,14693.517185845663,7052479.159699347 -23000,8192.0,-4040.5838458904573,-5495.211747527972,-303.27109784392906,4059.7950439453125,947.4400747148248,4402.0,4.0,4402.0,1029578.3526320494,699086.7660447955,860531.9169256894,2219.465999773064,7486441.350030665 diff --git a/notebooks/julia/about_fragmentation.jl b/notebooks/julia/about_fragmentation.jl deleted file mode 100644 index a4bd451..0000000 --- a/notebooks/julia/about_fragmentation.jl +++ /dev/null @@ -1,81 +0,0 @@ -# using Plots - -sim_time = 3 # days -dt = 24 #hours -fragmentation_timescale = 5*24. #hours -fragmentation_prob = 0.5# exp(-dt/fragmentation_timescale) - -N = 10 -diameters = zeros(sim_time, N) -diameters[1,:] .= 5e-8 -fragmenting_state = rand(sim_time, N) .> fragmentation_prob -# -# for i = 1:sim_time -# - -# -# end - -function number_fragments(k, p) - N = 0 - n_fragments = zeros(Float32, k) - - for i = 1:k - n = (1 - p)*(p*2^3)^i - n_fragments[i] = n - N += n - end - p_fragments = n_fragments./N - - return n_fragments, p_fragments - -end - -a, b =number_fragments(3, 1/2) -println(a, b) - - -Π(x) = (3*x^4 - 8*x^3 + 4*x^2 + 2)x^4 - -function p_n(p::Float64) - a = Π(p) - return a -end - -p_n(0.5) - -k = 3 -p = 0.5 - -n_dist, p_fragmenting = number_fragments(10, 0.5) - -## --- - - - - -a = L_is_4_lenght(5e-8, 10) - - -function Fragmentation (particle, fieldset, time) - - if ParcelsRandom.random(0., 1.) > fragmentation_prob: - nummer = ParcelsRandom.random(0., 1.) - plim0 = 8./14.5 - plim1 = 12./14.5 - plim2 = 14./14.5 - - if nummer <= plim0: - frag_mode = 8 - - elif (plim0 < nummer) and (nummer <= plim1): - frag_mode = 4 - - elif (plim1 < nummer) and (nummer <= plim2): - frag_mode = 2 - - else: - frag_mode = 1 - - particle.diameter = particle.diameter*frag_mode # division for reverse -end diff --git a/notebooks/julia/density_profile.npy b/notebooks/julia/density_profile.npy deleted file mode 100644 index 60994f7..0000000 Binary files a/notebooks/julia/density_profile.npy and /dev/null differ diff --git a/notebooks/julia/depth_profile.npy b/notebooks/julia/depth_profile.npy deleted file mode 100644 index 882c7cc..0000000 Binary files a/notebooks/julia/depth_profile.npy and /dev/null differ diff --git a/notebooks/julia/reverse-fragmentation-analysis.ipynb b/notebooks/julia/reverse-fragmentation-analysis.ipynb deleted file mode 100644 index 0102586..0000000 --- a/notebooks/julia/reverse-fragmentation-analysis.ipynb +++ /dev/null @@ -1,2781 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "2c229044", - "metadata": {}, - "outputs": [], - "source": [ - "using Plots\n", - "using NPZ\n", - "using Interpolations" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "aca441bc", - "metadata": {}, - "outputs": [], - "source": [ - "using StatsBase\n", - "using Interpolations" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "7016fa7d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "frag_vec (generic function with 1 method)" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "function frag_vec(n, dt, fragmentation_timescale, mode)\n", - " \n", - " fragmentation_mode = ones(n)\n", - " frag_prob = exp(-abs(dt)/(fragmentation_timescale))\n", - " frag_prob = ones(n)*frag_prob\n", - " rnd_num = rand(n)\n", - " \n", - " truth = rnd_num .> frag_prob\n", - " \n", - " frag_weights = aweights([8/14.5, 4/14.5, 2/14.5, 0.5/14.5])\n", - " \n", - " if mode == \"rand\"\n", - " fragmentation_mode = rand(n).*truth + .!truth\n", - " \n", - " elseif mode == \"Mika\"\n", - " \n", - " raw_mode = sample([8, 4, 2, 1], frag_weights, n)\n", - " fragmentation_mode = 1 ./raw_mode.*truth + .!truth\n", - " \n", - " end\n", - " \n", - " return fragmentation_mode\n", - "end" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "49127bc9", - "metadata": {}, - "outputs": [], - "source": [ - "depth = npzread(\"depth_profile.npy\")\n", - "density = npzread(\"density_profile.npy\")\n", - "\n", - "water_density = LinearInterpolation(depth, density);" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "e70d6fdf", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "plot(density, -depth)" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "78378929", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "sinkingVelocity (generic function with 1 method)" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "function sinkingVelocity(diameter, depth, ρ_p, ν)\n", - " alpha = diameter/2\n", - " g = 9.81\n", - " \n", - " ρ_f = water_density(depth)\n", - " β = 3 .* ρ_f ./(2*ρ_p .+ ρ_f)\n", - " \n", - " tau_p = alpha.^2 ./ (3 .*β*ν)\n", - " \n", - " v_s = (1 .- β)*g .* tau_p\n", - " \n", - " return v_s\n", - " \n", - "end" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "1a652923", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "stokes_law (generic function with 1 method)" - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "function stokes_law(diameter, depth, ρ_p, ν)\n", - " ρ_f = water_density(depth)\n", - " g = 9.81\n", - " \n", - " v_s = (ρ_p - ρ_f)*g*diameter.^2/(18*ν*ρ_f)\n", - " \n", - " return v_s\n", - "end" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "f0342c6d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1000-element LinRange{Float64, Int64}:\n", - " 1.0e-6,1.1009e-5,2.1018e-5,3.1027e-5,…,0.00996997,0.00997998,0.00998999,0.01" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "sizes = LinRange(1e-6, 1e-2, 1000)" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "98157e91", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "18.67367685564726" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "500/d/3600" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "ccbc5fb9", - "metadata": { - "scrolled": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 79.965172 seconds (4.97 M allocations: 87.591 GiB, 16.08% gc time)\n" - ] - } - ], - "source": [ - "# parameters\n", - "r = 5e-7 # 100nm\n", - "k = 0\n", - "sim_time = 1000 #365*10\n", - "N = sim_time + 1\n", - "V = 4/3 *π*r^3\n", - "\n", - "frag_timescale = 5000#*24*3600\n", - "plastic_density = 1380 #kg/m3\n", - "\n", - "particles = 10000\n", - "initial_depth = 4500\n", - "depth_lim = 500\n", - "diameter_lim = 1e-5\n", - "β = 0.8\n", - "ν = 1e-6\n", - "\n", - "dt = 1 #60*60 #seconds\n", - "\n", - "lengthxx = zeros(particles)\n", - "depthxx = ones(particles)*initial_depth\n", - "agexx = zeros(particles)\n", - "\n", - "lengthxx[:] .= r\n", - "online = sum(depthxx .> depth_lim)\n", - "\n", - "i = 0\n", - "@time while online != 0\n", - " truth = depthxx .> depth_lim\n", - " length_lim = lengthxx .< diameter_lim\n", - " vs = sinkingVelocity(lengthxx, depthxx, plastic_density, ν)\n", - " depthxx = depthxx - vs*dt.*truth*24*3600\n", - " modexx = frag_vec(particles, dt, frag_timescale, \"Mika\")\n", - " lengthxx = lengthxx.*(1 .+ (1 ./modexx .- 1).*length_lim)\n", - " agexx = agexx + 1 .*truth\n", - " online = sum(truth)\n", - " i += 1\n", - " \n", - "end" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "3f8aed1b", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "histogram(agexx)" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "id": "087160eb", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - "execution_count": 37, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "histogram(agexx)" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "aa574271", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "10000-element Vector{Float64}:\n", - " 4674.0\n", - " 4282.0\n", - " 5239.0\n", - " 4635.0\n", - " 421.0\n", - " 3923.0\n", - " 2142.0\n", - " 1098.0\n", - " 1982.0\n", - " 1699.0\n", - " 4551.0\n", - " 1717.0\n", - " 2998.0\n", - " ⋮\n", - " 364.0\n", - " 1412.0\n", - " 984.0\n", - " 1666.0\n", - " 2385.0\n", - " 3537.0\n", - " 310.0\n", - " 2739.0\n", - " 1383.0\n", - " 4601.0\n", - " 1111.0\n", - " 1631.0" - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "agexx" - ] - }, - { - "cell_type": "markdown", - "id": "debbcbe2", - "metadata": {}, - "source": [ - "# Several fragmentation timescales" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "b5ca55e0", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "86400000" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "frag_timescale" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "d4ca0c8a", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " 10.426724 seconds (663.98 k allocations: 11.156 GiB, 15.78% gc time)\n" - ] - } - ], - "source": [ - "# parameters\n", - "r = 5e-5 # 100nm\n", - "k = 0\n", - "sim_time = 1000 #365*10\n", - "N = sim_time + 1\n", - "V = 4/3 *π*r^3\n", - "\n", - "N = 10\n", - "frag_timescale = LinRange(1000, 5000, 10) \n", - "plastic_density = 1380 #kg/m3\n", - "\n", - "particles = 10000\n", - "initial_depth = 5000\n", - "depth_lim = 500\n", - "diameter_lim = 1e-3\n", - "β = 0.8\n", - "ν = 1e-6\n", - "dt = 60*60\n", - "\n", - "age = zeros(particles, N)\n", - "L_particles = zeros(particles, N)\n", - "\n", - "\n", - "@time for (index,frag_t) in enumerate(frag_timescale)\n", - " lengthxx = zeros(particles)\n", - " depthxx = ones(particles)*initial_depth\n", - " agexx = zeros(particles)\n", - " lengthxx[:] .= r\n", - " online = sum(depthxx .> depth_lim)\n", - " i = 0\n", - " FT = frag_t*24*60^2\n", - " \n", - " while online != 0\n", - " truth = depthxx .> depth_lim\n", - " length_lim = lengthxx .< diameter_lim\n", - " vs = sinkingVelocity(lengthxx, depthxx, plastic_density, ν)\n", - " depthxx = depthxx - vs*dt.*truth\n", - " modexx = frag_vec(particles, dt, FT, \"Mika\")\n", - " lengthxx = lengthxx.*(1 .+ (1 ./modexx .- 1).*length_lim)\n", - " agexx = agexx + 1 .*truth\n", - " online = sum(truth)\n", - " i += 1\n", - "\n", - " end\n", - " age[:, index] = agexx\n", - " L_particles[:, index] = lengthxx\n", - " \n", - "end" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "fab3d1c7", - "metadata": {}, - "outputs": [], - "source": [ - "using Statistics" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "0e62b86e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "10000×10 Matrix{Float64}:\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 52.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 618.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " ⋮ ⋮ \n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 208.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 22.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 463.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0\n", - " 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0 703.0" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "age" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "21126266", - "metadata": {}, - "outputs": [], - "source": [ - "histogram(age[:,1], label=frag_timescale[1])\n", - "histogram!(age[:,3], label=frag_timescale[3])\n", - "histogram!(age[:,4], label=frag_timescale[4])\n", - "histogram!(age[:,7], label=frag_timescale[7])\n", - "histogram!(age[:,8], label=frag_timescale[8])\n", - "histogram!(age[:,10], label=frag_timescale[10])" - ] - }, - { - "cell_type": "code", - "execution_count": 257, - "id": "9b6f5527", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - "execution_count": 257, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "histogram(age[:,10], label=frag_timescale[10])\n", - "xlabel!(\"Age\")" - ] - }, - { - "cell_type": "code", - "execution_count": 183, - "id": "c8813302", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - "execution_count": 183, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "histogram(agexx)" - ] - }, - { - "cell_type": "code", - "execution_count": 256, - "id": "6ffd1bc7", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - "execution_count": 256, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "histogram(L_particles[:,10])\n" - ] - }, - { - "cell_type": "code", - "execution_count": 55, - "id": "9bb40f46", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "14870.0" - ] - }, - "execution_count": 55, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "maximum(agexx)" - ] - }, - { - "cell_type": "code", - "execution_count": 56, - "id": "29df0931", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "249.0" - ] - }, - "execution_count": 56, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "minimum(agexx)" - ] - }, - { - "cell_type": "code", - "execution_count": 185, - "id": "7697ee39", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1000-element LinRange{Float64, Int64}:\n", - " 1.0,6.004,11.008,16.012,21.016,26.02,…,4979.98,4984.99,4989.99,4995.0,5000.0" - ] - }, - "execution_count": 185, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "LinRange(1, 5000, 1000) " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c5e17c82", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Julia 1.7.0", - "language": "julia", - "name": "julia-1.7" - }, - "language_info": { - "file_extension": ".jl", - "mimetype": "application/julia", - "name": "julia", - "version": "1.7.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/simulation/submit-abyssal-backtrack_copy_1.sh b/simulation/submit-abyssal-backtrack_copy_1.sh deleted file mode 100644 index 6cc5b74..0000000 --- a/simulation/submit-abyssal-backtrack_copy_1.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -l -# -#SBATCH -J aby25 # the name of your job -#SBATCH -p normal # request normal partition, job takes > 1 hour (this line can also be left out because 'normal' is the default) -#SBATCH -t 120:00:00 # time in hh:mm:ss you want to reserve for the job -#SBATCH -n 1 # the number of cores you want to use for the job, SLURM automatically determines how many nodes are needed -#SBATCH -o logs/hc13.%j.o # the name of the file where the standard output will be written to. %j will be the jobid determined by SLURM -#SBATCH -e logs/hc13.%j.e # the name of the file where potential errors will be written to. %j will be the jobid determined by SLURM -#SBATCH --mail-user=c.m.pierard@uu.nl -#SBATCH --mail-type=ALL - -conda activate abyssal-nps - -echo 'Running Backtracking Abyssal Nanoplastics simulation' -cd ${HOME}/3DModelling_SouthAtlantic/simulation - -# first agument is the fragmentation timescale (int) second argument is the boolean for the fragmentation kernel - -python3 backtrack_from_sampling_locations.py -ft 10000 -bm 1 -s 77 & -sleep 20 -python3 backtrack_from_sampling_locations.py -ft 10000 -bm 1 -s 29 & -sleep 20 -python3 backtrack_from_sampling_locations.py -ft 10000 -bm 1 -s 61 & -sleep 20 -python3 backtrack_from_sampling_locations.py -ft 10000 -bm 1 -s 33 - -echo 'Finished computation.' diff --git a/simulation/submit-abyssal-backtrack_copy_2.sh b/simulation/submit-abyssal-backtrack_copy_2.sh deleted file mode 100644 index 7088ec7..0000000 --- a/simulation/submit-abyssal-backtrack_copy_2.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -l -# -#SBATCH -J aby25 # the name of your job -#SBATCH -p normal # request normal partition, job takes > 1 hour (this line can also be left out because 'normal' is the default) -#SBATCH -t 120:00:00 # time in hh:mm:ss you want to reserve for the job -#SBATCH -n 1 # the number of cores you want to use for the job, SLURM automatically determines how many nodes are needed -#SBATCH -o logs/hc13.%j.o # the name of the file where the standard output will be written to. %j will be the jobid determined by SLURM -#SBATCH -e logs/hc13.%j.e # the name of the file where potential errors will be written to. %j will be the jobid determined by SLURM -#SBATCH --mail-user=c.m.pierard@uu.nl -#SBATCH --mail-type=ALL - -conda activate abyssal-nps - -echo 'Running Backtracking Abyssal Nanoplastics simulation' -cd ${HOME}/3DModelling_SouthAtlantic/simulation - -# first agument is the fragmentation timescale (int) second argument is the boolean for the fragmentation kernel - -python3 backtrack_from_sampling_locations.py -ft 1000 -bm 1 -s 14 & -sleep 20 -python3 backtrack_from_sampling_locations.py -ft 1000 -bm 1 -s 78 & -sleep 20 -python3 backtrack_from_sampling_locations.py -ft 1000 -bm 1 -s 27 & -sleep 20 -python3 backtrack_from_sampling_locations.py -ft 1000 -bm 1 -s 62 & -sleep 20 -python3 backtrack_from_sampling_locations.py -ft 1000 -bm 1 -s 34 - -echo 'Finished computation.' diff --git a/simulation/submit-part2.sh b/simulation/submit-part2.sh deleted file mode 100644 index e7a1582..0000000 --- a/simulation/submit-part2.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -l -# -#SBATCH -J ANPsP2 # the name of your job -#SBATCH -p normal # request normal partition, job takes > 1 hour (this line can also be left out because 'normal' is the default) -#SBATCH -t 120:00:00 # time in hh:mm:ss you want to reserve for the job -#SBATCH -n 1 # the number of cores you want to use for the job, SLURM automatically determines how many nodes are needed -#SBATCH -o logs/hc13.%j.o # the name of the file where the standard output will be written to. %j will be the jobid determined by SLURM -#SBATCH -e logs/hc13.%j.e # the name of the file where potential errors will be written to. %j will be the jobid determined by SLURM -#SBATCH --mail-user=c.m.pierard@uu.nl -#SBATCH --mail-type=ALL - -conda activate abyssal-nps - -echo 'Running Backtracking Abyssal Nanoplastics simulation' -cd ${HOME}/3DModelling_SouthAtlantic/simulation - -# first agument is the fragmentation timescale (int) second argument is the boolean for the fragmentation kernel - -python3 backtrack_from_existing_file.py -ft 23000 -bm True - -echo 'Finished computation.'