From aca4f19eec7ac61c262002f5dfeabb55b06c244a Mon Sep 17 00:00:00 2001 From: Skylar Gering Date: Mon, 1 Jul 2024 16:59:16 -0400 Subject: [PATCH] Remove unneeded time argument --- README.md | 3 +-- documentation.md | 6 ++--- examples/converge_diverge_flow.jl | 3 +-- examples/forcing_contained_floes.jl | 3 +-- examples/many_floes.jl | 2 +- examples/moving_bounds.jl | 3 +-- examples/restart_sim.jl | 3 +-- examples/shear_flow.jl | 3 +-- examples/simple_strait.jl | 3 +-- examples/test_run.jl | 6 ++--- examples/uniform_flow.jl | 3 +-- src/physical_processes/fractures.jl | 1 - src/simulation_components/floe.jl | 21 ++++------------ test/qualitative_behavior.jl | 6 ++--- test/test_conservation.jl | 15 ++++-------- test/test_floe.jl | 24 +++++++------------ .../test_collisions.jl | 22 ++++++++--------- .../test_ridge_raft.jl | 3 +-- .../test_simplification.jl | 9 +++---- test/test_physical_processes/test_welding.jl | 6 ++--- 20 files changed, 51 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index a5c7bf9..314e91a 100644 --- a/README.md +++ b/README.md @@ -92,8 +92,7 @@ floe_arr = initialize_floe_field( [0.7], # floe concentration domain, 0.5, # average floe height - 0.05, # floe height variability - 10; # length of timestep in seconds + 0.05; # floe height variability floe_settings = floe_settings, ) # Create model diff --git a/documentation.md b/documentation.md index cb37f47..0e593d3 100644 --- a/documentation.md +++ b/documentation.md @@ -321,8 +321,7 @@ floe_field = initialize_floe_field( [floe1, floe2], domain, 0.25, # mean height of 0.25 - 0.0, # all floes will be the same height - Δt; # timestep of simulation in seconds + 0.0; # all floes will be the same height rng = Xoshiro(1), floe_settings = floe_settings, ) @@ -336,8 +335,7 @@ floe_arr = initialize_floe_field( [1.0; 0.0], # the top half of the domain is fully packed and the bottom has no floes domain, 0.25, # mean height of 0.25 - 0.10, # floe heights will range from 0.15-0.35 - Δt; # Simulation timestep in seconds + 0.10; # floe heights will range from 0.15-0.35 floe_settings = floe_settings, rng = Xoshiro(1), ) diff --git a/examples/converge_diverge_flow.jl b/examples/converge_diverge_flow.jl index 7dd2e28..b63e11b 100644 --- a/examples/converge_diverge_flow.jl +++ b/examples/converge_diverge_flow.jl @@ -41,8 +41,7 @@ floe_arr = initialize_floe_field( [0.8], domain, hmean, - Δh, - Δt; + Δh; rng = Xoshiro(1), ) diff --git a/examples/forcing_contained_floes.jl b/examples/forcing_contained_floes.jl index 64b32b9..df2d169 100644 --- a/examples/forcing_contained_floes.jl +++ b/examples/forcing_contained_floes.jl @@ -66,8 +66,7 @@ floe_arr = initialize_floe_field( [0.4], domain, hmean, - Δh, - Δt; + Δh; floe_bounds = floe_bounds, rng = Xoshiro(1), floe_settings = floe_settings diff --git a/examples/many_floes.jl b/examples/many_floes.jl index c6236d0..303ac01 100644 --- a/examples/many_floes.jl +++ b/examples/many_floes.jl @@ -40,7 +40,7 @@ nfloes = 100 file = jldopen("examples/floe_shapes.jld2", "r") nfloes = nfloes > size(file["floe_vertices"], 1) ? size(file["floe_vertices"], 1) : nfloes floe_coords = file["floe_vertices"][1:1] -floe_arr = initialize_floe_field(FT, floe_coords, domain, hmean, Δh, Δt) +floe_arr = initialize_floe_field(FT, floe_coords, domain, hmean, Δh) close(file) model = Model(grid, ocean, atmos, domain, floe_arr) diff --git a/examples/moving_bounds.jl b/examples/moving_bounds.jl index 9833253..9374159 100644 --- a/examples/moving_bounds.jl +++ b/examples/moving_bounds.jl @@ -34,8 +34,7 @@ floe_arr = initialize_floe_field( [1.0], domain, hmean, - Δh, - Δt; + Δh; rng = Xoshiro(1), ) nfloes = length(floe_arr) diff --git a/examples/restart_sim.jl b/examples/restart_sim.jl index 8a49965..5e89c8e 100644 --- a/examples/restart_sim.jl +++ b/examples/restart_sim.jl @@ -49,8 +49,7 @@ floe_arr = initialize_floe_field( [concentration], domain, hmean, - 0, - Δt; + 0; rng = Xoshiro(1), floe_settings = floe_settings ) diff --git a/examples/shear_flow.jl b/examples/shear_flow.jl index 177cf98..fdd9270 100644 --- a/examples/shear_flow.jl +++ b/examples/shear_flow.jl @@ -48,8 +48,7 @@ floe_arr = initialize_floe_field( [0.8], domain, hmean, - Δh, - Δt; + Δh; rng = Xoshiro(1), floe_settings = floe_settings ) diff --git a/examples/simple_strait.jl b/examples/simple_strait.jl index e3024a2..82a0e0d 100644 --- a/examples/simple_strait.jl +++ b/examples/simple_strait.jl @@ -51,8 +51,7 @@ floe_arr = initialize_floe_field( [0.7], domain, hmean, - Δh, - Δt; + Δh; rng = Xoshiro(3), floe_settings = floe_settings, ) diff --git a/examples/test_run.jl b/examples/test_run.jl index 1805330..3ea4355 100644 --- a/examples/test_run.jl +++ b/examples/test_run.jl @@ -9,8 +9,7 @@ function setup_floes_with_inters(coords, domain, consts, coords, domain, 1.0, - 0.0, - Δt, + 0.0; ) if !isnothing(Δx) for i in eachindex(Δx) @@ -165,8 +164,7 @@ floe_arr = initialize_floe_field( [0.8], domain, 0.5, - 0.0, - Δt; + 0.0; floe_settings = floe_settings, rng = Xoshiro(1), ) diff --git a/examples/uniform_flow.jl b/examples/uniform_flow.jl index edee07b..4d83d8a 100644 --- a/examples/uniform_flow.jl +++ b/examples/uniform_flow.jl @@ -34,8 +34,7 @@ floe_arr = initialize_floe_field( [0.4], domain, hmean, - Δh, - Δt; + Δh; rng = Xoshiro(1), ) diff --git a/src/physical_processes/fractures.jl b/src/physical_processes/fractures.jl index a6e5837..93144d9 100644 --- a/src/physical_processes/fractures.jl +++ b/src/physical_processes/fractures.jl @@ -413,7 +413,6 @@ function split_floe( pieces_polys[i], height, 0, # Δh - range of random height difference between floes - Δt, floe.rmax; floe_settings = floe_settings, rng = rng, diff --git a/src/simulation_components/floe.jl b/src/simulation_components/floe.jl index 003b1b1..bdb9b40 100644 --- a/src/simulation_components/floe.jl +++ b/src/simulation_components/floe.jl @@ -248,7 +248,6 @@ end poly, hmean, Δh, - Δt, rmax; floe_settings, rng = Xoshiro(), @@ -265,7 +264,6 @@ Inputs: hmean average floe height Δh height range - floes will range in height from hmean - Δh to hmean + Δh - Δt timestep of simulation in seconds rmax maximum radius of floe (could be larger given context) floe_settings settings needed to initialize floe settings @@ -279,7 +277,6 @@ function poly_to_floes!( poly, hmean, Δh, - Δt, rmax; floe_settings = FloeSettings(min_floe_area = 0), rng = Xoshiro(), @@ -304,7 +301,7 @@ function poly_to_floes!( new_regions = GO.cut(poly, GI.Line([(cx - rmax, cy), (cx + rmax, cy)]), FT) n = 0 for r in new_regions - n += poly_to_floes!(FT, floes, r, hmean, Δh, Δt, rmax; + n += poly_to_floes!(FT, floes, r, hmean, Δh, rmax; floe_settings = floe_settings, rng = rng, kwargs...) end return n @@ -339,8 +336,7 @@ initialize_floe_field(::Type{FT}, args...; kwargs...) where FT = coords, domain, hmean, - Δh, - Δt; + Δh; floe_settings, rng, ) @@ -355,7 +351,6 @@ Inputs: hmean average floe height Δh height range - floes will range in height from hmean ± Δh - Δt simulation timestep in seconds floe_settings settings needed to initialize floes rng random number generator to generate random floe attributes - default uses Xoshiro256++ algorithm @@ -368,8 +363,7 @@ function _initialize_floe_field( coords::V, domain, hmean, - Δh, - Δt; + Δh; floe_settings = FloeSettings(min_floe_area = 0.0), rng = Xoshiro(), supress_warnings = false, @@ -388,7 +382,6 @@ function _initialize_floe_field( p, hmean, Δh, - Δt, domain.east.val - domain.west.val; floe_settings = floe_settings, rng = rng, @@ -519,8 +512,7 @@ end concentrations, domain, hmean, - Δh, - Δt; + Δh; floe_settings, rng, ) @@ -543,7 +535,6 @@ Inputs: hmean average floe height Δh height range - floes will range in height from hmean - Δh to hmean + Δh - Δt simulation timestep in seconds floe_bounds coordinates of boundary within which to populate floes. This can be smaller that the domain, but will be limited to open space within the domain @@ -560,8 +551,7 @@ function _initialize_floe_field( concentrations, domain, hmean, - Δh, - Δt; + Δh; floe_bounds = _make_bounding_box_polygon(FT, domain.west.val, domain.east.val, domain.south.val, domain.north.val), floe_settings = FloeSettings(FT, min_floe_area = 0), rng = Xoshiro(), @@ -626,7 +616,6 @@ function _initialize_floe_field( piece, hmean, Δh, - Δt, domain.east.val - domain.west.val; floe_settings = floe_settings, rng = rng, diff --git a/test/qualitative_behavior.jl b/test/qualitative_behavior.jl index 6180059..51a63fa 100644 --- a/test/qualitative_behavior.jl +++ b/test/qualitative_behavior.jl @@ -92,8 +92,7 @@ zonal_3rect_floes = initialize_floe_field( ], collision_domain_topo, hmean, - Δh, - Δt, + Δh; ) zonal_3rect_floes.u .= [3.0, -3.0, 0.0] @@ -298,8 +297,7 @@ funky_floe_arr = initialize_floe_field( funky_floe_coords, collision_domain_topo, hmean, - Δh, - Δt, + Δh; ) close(file) funky_floe_arr.u .= (-1)^rand(0:1) * (0.1 * rand(length(funky_floe_arr))) diff --git a/test/test_conservation.jl b/test/test_conservation.jl index 426d993..001256f 100644 --- a/test/test_conservation.jl +++ b/test/test_conservation.jl @@ -100,8 +100,7 @@ end [floe1, floe2], open_domain, # Just affects shape, type doesn't matter 0.25, - 0.0, - Δt; + 0.0; rng = rng, floe_settings = floe_settings, ) @@ -124,8 +123,7 @@ end [floe1, Subzero.translate(floe2, 0.0, 1e4)], open_domain, # Just affects shape, type doesn't matter 0.25, - 0.0, - Δt; + 0.0; rng = rng, floe_settings = floe_settings, ) @@ -147,8 +145,7 @@ end [floe1, floe2, floe3], open_domain, # Just affects shape, type doesn't matter 0.25, - 0.0, - Δt; + 0.0; rng = rng, floe_settings = floe_settings, ) @@ -176,8 +173,7 @@ end ], open_domain, 0.25, - 0.0, - Δt; + 0.0; rng = rng, ) close(file) @@ -202,8 +198,7 @@ end [floe_on_wall_topo], open_domain_w_topography, 0.25, - 0.0, - Δt; + 0.0; rng = rng, ) close(file) diff --git a/test/test_floe.jl b/test/test_floe.jl index 648ba6b..795ca42 100644 --- a/test/test_floe.jl +++ b/test/test_floe.jl @@ -57,16 +57,16 @@ rmax_cpoly = 2sqrt(5^2 + 5^2) # Test polygon with no holes floe_arr = StructArray{Floe{FT}}(undef, 0) - n_new = Subzero.poly_to_floes!(FT, floe_arr, rect_poly, hmean, Δh, Δt, rmax_rect) + n_new = Subzero.poly_to_floes!(FT, floe_arr, rect_poly, hmean, Δh, rmax_rect) @test n_new == 1 && length(floe_arr) == 1 @test !Subzero.hashole(floe_arr.coords[1]) # Test with polygon below minimum floe area - n_new = Subzero.poly_to_floes!(FT, floe_arr, rect_poly, hmean, Δh, Δt, rmax_rect; floe_settings = fs_small_min_area) + n_new = Subzero.poly_to_floes!(FT, floe_arr, rect_poly, hmean, Δh, rmax_rect; floe_settings = fs_small_min_area) @test n_new == 0 && length(floe_arr) == 1 # Test with polygon with a hole that is split into 3 polyons - n_new = Subzero.poly_to_floes!(FT, floe_arr, c_hole_poly, hmean, Δh, Δt, rmax_cpoly) + n_new = Subzero.poly_to_floes!(FT, floe_arr, c_hole_poly, hmean, Δh, rmax_cpoly) @test n_new == 3 && length(floe_arr) == 4 @test !any(Subzero.hashole.(floe_arr.coords)) @@ -94,8 +94,7 @@ floe_coords, domain_no_topo, 0.5, - 0.1, - Δt; + 0.1; )) nfloes = length(floe_coords) @test typeof(floe_arr) <: StructArray{<:Floe} @@ -115,8 +114,7 @@ floe_coords, small_domain_no_topo, hmean, - Δh, - Δt; + Δh; floe_settings = FloeSettings(min_floe_area = 1e5), )) @test typeof(floe_arr) <: StructArray{<:Floe} @@ -128,8 +126,7 @@ floe_coords, domain_with_topo, hmean, - Δh, - Δt; + Δh; floe_settings = FloeSettings(min_floe_area = 10), rng = Xoshiro(0) ) @@ -178,8 +175,7 @@ [0.5], domain_with_topo, 0.5, - 0.1, - Δt; + 0.1; floe_settings = FloeSettings(min_floe_area = 1e4), rng = Xoshiro(1) ) @@ -204,8 +200,7 @@ concentrations, domain_with_topo, 0.5, - 0.1, - Δt; + 0.1; floe_settings = FloeSettings(min_floe_area = 1e4), rng = rng ) @@ -236,7 +231,6 @@ concentrations, domain_with_topo, 0.5, - 0.1, - Δt; + 0.1; )) <: StructArray{<:Floe{Float32}} end \ No newline at end of file diff --git a/test/test_physical_processes/test_collisions.jl b/test/test_physical_processes/test_collisions.jl index d72069e..a2e7567 100644 --- a/test/test_physical_processes/test_collisions.jl +++ b/test/test_physical_processes/test_collisions.jl @@ -227,12 +227,12 @@ coord_list = [coords1, coords2, coords3, coords4] # Make sure nothing is added with non-periodic domain - floe_arr = initialize_floe_field(FT, coord_list, open_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, coord_list, open_domain, hmean, Δh; supress_warnings) add_ghosts!(floe_arr, open_domain) @test floe_arr.coords == coord_list # Add ghost floes in east-west direction - floe_arr = initialize_floe_field(FT, coord_list, ew_periodic_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, coord_list, ew_periodic_domain, hmean, Δh; supress_warnings) add_ghosts!(floe_arr, ew_periodic_domain) @test -1e5 < floe_arr[1].centroid[1] < 1e5 @test -1e5 < floe_arr[2].centroid[2] < 1e5 @@ -247,7 +247,7 @@ @test floe_arr.ghosts[3:6] == [[], [], [], []] # Add ghost floes in the north-south direction - floe_arr = initialize_floe_field(FT, coord_list, ns_periodic_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, coord_list, ns_periodic_domain, hmean, Δh; supress_warnings) add_ghosts!(floe_arr, ns_periodic_domain) @test -1e5 < floe_arr[1].centroid[2] < 1e5 @test -1e5 < floe_arr[3].centroid[2] < 1e5 @@ -263,7 +263,7 @@ @test floe_arr.ghosts[[2; 4:6]] == [[], [], [], []] # Add ghosts in both east-west and north-south directions - floe_arr = initialize_floe_field(FT, coord_list, double_periodic_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, coord_list, double_periodic_domain, hmean, Δh; supress_warnings) add_ghosts!(floe_arr, double_periodic_domain) @test -1e5 < floe_arr.centroid[1][1] < 1e5 @test -1e5 < floe_arr.centroid[1][2] < 1e5 @@ -310,7 +310,7 @@ south_bound_rect_coords = [[[-9.8e4, -1.1e5], [-9.8e4, -9.5e4], [9.8e4, -9.5e4], [9.8e4, -1.1e5], [-9.8e4, -1.1e5]]] # Parent-parent collison (parents are touching) - floe_arr = initialize_floe_field(FT, [lshape_coords, oval_coords], double_periodic_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, [lshape_coords, oval_coords], double_periodic_domain, hmean, Δh; supress_warnings) Subzero.timestep_collisions!(floe_arr, 2, double_periodic_domain, consts, Δt, collision_settings, spinlock) xforce_vals, yforce_vals = abs(floe_arr[1].collision_force[1]), abs(floe_arr[1].collision_force[2]) f1_torque, f2_torque = floe_arr[1].collision_trq, floe_arr[2].collision_trq @@ -330,8 +330,8 @@ # Ghost-Ghost collision (parents aren't touching, only ghosts touch) tall_rect_coords = [splitdims(vcat([5*Lx/8 5*Lx/8 3*Lx/4 3*Lx/4].+1000, [3*Ly/4 5*Ly/4 5*Ly/4 3*Ly/4]))] long_rect_coords = [splitdims(vcat(-[5*Lx/4 5*Lx/4 3*Lx/4-1000 3*Lx/4-1000], -[7*Lx/8 3*Lx/4-1000 3*Lx/4-1000 7*Lx/8]))] - floe_arr = initialize_floe_field(FT, [tall_rect_coords, long_rect_coords], double_periodic_domain, hmean, Δh, Δt; supress_warnings) - trans_arr = initialize_floe_field(FT, [shifted_down_tall_rect_coords, shifted_right_long_rect_coords], double_periodic_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, [tall_rect_coords, long_rect_coords], double_periodic_domain, hmean, Δh; supress_warnings) + trans_arr = initialize_floe_field(FT, [shifted_down_tall_rect_coords, shifted_right_long_rect_coords], double_periodic_domain, hmean, Δh; supress_warnings) Subzero.timestep_collisions!(trans_arr, 2, double_periodic_domain, consts, Δt, collision_settings, spinlock) xforce_vals = abs(trans_arr[1].collision_force[1]) @@ -350,8 +350,8 @@ @test floe_arr[2].interactions[:, [1:5; 7]] == floe_arr[3].interactions[:, [1:5; 7]] # Parent-Ghost Collision - floe_arr = initialize_floe_field(FT, [tall_rect_coords, shifted_up_long_rect_coords], double_periodic_domain, hmean, Δh, Δt; supress_warnings) - trans_arr = initialize_floe_field(FT, [shifted_left_tall_rect_coords, shifted_up_long_rect_coords], double_periodic_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, [tall_rect_coords, shifted_up_long_rect_coords], double_periodic_domain, hmean, Δh; supress_warnings) + trans_arr = initialize_floe_field(FT, [shifted_left_tall_rect_coords, shifted_up_long_rect_coords], double_periodic_domain, hmean, Δh; supress_warnings) Subzero.timestep_collisions!(trans_arr, 2, double_periodic_domain, consts, Δt, collision_settings, spinlock) xforce_vals = abs(trans_arr[1].collision_force[1]) yforce_vals = abs(trans_arr[1].collision_force[2]) @@ -368,7 +368,7 @@ @test isempty(floe_arr[4].interactions) # Parent and ghosts hitting the same floe - floe_arr = initialize_floe_field(FT, [small_corner_rect_coords, large_tri_coords], double_periodic_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, [small_corner_rect_coords, large_tri_coords], double_periodic_domain, hmean, Δh; supress_warnings) add_ghosts!(floe_arr, double_periodic_domain) @test length(floe_arr) == 5 Subzero.timestep_collisions!(floe_arr, 2, double_periodic_domain, consts, Δt, collision_settings, spinlock) @@ -377,7 +377,7 @@ @test floe_arr[1].interactions[1, Subzero.xforce] != floe_arr[1].interactions[2, Subzero.xforce] && floe_arr[1].interactions[1, Subzero.xforce] != floe_arr[1].interactions[3,Subzero.xforce] @test floe_arr[1].interactions[1, Subzero.yforce] != floe_arr[1].interactions[2, Subzero.yforce] && floe_arr[1].interactions[1, Subzero.yforce] != floe_arr[1].interactions[3, Subzero.yforce] - floe_arr = initialize_floe_field(FT, [small_corner_rect_coords, south_bound_rect_coords], double_periodic_domain, hmean, Δh, Δt; supress_warnings) + floe_arr = initialize_floe_field(FT, [small_corner_rect_coords, south_bound_rect_coords], double_periodic_domain, hmean, Δh; supress_warnings) add_ghosts!(floe_arr, double_periodic_domain) @test length(floe_arr) == 6 Subzero.timestep_collisions!(floe_arr, 2, double_periodic_domain, consts, Δt, collision_settings, spinlock) diff --git a/test/test_physical_processes/test_ridge_raft.jl b/test/test_physical_processes/test_ridge_raft.jl index 316b85e..aa6772d 100644 --- a/test/test_physical_processes/test_ridge_raft.jl +++ b/test/test_physical_processes/test_ridge_raft.jl @@ -33,8 +33,7 @@ coords, domain, 1.0, - 0.0, - Δt; + 0.0; ) if !isnothing(Δx) for i in eachindex(Δx) diff --git a/test/test_physical_processes/test_simplification.jl b/test/test_physical_processes/test_simplification.jl index 9975b0a..5f4af56 100644 --- a/test/test_physical_processes/test_simplification.jl +++ b/test/test_physical_processes/test_simplification.jl @@ -256,8 +256,7 @@ [coords1, coords2, coords3, coords4], open_domain_no_topo, 0.5, - 0.0, - Δt; + 0.0; floe_settings = FloeSettings(min_floe_area = 1e6), rng = Xoshiro(1), ) @@ -309,8 +308,7 @@ floe_coords, open_domain_no_topo, 0.5, - 0.0, - Δt; + 0.0; floe_settings = FloeSettings(min_floe_area = 1e6), rng = Xoshiro(1), ) @@ -522,8 +520,7 @@ [coords1, coords2, coords3, coords4], open_domain_no_topo, 0.5, - 0.0, - Δt; + 0.0; floe_settings = FloeSettings(min_floe_area = 1e6), rng = Xoshiro(1), ) diff --git a/test/test_physical_processes/test_welding.jl b/test/test_physical_processes/test_welding.jl index bd0c20c..000d695 100644 --- a/test/test_physical_processes/test_welding.jl +++ b/test/test_physical_processes/test_welding.jl @@ -42,8 +42,7 @@ coords, periodic_domain, 1.0, - 0.0, - Δt; + 0.0; ) end @@ -160,8 +159,7 @@ end coords, periodic_domain, 1.0, - 0.0, - Δt; + 0.0; ) a1, a2, a3 = floe_base.area h1, h2, h3 = floe_base.height