Skip to content

Commit

Permalink
Fix initatlization bug
Browse files Browse the repository at this point in the history
  • Loading branch information
skygering committed Jun 30, 2024
1 parent 24e01ab commit 1aee7db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions examples/many_floes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ocean = Ocean(grid, -0.2, 0.0, -1.0)
atmos = Atmos(grid, 0.0, 0.0, -3.0)

# Domain creation - boundaries and topography
nboundary = (North, grid)
nboundary = OpenBoundary(North, grid)
sboundary = OpenBoundary(South, grid)
eboundary = OpenBoundary(East, grid)
wboundary = OpenBoundary(West, grid)
Expand All @@ -48,11 +48,11 @@ model = Model(grid, ocean, atmos, domain, floe_arr)
modulus = 1.5e3*(mean(sqrt.(floe_arr.area)) + minimum(sqrt.(floe_arr.area)))
consts = Constants(E = modulus)
#consts = Constants(E = modulus, Cd_io = 0.0, Cd_ia = 0.0, Cd_ao = 0.0, f = 0.0, μ = 0.0) # collisions without friction
simulation = Simulation(model = model, consts = consts, Δt = Δt, nΔt = 4000, COLLISION = true, verbose = true)
simulation = Simulation(; model, consts, Δt, nΔt = 4000, verbose = true)

# Output setup
initwriter = InitialStateOutputWriter(dir = "output/voronoi", filename = "initial_state.jld2", overwrite = true)
floewriter = FloeOutputWriter(10, dir = "output/voronoi", filename = "f.jld2", overwrite = true)
# initwriter = InitialStateOutputWriter(dir = "output/voronoi", filename = "initial_state.jld2", overwrite = true)
# floewriter = FloeOutputWriter(10, dir = "output/voronoi", filename = "f.jld2", overwrite = true)

# Run simulation
run!(simulation, [initwriter, floewriter])
# # Run simulation
# run!(simulation, [initwriter, floewriter])
4 changes: 2 additions & 2 deletions src/simulation_components/floe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,15 @@ Output:
"""
function initialize_floe_field(
::Type{FT},
coords,
coords::V,
domain,
hmean,
Δh,
Δt;
floe_settings = FloeSettings(min_floe_area = 0.0),
rng = Xoshiro(),
supress_warnings = false,
) where {FT <: AbstractFloat}
) where {FT <: AbstractFloat, V <: AbstractVector}
floe_arr = StructArray{Floe{FT}}(undef, 0)
floe_polys = [make_polygon(valid_polyvec!(c)) for c in coords]
# Remove overlaps with topography
Expand Down

0 comments on commit 1aee7db

Please sign in to comment.