commit 31de9b70fb547efc6a8f7cf9e203eb82c4824947
parent ff688fa1e18376559fde3c84cd89bd8d46d754bd
Author: Anders Damsgaard <andersd@riseup.net>
Date: Sat, 29 Apr 2017 22:35:49 -0400
add ocean-grid index to ice floe, and dynamic arrays of ocean-grid cell contents
Diffstat:
4 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/datatypes.jl b/src/datatypes.jl
@@ -45,7 +45,7 @@ type IceFloeCylindrical
pressure::float
- #ocean_grid_pos::Array{Int, 2}
+ ocean_grid_pos::Array{Int, 1}
end
# Type for gathering data from ice floe objects into single arrays
@@ -130,6 +130,8 @@ https://mom6.readthedocs.io/en/latest/api/generated/pages/Horizontal_indexing.ht
placement in `[xh, yh, zl, time]`.
* `e::Array{Float64, Int}`: interface height relative to mean sea level [m],
dimensions correspond to placement in `[xh, yh, zi, time]`.
+* `ice_floe_list::Array{Float64, Int}`: interface height relative to mean sea
+ level [m], dimensions correspond to placement in `[xh, yh, zi, time]`.
=#
type Ocean
input_file::Any
@@ -154,7 +156,7 @@ type Ocean
h::Array{Float64, 4}
e::Array{Float64, 4}
- #ice_floe_list::Array{Array{Int, 1}, 2}
+ ice_floe_list::Array{Array{Int, 1}, 2}
end
# Top-level simulation type
diff --git a/src/grid.jl b/src/grid.jl
@@ -35,6 +35,7 @@ Find ice-floe positions in ocean grid, based on their center positions.
function sortIceFloesInOceanGrid!(simulation::Simulation, verbose=true)
# TODO: initialize empty ice_floe_list before appending to list
+ simulation.ocean.ice_floe_list
for idx in 1:length(simulation.ice_floes)
diff --git a/src/icefloe.jl b/src/icefloe.jl
@@ -28,7 +28,8 @@ function addIceFloeCylindrical(simulation::Simulation,
pressure::float = 0.,
fixed::Bool = false,
rotating::Bool = true,
- verbose::Bool = true)
+ verbose::Bool = true,
+ ocean_grid_pos::Array{Int, 1} = [0, 0])
# Check input values
if length(lin_pos) != 2
@@ -97,7 +98,9 @@ function addIceFloeCylindrical(simulation::Simulation,
contact_static_friction,
contact_dynamic_friction,
- pressure
+ pressure,
+
+ ocean_grid_pos
)
# Overwrite previous placeholder values
diff --git a/src/ocean.jl b/src/ocean.jl
@@ -16,7 +16,8 @@ function createEmptyOcean()
zeros(1,1,1,1),
zeros(1,1,1,1),
zeros(1,1,1,1),
- zeros(1,1,1,1))
+ zeros(1,1,1,1),
+ Array{Array{Int, 1}}(1, 1))
end
export readOceanNetCDF
@@ -57,7 +58,9 @@ function readOceanNetCDF(velocity_file::String, grid_file::String)
u,
v,
h,
- e)
+ e,
+ Array{Array{Int, 1}}(size(xh, 1), size(xh, 2))
+ )
return ocean
end
@@ -236,7 +239,8 @@ function createRegularOceanGrid(n::Array{Int, 1},
xq, yq,
xh, yh,
zl, zi,
- u, v, h, e)
+ u, v, h, e,
+ Array{Array{Int, 1}}(size(xh, 1), size(xh, 2)))
end
export addOceanDrag!