commit 3d6d97cde628bafaecd2d428b7a58c147faba650
parent ed06106295c2a593d7de8aba8e897e2843767423
Author: Anders Damsgaard <andersd@riseup.net>
Date: Fri, 21 Apr 2017 16:35:42 -0400
add ocean to simulation type
Diffstat:
4 files changed, 38 insertions(+), 22 deletions(-)
diff --git a/src/SeaIce.jl b/src/SeaIce.jl
@@ -17,5 +17,6 @@ include("interaction.jl")
include("temporal.jl")
include("temporal_integration.jl")
include("io.jl")
+include("ocean.jl")
end # module end
diff --git a/src/datatypes.jl b/src/datatypes.jl
@@ -82,24 +82,6 @@ type IceFloeArrays
contact_dynamic_friction
end
-## Top-level simulation type
-
-# Simulation-scope data
-type Simulation
- id::String
-
- time_iteration::Int
- time::Float64
- time_total::Float64
- time_step::Float64
- file_time_step::Float64 # 0.0: no output files
- file_number::Int
-
- ice_floes::Array{IceFloeCylindrical, 1}
- contact_pairs::Array{Array{Int, 1}, 1}
- overlaps::Array{Array{Float64, 1}, 1}
-end
-
#=
Type containing all relevant data from MOM6 NetCDF file. The ocean grid is a
staggered of Arakawa-C type, with north-east convention centered on the
@@ -137,8 +119,6 @@ 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, yq, zi, time]`.
-
-
=#
type Ocean
input_file::String
@@ -163,3 +143,21 @@ type Ocean
h::Array{Float64, 4}
e::Array{Float64, 4}
end
+
+# Top-level simulation type
+type Simulation
+ id::String
+
+ time_iteration::Int
+ time::Float64
+ time_total::Float64
+ time_step::Float64
+ file_time_step::Float64
+ file_number::Int
+
+ ice_floes::Array{IceFloeCylindrical, 1}
+ contact_pairs::Array{Array{Int, 1}, 1}
+ overlaps::Array{Array{Float64, 1}, 1}
+
+ ocean::Ocean
+end
diff --git a/src/ocean.jl b/src/ocean.jl
@@ -0,0 +1,15 @@
+"Returns empty ocean type for initialization purposes."
+function createEmptyOcean()
+ return Ocean("",
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1),
+ zeros(1,1,1,1),
+ zeros(1,1,1,1),
+ zeros(1,1,1,1),
+ zeros(1,1,1,1))
+end
diff --git a/src/simulation.jl b/src/simulation.jl
@@ -27,7 +27,8 @@ function createSimulation(;id::String="unnamed",
file_number::Int=0,
ice_floes=Array{IceFloeCylindrical, 1}[],
contact_pairs=Array{Int64, 1}[],
- overlaps=Array{Array{Float64, 1}, 1}[])
+ overlaps=Array{Array{Float64, 1}, 1}[],
+ ocean::Ocean=createEmptyOcean())
return Simulation(id,
time_iteration,
@@ -38,7 +39,8 @@ function createSimulation(;id::String="unnamed",
file_number,
ice_floes,
contact_pairs,
- overlaps)
+ overlaps,
+ ocean)
end
"""